lint: Convert sudo exclusion to double quotes.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-10-29 16:49:51 -07:00 committed by Tim Abbott
parent 07efcf61d4
commit 1a4f70f1bc
2 changed files with 3 additions and 4 deletions

View File

@ -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:

View File

@ -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"])'],