All Projects → cyrus-and → Comb

cyrus-and / Comb

Licence: mit
Interactive code auditing and grep tool in Emacs Lisp

Projects that are alternatives of or similar to Comb

Rg.el
Emacs search tool based on ripgrep
Stars: ✭ 277 (+377.59%)
Mutual labels:  emacs, grep
Linuxtool
Linux下常用工具、命令介绍,跟我学Linux
Stars: ✭ 314 (+441.38%)
Mutual labels:  find, grep
Elsa
Emacs Lisp Static Analyzer
Stars: ✭ 485 (+736.21%)
Mutual labels:  static-analysis, emacs
Org Evil
Evil extensions for Org-mode.
Stars: ✭ 51 (-12.07%)
Mutual labels:  emacs
Fingers.el
Modal editing minor mode for Emacs
Stars: ✭ 51 (-12.07%)
Mutual labels:  emacs
Pysonar2
PySonar2: an advanced semantic indexer for Python
Stars: ✭ 1,074 (+1751.72%)
Mutual labels:  static-analysis
.dot Org Files
Dotfiles, Emacs + Org-mode with babel and Literate programming.
Stars: ✭ 57 (-1.72%)
Mutual labels:  emacs
Cognicrypt
CogniCrypt is an Eclipse plugin that supports Java developers in using Java Cryptographic APIs.
Stars: ✭ 50 (-13.79%)
Mutual labels:  static-analysis
Clj Kondo
A linter for Clojure code that sparks joy.
Stars: ✭ 1,083 (+1767.24%)
Mutual labels:  static-analysis
Org Make Toc
Automatic tables of contents for Org files
Stars: ✭ 53 (-8.62%)
Mutual labels:  emacs
Emacs Fish Completion
[MOVED TO GITLAB]
Stars: ✭ 53 (-8.62%)
Mutual labels:  emacs
Good Scroll.el
Attempt at good pixel-based smooth scrolling in Emacs
Stars: ✭ 52 (-10.34%)
Mutual labels:  emacs
Spoon
Spoon is a metaprogramming library to analyze and transform Java source code (up to Java 15). 🥄 is made with ❤️, 🍻 and ✨. It parses source files to build a well-designed AST with powerful analysis and transformation API.
Stars: ✭ 1,078 (+1758.62%)
Mutual labels:  static-analysis
Emacs.g
The Emacs Collective
Stars: ✭ 51 (-12.07%)
Mutual labels:  emacs
.emacs.d
My emacs config
Stars: ✭ 56 (-3.45%)
Mutual labels:  emacs
Indium
A JavaScript development environment for Emacs
Stars: ✭ 1,058 (+1724.14%)
Mutual labels:  emacs
Org Tfl
Transport for London meets Emacs Orgmode
Stars: ✭ 55 (-5.17%)
Mutual labels:  emacs
Ivy Yasnippet
Preview yasnippet snippets with ivy
Stars: ✭ 53 (-8.62%)
Mutual labels:  emacs
Remacs
Emacs style editor written in Racket
Stars: ✭ 52 (-10.34%)
Mutual labels:  emacs
Findr
🔎 A simple and intuitive find & replace command-line interface.
Stars: ✭ 54 (-6.9%)
Mutual labels:  find

MELPA Stable MELPA

Comb

Comb is a native Emacs Lisp solution to search, browse and annotate occurrences of regular expressions in files. The interactive interface allows to perform an exhaustive classification of all the results to rule out false positives and asses proper matches during code audit.

Browse

Installation

MELPA package

M-x package-install RET comb

Local package

M-x package-install-file RET /path/to/comb/

Manual

(add-to-list 'load-path "/path/to/comb/")
(require 'comb)

Usage

This is a quick walkthrough of some of the features of Comb. To perform a search:

  1. move to the root directory of the repository you want to audit;

  2. run M-x comb;

  3. press c to enter the configuration mode;

  4. fill the desired fields and finally perform a search.

Configure

If there are some results to browse then the *Comb* buffer is displayed, from here it is possible to annotate the results (!) and change their status to approved (a/A), rejected (r/R) or undecided (u/U, the default).

The above actions work on the current result which can be moved to the next (n) or the previous (p), in doing so the *Comb* buffer is updated to show the file that contains the result, which is now highlighted. Only results matching the status filter (cycled with f) and the notes filter regexp (set with F) are displayed. In addition to that, t spawns a buffer containing the list of the currently displayed results, this allows to Isearch the snippets and jump to the result at point.

Report

Finally it is possible to save the current session to file (s) and load it back to resume the audit (l).

See the help (h) for a list of all the features and keybindings.

Regexps

The patterns used by Comb are Emacs-flavored regexps (see the (elisp) Regular Expressions info node). The M-x regexp-builder utility can be used to interactively try the regexps before performing a search, just make sure to use the proper syntax (C-c TAB string) and leave out the surrounding ".

Callbacks

Comb also accepts a list of callbacks that can be used to generate additional search results, e.g., coming from an external linting tool. These functions are executed with the default-directory set to the root directory and the current buffer set to the currently processed file, they accept a relative path as an argument and must return a list of ranges in the form (BEGIN . END).

Here is an example callback:

(defun my-callback (filename)
  "Match only the first occurrence of 'qwerty'."
  (when (re-search-forward "qwerty" nil t)
    (list (cons (match-beginning 0) (match-end 0)))))

Errors in the callback execution are not fatal, they are just reported in the *Messages* buffer.

Configuration

Some faces and options can be configured, take a look at the comb customization group (M-x customize-group RET comb).

Additionally, all the keybindings in the *Comb* buffer can be altered by changing the comb-keymap keymap. For example, to use the arrows to navigate the results use:

(define-key comb-keymap (kbd "<left>") 'comb-prev)
(define-key comb-keymap (kbd "<right>") 'comb-next)

This does not unbind the original keybindings though. It may be convenient to completely replace the keymap instead so to avoid collisions with existing modes:

(setq comb-keymap (make-sparse-keymap))
(define-key comb-keymap (kbd "x") 'comb-quit)
(define-key comb-keymap (kbd "?") 'comb-help)
(define-key comb-keymap (kbd "<left>") 'comb-prev)
(define-key comb-keymap (kbd "<right>") 'comb-next)
;; ...

See the comb-default-keybindings alist to obtain the functions used by the default keybindings.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].