mirror of https://github.com/zulip/zulip.git
lint: Ban use of json_success({}) instead of json_success().
This commit is contained in:
parent
3ee777a11a
commit
f9f8b18e2f
|
@ -253,6 +253,8 @@ def build_custom_checkers(by_lang):
|
||||||
('tools/tests/test_template_parser.py', '{% foo'),
|
('tools/tests/test_template_parser.py', '{% foo'),
|
||||||
]),
|
]),
|
||||||
'description': 'Used % comprehension without a tuple'},
|
'description': 'Used % comprehension without a tuple'},
|
||||||
|
{'pattern': 'json_success\({}\)',
|
||||||
|
'description': 'Use json_success() to return nothing'},
|
||||||
# To avoid json_error(_variable) and json_error(_(variable))
|
# To avoid json_error(_variable) and json_error(_(variable))
|
||||||
{'pattern': '\Wjson_error\(_\(?\w+\)',
|
{'pattern': '\Wjson_error\(_\(?\w+\)',
|
||||||
'exclude': set(['tools/lint-all']),
|
'exclude': set(['tools/lint-all']),
|
||||||
|
|
|
@ -979,7 +979,7 @@ class SubscriptionRestApiTest(ZulipTestCase):
|
||||||
# type: (HttpRequest, UserProfile) -> HttpResponse
|
# type: (HttpRequest, UserProfile) -> HttpResponse
|
||||||
user_profile.full_name = 'Should not be committed'
|
user_profile.full_name = 'Should not be committed'
|
||||||
user_profile.save()
|
user_profile.save()
|
||||||
return json_success({})
|
return json_success()
|
||||||
|
|
||||||
def method2(req, user_profile):
|
def method2(req, user_profile):
|
||||||
# type: (HttpRequest, UserProfile) -> HttpResponse
|
# type: (HttpRequest, UserProfile) -> HttpResponse
|
||||||
|
|
|
@ -25,4 +25,4 @@ def upload_emoji(request, user_profile):
|
||||||
def delete_emoji(request, user_profile, emoji_name):
|
def delete_emoji(request, user_profile, emoji_name):
|
||||||
# type: (HttpRequest, UserProfile, text_type) -> HttpResponse
|
# type: (HttpRequest, UserProfile, text_type) -> HttpResponse
|
||||||
do_remove_realm_emoji(user_profile.realm, emoji_name)
|
do_remove_realm_emoji(user_profile.realm, emoji_name)
|
||||||
return json_success({})
|
return json_success()
|
||||||
|
|
|
@ -132,7 +132,7 @@ def deactivate_stream_backend(request, user_profile, stream_name):
|
||||||
return json_error(_('Cannot administer invite-only streams this way'))
|
return json_error(_('Cannot administer invite-only streams this way'))
|
||||||
|
|
||||||
do_deactivate_stream(target)
|
do_deactivate_stream(target)
|
||||||
return json_success({})
|
return json_success()
|
||||||
|
|
||||||
@require_realm_admin
|
@require_realm_admin
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
|
@ -174,7 +174,7 @@ def update_stream_backend(request, user_profile, stream_name,
|
||||||
do_change_stream_description(user_profile.realm, stream_name, description)
|
do_change_stream_description(user_profile.realm, stream_name, description)
|
||||||
if stream_name is not None and new_name is not None:
|
if stream_name is not None and new_name is not None:
|
||||||
do_rename_stream(user_profile.realm, stream_name, new_name)
|
do_rename_stream(user_profile.realm, stream_name, new_name)
|
||||||
return json_success({})
|
return json_success()
|
||||||
|
|
||||||
def list_subscriptions_backend(request, user_profile):
|
def list_subscriptions_backend(request, user_profile):
|
||||||
# type: (HttpRequest, UserProfile) -> HttpResponse
|
# type: (HttpRequest, UserProfile) -> HttpResponse
|
||||||
|
|
|
@ -40,7 +40,7 @@ def deactivate_user_own_backend(request, user_profile):
|
||||||
if user_profile.is_realm_admin and len(admins) == 1:
|
if user_profile.is_realm_admin and len(admins) == 1:
|
||||||
return json_error(_('Cannot deactivate the only admin'))
|
return json_error(_('Cannot deactivate the only admin'))
|
||||||
do_deactivate_user(user_profile)
|
do_deactivate_user(user_profile)
|
||||||
return json_success({})
|
return json_success()
|
||||||
|
|
||||||
def deactivate_bot_backend(request, user_profile, email):
|
def deactivate_bot_backend(request, user_profile, email):
|
||||||
# type: (HttpRequest, UserProfile, text_type) -> HttpResponse
|
# type: (HttpRequest, UserProfile, text_type) -> HttpResponse
|
||||||
|
@ -58,7 +58,7 @@ def _deactivate_user_profile_backend(request, user_profile, target):
|
||||||
return json_error(_('Insufficient permission'))
|
return json_error(_('Insufficient permission'))
|
||||||
|
|
||||||
do_deactivate_user(target)
|
do_deactivate_user(target)
|
||||||
return json_success({})
|
return json_success()
|
||||||
|
|
||||||
def reactivate_user_backend(request, user_profile, email):
|
def reactivate_user_backend(request, user_profile, email):
|
||||||
# type: (HttpRequest, UserProfile, text_type) -> HttpResponse
|
# type: (HttpRequest, UserProfile, text_type) -> HttpResponse
|
||||||
|
@ -71,7 +71,7 @@ def reactivate_user_backend(request, user_profile, email):
|
||||||
return json_error(_('Insufficient permission'))
|
return json_error(_('Insufficient permission'))
|
||||||
|
|
||||||
do_reactivate_user(target)
|
do_reactivate_user(target)
|
||||||
return json_success({})
|
return json_success()
|
||||||
|
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def update_user_backend(request, user_profile, email,
|
def update_user_backend(request, user_profile, email,
|
||||||
|
@ -98,7 +98,7 @@ def update_user_backend(request, user_profile, email,
|
||||||
return json_error(_("Name too long!"))
|
return json_error(_("Name too long!"))
|
||||||
do_change_full_name(target, new_full_name)
|
do_change_full_name(target, new_full_name)
|
||||||
|
|
||||||
return json_success({})
|
return json_success()
|
||||||
|
|
||||||
def avatar(request, email):
|
def avatar(request, email):
|
||||||
# type: (HttpRequest, str) -> HttpResponse
|
# type: (HttpRequest, str) -> HttpResponse
|
||||||
|
|
Loading…
Reference in New Issue