(no title)
jbmchuck | 6 months ago
~> cat semgrep.yaml
rules:
- id: no-pattern-matching
pattern: |
match ...:
message: |
I'm not a fan of the pattern matching in Python
severity: ERROR
languages:
- python
... ~> cat test.py
#!/usr/bin/env python3
foo = 1
match foo:
case 1:
print("one")
... ~> semgrep --config semgrep.yaml test.py
no-pattern-matching
I'm not a fan of the pattern matching in Python
4┆ match foo:
5┆ case 1:
6┆ print("one")
(exits non-0)
PokestarFan|6 months ago
TheDong|6 months ago
Presumably the reason the parent comment suggested semgrep, not just a grep, is because they're aware that naive substring matching would be wrong.
You could use the playground to check your understanding before implying someone is an idiot.
https://semgrep.dev/playground/new