News for hackers. Stuff that matters.
Re:Semgrep: Semantic grep for code by mdaniel on Thursday April 22, 2021 @10:16PM (#26910350)
Your example matches the _text_, semgrep matches _the language_

given:

    if 1 \
        == \
        1:
        pass
then

    $ semgrep -e '$X == $X' -l python
    1:if 1 \
    2:        == \
    3:        1:
    ran 1 rules on 1 files: 1 findings
to follow myself up, one can also check for expressions like what I used as an example and say "don't do that", but without regard to what is inside the if

    semgrep -e $'if ...:\n  pass\n' -l python

There are no comments on this comment yet.