json_error: Completely remove json_error.

This completes the migration from `return json_error` to
`raise JsonableError`.
This commit is contained in:
PIG208
2021-07-04 16:00:55 +08:00
committed by Tim Abbott
parent dbf886dfce
commit 8b9011dff8
7 changed files with 8 additions and 25 deletions

View File

@@ -319,18 +319,6 @@ python_rules = RuleList(
"good_lines": ["return json_success()"],
"bad_lines": ["return json_success({})"],
},
{
"pattern": r"\Wjson_error\(_\(?\w+\)",
"exclude": {"zerver/tests", "zerver/views/development/"},
"description": "Argument to json_error should be a literal string enclosed by _()",
"good_lines": ['return json_error(_("string"))'],
"bad_lines": ["return json_error(_variable)", "return json_error(_(variable))"],
},
{
"pattern": r"""\Wjson_error\(['"].+[),]$""",
"exclude": {"zerver/tests", "zerver/views/development/"},
"description": "Argument to json_error should be a literal string enclosed by _()",
},
# To avoid JsonableError(_variable) and JsonableError(_(variable))
{
"pattern": r"\WJsonableError\(_\(?\w.+\)",