mirror of https://github.com/zulip/zulip.git
semgrep: Add rule to enforce no use of stream.objects.filter.
This commit is contained in:
parent
06c831f146
commit
8e29c88beb
|
@ -390,10 +390,6 @@ python_rules = RuleList(
|
||||||
},
|
},
|
||||||
'description': 'Please use access_stream_by_*() to fetch Stream objects',
|
'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)',
|
{'pattern': '^from (zerver|analytics|confirmation)',
|
||||||
'include_only': {"/migrations/"},
|
'include_only': {"/migrations/"},
|
||||||
'exclude': {
|
'exclude': {
|
||||||
|
|
|
@ -18,3 +18,11 @@ rules:
|
||||||
message: "Useless if statment; both blocks have the same body"
|
message: "Useless if statment; both blocks have the same body"
|
||||||
languages: [python]
|
languages: [python]
|
||||||
severity: ERROR
|
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/"
|
||||||
|
|
Loading…
Reference in New Issue