Semgrep: Semantic grep for code
semgrep.dev
Semgrep: Semantic grep for code
1–10 of 110 posts
Re: Semgrep: Semantic grep for code
#2Re: Semgrep: Semantic grep for code
#3Wait, is this a web app? I was expecting a command line tool to navigate my code locally.
Re: Semgrep: Semantic grep for code
#4Isn't "grep for code" called just "grep"?
Re: Semgrep: Semantic grep for code
#5> You need to enable JavaScript to run this app. Wait, is this a web app? I was expecting a command line tool to navigate my code locally.
Re: Semgrep: Semantic grep for code
#6> You need to enable JavaScript to run this app. Wait, is this a web app? I was expecting a command line tool to navigate my code locally.
You can write stuff like
# Check for Python == where the left and right hand sides are the same (often a bug)
$ semgrep -e '$X == $X' --lang=py path/to/srcRe: Semgrep: Semantic grep for code
#7> You need to enable JavaScript to run this app. Wait, is this a web app? I was expecting a command line tool to navigate my code locally.
Re: Semgrep: Semantic grep for code
#8> You need to enable JavaScript to run this app. Wait, is this a web app? I was expecting a command line tool to navigate my code locally.
There’s a demo on the site, I assume that’s it?
Re: Semgrep: Semantic grep for code
#9Isn't "grep for code" called just "grep"?
Here’s an elaborate example: https://semgrep.dev/s/ievans:c-dataflow
Re: Semgrep: Semantic grep for code
#10Isn't "grep for code" called just "grep"?
Semgrep started off as a “syntactic grep” but has increasingly become more semantic. So if you want to find all calls to foo that have 1 as the first argument, you just search for foo(1) and even things like x = 1; foo(x); will match. Here’s an elaborate example: https://semgrep.dev/s/ievans:c-dataflow