diff --git a/tools/lint-all b/tools/lint-all index f4719aa0e1..7a3290f0ea 100755 --- a/tools/lint-all +++ b/tools/lint-all @@ -253,6 +253,8 @@ def build_custom_checkers(by_lang): ('tools/tests/test_template_parser.py', '{% foo'), ]), '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)) {'pattern': '\Wjson_error\(_\(?\w+\)', 'exclude': set(['tools/lint-all']), diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.py index 821cfbda8e..2f48f42c75 100644 --- a/zerver/tests/test_subs.py +++ b/zerver/tests/test_subs.py @@ -979,7 +979,7 @@ class SubscriptionRestApiTest(ZulipTestCase): # type: (HttpRequest, UserProfile) -> HttpResponse user_profile.full_name = 'Should not be committed' user_profile.save() - return json_success({}) + return json_success() def method2(req, user_profile): # type: (HttpRequest, UserProfile) -> HttpResponse diff --git a/zerver/views/realm_emoji.py b/zerver/views/realm_emoji.py index 6e442d35bc..f84827fbf5 100644 --- a/zerver/views/realm_emoji.py +++ b/zerver/views/realm_emoji.py @@ -25,4 +25,4 @@ def upload_emoji(request, user_profile): def delete_emoji(request, user_profile, emoji_name): # type: (HttpRequest, UserProfile, text_type) -> HttpResponse do_remove_realm_emoji(user_profile.realm, emoji_name) - return json_success({}) + return json_success() diff --git a/zerver/views/streams.py b/zerver/views/streams.py index 550cee41e8..d41a570728 100644 --- a/zerver/views/streams.py +++ b/zerver/views/streams.py @@ -132,7 +132,7 @@ def deactivate_stream_backend(request, user_profile, stream_name): return json_error(_('Cannot administer invite-only streams this way')) do_deactivate_stream(target) - return json_success({}) + return json_success() @require_realm_admin @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) if stream_name is not None and new_name is not None: do_rename_stream(user_profile.realm, stream_name, new_name) - return json_success({}) + return json_success() def list_subscriptions_backend(request, user_profile): # type: (HttpRequest, UserProfile) -> HttpResponse diff --git a/zerver/views/users.py b/zerver/views/users.py index 9ffe33626d..af59f759a6 100644 --- a/zerver/views/users.py +++ b/zerver/views/users.py @@ -40,7 +40,7 @@ def deactivate_user_own_backend(request, user_profile): if user_profile.is_realm_admin and len(admins) == 1: return json_error(_('Cannot deactivate the only admin')) do_deactivate_user(user_profile) - return json_success({}) + return json_success() def deactivate_bot_backend(request, user_profile, email): # type: (HttpRequest, UserProfile, text_type) -> HttpResponse @@ -58,7 +58,7 @@ def _deactivate_user_profile_backend(request, user_profile, target): return json_error(_('Insufficient permission')) do_deactivate_user(target) - return json_success({}) + return json_success() def reactivate_user_backend(request, user_profile, email): # type: (HttpRequest, UserProfile, text_type) -> HttpResponse @@ -71,7 +71,7 @@ def reactivate_user_backend(request, user_profile, email): return json_error(_('Insufficient permission')) do_reactivate_user(target) - return json_success({}) + return json_success() @has_request_variables 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!")) do_change_full_name(target, new_full_name) - return json_success({}) + return json_success() def avatar(request, email): # type: (HttpRequest, str) -> HttpResponse