Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

lint: Convert sudo exclusion to double quotes.

Anders Kaseorg1a4f70f1bc26
diff --git a/scripts/lib/zulip_tools.py b/scripts/lib/zulip_tools.py
index e90a5497b1c..61f3861e5ad 100755
--- a/scripts/lib/zulip_tools.py
+++ b/scripts/lib/zulip_tools.py
@@ -457,7 +457,7 @@ def is_root() -> bool:
def run_as_root(args: List[str], **kwargs: Any) -> None:
sudo_args = kwargs.pop('sudo_args', [])
if not is_root():
- args = ['sudo', *sudo_args, '--', *args]
+ args = ["sudo", *sudo_args, "--", *args]
run(args, **kwargs)
def assert_not_running_as_root() -> None:
diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.py
index c16ca57521f..872cd5a06d9 100644
--- a/tools/linter_lib/custom_check.py
+++ b/tools/linter_lib/custom_check.py
@@ -244,12 +244,11 @@ python_rules = RuleList(
'description': 'Unnecessary whitespace between "," and ")"',
'good_lines': ['foo = (1, 2, 3,)', 'foo(bar, 42)'],
'bad_lines': ['foo = (1, 2, 3, )']},
- {'pattern': 'sudo',
+ {'pattern': r'\bsudo\b',
'include_only': {'scripts/'},
'exclude': {'scripts/lib/setup_venv.py'},
'exclude_line': {
- ('scripts/lib/zulip_tools.py', 'sudo_args = kwargs.pop(\'sudo_args\', [])'),
- ('scripts/lib/zulip_tools.py', 'args = [\'sudo\', *sudo_args, \'--\', *args]'),
+ ('scripts/lib/zulip_tools.py', 'args = ["sudo", *sudo_args, "--", *args]'),
},
'description': 'Most scripts are intended to run on systems without sudo.',
'good_lines': ['subprocess.check_call(["ls"])'],