diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2023-04-01 12:24:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-01 12:24:59 +0200 |
commit | 7eadee31db2f038763a3a6f978db1ea76bbc4674 (patch) | |
tree | 55d75da147cc3a40b989e18df1126de5167b66cf /scripts/internal/git_pre_commit.py | |
parent | 7d55ce4e3d81705264398a15ffaa1896f4e1aefc (diff) | |
download | psutil-7eadee31db2f038763a3a6f978db1ea76bbc4674.tar.gz |
Fix pylint warnings / cleanup (#2218)
Diffstat (limited to 'scripts/internal/git_pre_commit.py')
-rwxr-xr-x | scripts/internal/git_pre_commit.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/scripts/internal/git_pre_commit.py b/scripts/internal/git_pre_commit.py index 87783627..dad0066b 100755 --- a/scripts/internal/git_pre_commit.py +++ b/scripts/internal/git_pre_commit.py @@ -107,16 +107,16 @@ def main(): # space at end of line if line.endswith(' '): print("%s:%s %r" % (path, lineno, line)) - return exit("space at end of line") + return sys.exit("space at end of line") line = line.rstrip() # # pdb (now provided by flake8-debugger plugin) # if "pdb.set_trace" in line: # print("%s:%s %s" % (path, lineno, line)) - # return exit("you forgot a pdb in your python code") + # return sys.exit("you forgot a pdb in your python code") # # bare except clause (now provided by flake8-blind-except plugin) # if "except:" in line and not line.endswith("# NOQA"): # print("%s:%s %s" % (path, lineno, line)) - # return exit("bare except clause") + # return sys.exit("bare except clause") # Python linters if py_files: @@ -125,28 +125,28 @@ def main(): cmd = "%s -m flake8 --config=.flake8 %s" % (PYTHON, " ".join(py_files)) ret = subprocess.call(shlex.split(cmd)) if ret != 0: - return exit("python code didn't pass 'flake8' style check; " - "try running 'make fix-flake8'") + return sys.exit("python code didn't pass 'flake8' style check; " + "try running 'make fix-flake8'") # isort cmd = "%s -m isort --check-only %s" % ( PYTHON, " ".join(py_files)) ret = subprocess.call(shlex.split(cmd)) if ret != 0: - return exit("python code didn't pass 'isort' style check; " - "try running 'make fix-imports'") + return sys.exit("python code didn't pass 'isort' style check; " + "try running 'make fix-imports'") # C linter if c_files: # XXX: we should escape spaces and possibly other amenities here cmd = "%s scripts/internal/clinter.py %s" % (PYTHON, " ".join(c_files)) ret = subprocess.call(cmd, shell=True) if ret != 0: - return exit("C code didn't pass style check") + return sys.exit("C code didn't pass style check") if new_rm_mv: out = sh("%s scripts/internal/generate_manifest.py" % PYTHON) with open_text('MANIFEST.in') as f: if out.strip() != f.read().strip(): - exit("some files were added, deleted or renamed; " - "run 'make generate-manifest' and commit again") + sys.exit("some files were added, deleted or renamed; " + "run 'make generate-manifest' and commit again") main() |