mirror of
https://github.com/zulip/zulip.git
synced 2025-11-21 15:09:34 +00:00
lint: Ban general use of user_profile.save().
This often can cause minor caching problems. Obviously, it'd be better if we had access to the AST and thus could do this rule for UserProfile objects in general.
This commit is contained in:
@@ -241,6 +241,14 @@ def build_custom_checkers(by_lang):
|
||||
'description': '@login_required is unsupported; use @zulip_login_required',
|
||||
'good_lines': ['@zulip_login_required', '# foo @login_required'],
|
||||
'bad_lines': ['@login_required', ' @login_required']},
|
||||
{'pattern': '^user_profile[.]save[(][)]',
|
||||
'description': 'Always pass update_fields when saving user_profile objects',
|
||||
'exclude_line': set([
|
||||
('zerver/lib/actions.py', "user_profile.save() # Can't use update_fields because of how the foreign key works."),
|
||||
]),
|
||||
'exclude': set(['zerver/tests', 'zerver/lib/create_user.py']),
|
||||
'good_lines': ['user_profile.save(update_fields=["pointer"])'],
|
||||
'bad_lines': ['user_profile.save()']},
|
||||
{'pattern': '^[^"]*"[^"]*"%\(',
|
||||
'description': 'Missing space around "%"',
|
||||
'good_lines': ['"%s" % ("foo")', '"%s" % (foo)'],
|
||||
|
||||
Reference in New Issue
Block a user