Semgrep: Lightweight static analysis for many languages
1–10 of 29 posts
Re: Semgrep: Lightweight static analysis for many languages
#2For 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)
Re: Semgrep: Lightweight static analysis for many languages
#3Love seeing OCaml (or any functional language) :)
Re: Semgrep: Lightweight static analysis for many languages
#4Re: Semgrep: Lightweight static analysis for many languages
#5Re: Semgrep: Lightweight static analysis for many languages
#6Re: Semgrep: Lightweight static analysis for many languages
#7I work on Semgrep; there are a bunch of examples at https://semgrep.live if you're curious about what the syntax looks like. 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.
Re: Semgrep: Lightweight static analysis for many languages
#8https://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).
Re: Semgrep: Lightweight static analysis for many languages
#9I work on Semgrep; there are a bunch of examples at https://semgrep.live if you're curious about what the syntax looks like. 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 )
> Semgrep started as a Facebook open-source project Which project was this? I haven't heard of it before.
Re: Semgrep: Lightweight static analysis for many languages
#10error: 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?