mcp-server-semgrep
Version:
MCP Server for Semgrep Integration - static code analysis with AI
29 lines (28 loc) • 755 B
YAML
rules:
- id: no-strings-as-booleans
message: >-
Using strings as booleans in Python has unexpected results.
`"one" and "two"` will return "two".
`"one" or "two"` will return "one".
In Python, strings are truthy, and strings with a non-zero length evaluate to
True.
languages: [python]
severity: ERROR
pattern-either:
- pattern: |
if <... "..." and ... ...>:
...
- pattern: |
if <... "..." or ... ...>:
...
- patterns:
- pattern-not: |
if $X in "...":
...
- pattern: |
if "...":
...
metadata:
category: correctness
technology:
- python