semgrep: Add rule to enforce no use of stream.objects.filter.

This commit is contained in:
Aman Agrawal 2020-04-29 17:20:36 +05:30 committed by Tim Abbott
parent 06c831f146
commit 8e29c88beb
2 changed files with 8 additions and 4 deletions

View File

@ -390,10 +390,6 @@ python_rules = RuleList(
},
'description': 'Please use access_stream_by_*() to fetch Stream objects',
},
{'pattern': 'Stream.objects.filter',
'include_only': {"zerver/views/"},
'description': 'Please use access_stream_by_*() to fetch Stream objects',
},
{'pattern': '^from (zerver|analytics|confirmation)',
'include_only': {"/migrations/"},
'exclude': {

View File

@ -18,3 +18,11 @@ rules:
message: "Useless if statment; both blocks have the same body"
languages: [python]
severity: ERROR
- 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/"