Contributing code
Semgrep welcomes contributions from anyone. If you have an idea for a feature or notice a bug please open an issue. Creating an issue first is preferable to moving directly to a pull request so that we can ensure you're on the right track without any wasted effort. This is also a great way to contribute to Semgrep even if you're not making changes yourself.
This README gives an overview of the repository. For further information on building, you will be directed to semgrep-core contributing and/or semgrep-cli contributing in Making a Change.
File structure
Semgrep consists of a Python wrapper (semgrep-cli
) around an OCaml engine (semgrep-core
) which performs the core parsing/matching work. Within semgrep-core
, there are two sources of parsers, pfff
and tree-sitter-lang
using tree-sitter. Additionally, semgrep-core
contains a subengine, spacegrep
, for generic matching.
You may also be interested in perf
, which contains our code for running repositories against specific rulesets.
There are many other files, but the below diagram broadly displays the file structure.
.
├── cli/ (Python wrapper)
│ └── src/
│ └── semgrep/
│
├── src/ (semgrep-core)
│ │── analyzing/ (Dataflow analysis)
│ │── core_cli/ (Entrypoint for semgrep-core)
│ └── matching/ (Matching engine)
│
├── languages/ (Language parsers)
│
├── libs/ (Library components)
│ │── ast_generic/ (Generic AST)