mirror of https://github.com/zulip/zulip.git
lint: Ban most use of get_stream from zerver/lib/actions.py.
This commit is contained in:
parent
01daa3e91a
commit
b1c2ff9d05
|
@ -414,10 +414,18 @@ def build_custom_checkers(by_lang):
|
||||||
'description': 'Please use access_stream_by_*() to fetch Stream objects',
|
'description': 'Please use access_stream_by_*() to fetch Stream objects',
|
||||||
},
|
},
|
||||||
{'pattern': 'get_stream[(]',
|
{'pattern': 'get_stream[(]',
|
||||||
'include_only': set(["zerver/views/"]),
|
'include_only': set(["zerver/views/", "zerver/lib/actions.py"]),
|
||||||
|
# messages.py needs to support accessing invite-only streams
|
||||||
|
# that you are no longer subscribed to, so need get_stream.
|
||||||
'exclude': set(['zerver/views/messages.py']),
|
'exclude': set(['zerver/views/messages.py']),
|
||||||
'exclude_line': set([
|
'exclude_line': set([
|
||||||
|
# This is a check for whether a stream rename is invalid because it already exists
|
||||||
('zerver/views/streams.py', 'if get_stream(new_name, user_profile.realm) is not None:'),
|
('zerver/views/streams.py', 'if get_stream(new_name, user_profile.realm) is not None:'),
|
||||||
|
# This is a check for whether a stream rename is invalid because it already exists
|
||||||
|
('zerver/lib/actions.py', 'existing_deactivated_stream = get_stream(new_name, stream.realm)'),
|
||||||
|
# This one in check_message is kinda terrible, since it's
|
||||||
|
# how most instances are written, but better to exclude something than nothing
|
||||||
|
('zerver/lib/actions.py', 'stream = get_stream(stream_name, realm)'),
|
||||||
]),
|
]),
|
||||||
'description': 'Please use access_stream_by_*() to fetch Stream objects',
|
'description': 'Please use access_stream_by_*() to fetch Stream objects',
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue