2020-04-27 13:46:53 +02:00
|
|
|
# See https://github.com/returntocorp/semgrep/blob/experimental/docs/config/advanced.md
|
2020-03-19 00:32:26 +01:00
|
|
|
|
|
|
|
rules:
|
2020-04-27 13:46:53 +02:00
|
|
|
####################### PYTHON RULES #######################
|
2020-03-19 00:32:26 +01:00
|
|
|
- id: deprecated-render-usage
|
|
|
|
pattern: django.shortcuts.render_to_response(...)
|
2020-04-27 13:46:53 +02:00
|
|
|
message: "Use render() (from django.shortcuts) instead of render_to_response()"
|
2020-03-19 00:32:26 +01:00
|
|
|
languages: [python]
|
|
|
|
severity: ERROR
|
2020-04-27 13:46:53 +02:00
|
|
|
|
2020-03-19 00:32:26 +01:00
|
|
|
- id: useless-if-body
|
|
|
|
patterns:
|
2020-04-27 13:46:53 +02:00
|
|
|
- pattern: |
|
|
|
|
if $X:
|
|
|
|
$S
|
|
|
|
else:
|
|
|
|
$S
|
|
|
|
message: "Useless if statment; both blocks have the same body"
|
2020-03-19 00:32:26 +01:00
|
|
|
languages: [python]
|
|
|
|
severity: ERROR
|
2020-04-29 13:50:36 +02:00
|
|
|
|
|
|
|
- id: dont-use-stream-objects-filter
|
|
|
|
pattern: Stream.objects.filter(...)
|
|
|
|
message: "Please use access_stream_by_*() to fetch Stream objects"
|
|
|
|
languages: [python]
|
|
|
|
severity: ERROR
|
|
|
|
paths:
|
|
|
|
- directory: "zerver/views/"
|