Semgrep: Lightweight static analysis for many languages
github.com
github.com
For context, Semgrep started as a Facebook open-source project inspired from a Inria project named Coccinelle, which has has made a couple thousand or so automatic patches to the Linux kernel over the years using a semantic patch language (http://coccinelle.lip6.fr/sp.php)
Which project was this? I haven't heard of it before.
Are there any plans to include C# or F#?
https://github.com/zulip/zulip/blob/master/tools/semgrep.yml
I really appreciate the semantic checks. They're especially nice for security-sensitive lint rules, but really it removes the hacky regular expressions feel of adding lint rules to a codebase. It's also been useful for some codebase migrations (semgrep is more precise than e.g. `git grep -w` for finding "All the places we use code pattern X that we want to stop doing").
My main complaint about it is performance -- it's too slow per unit rule for us to replace the regular expression based system that we run on our whole codebase (so we can't happily convert our other ~100 regular expression-based lint rules to semgrep (https://github.com/zulip/zulip/blob/master/tools/linter_lib/...).
But performance has been improving a lot over time, and I think there's potential for it to be faster (E.g. mypy, the Python type-checker, has gotten way way faster in the last year or two). Because semgrep is getting active investment from a venture-funded company that I imagine will improve the performance, I expect semgrep to be a tool that most projects serious about code quality are using in a few years.
I should add that performance may also be less important to others than it is to us; we run all of our linters (currently 20 distinct linters, including eslint, prettier, pyflakes, isort, shellcheck, etc.) in parallel using https://github.com/zulip/zulint, with the goal of being able to lint the entire codebase in <30s or changed files in under 1s (obviously time depends on number of files changed).
> message: "Do not write a SQL injection vulnerability please"
I filed a ticket for VS Code support because I’ve seen it mentioned in a few of the other comments: https://github.com/returntocorp/semgrep/issues/1329
Has anyone compared the 2? They seem similar (structured find/replace, with registries of rules).
Semgrep uses an AST that's equivalent to the parser of the language itself so it's much higher resolution in terms of what you can match.
That explains why too that Comby supports so many languages so easily, and how easy it is to add your own DSL.
Love seeing OCaml (or any functional language) :)
Has anyone done something like this, or am I riding the 2016 neural net hype train still?
TabNine was acquired by Codota earlier this year [2].
[1] https://www.tabnine.com/blog/deep/
[2] https://techcrunch.com/2020/04/27/codota-picks-up-12m-for-an...
error: can't copy 'XXXXXXXXXXXXXX\Local\Temp\pip-install-cq40rzma\semgrep-files/semgrep-core': doesn't exist or not a regular file
Anyone here know how to fix that?
https://github.com/returntocorp/semgrep/issues/new?assignees...