diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2022-05-25 15:26:09 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2022-05-25 15:26:09 +0200 |
commit | 54c0648bd1d7552d27c577d65f70c25023001071 (patch) | |
tree | 44e37c99e6978e97b36be577a40dac3d463dad2a | |
parent | 379598312f60bf414afa8bf549f7f26af9e578ea (diff) | |
download | psutil-54c0648bd1d7552d27c577d65f70c25023001071.tar.gz |
integrate flake8-blind-except plugin
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
-rw-r--r-- | .flake8 | 27 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rwxr-xr-x | scripts/internal/git_pre_commit.py | 8 |
3 files changed, 22 insertions, 16 deletions
@@ -3,15 +3,20 @@ [flake8] ignore = - W504 # line break after binary operator - # --- flake8-bugbear - B007 # Loop control variable 'keyword' not used within the loop body. If this is intended, start the name with an underscore. - B014 # Redundant exception types in `except (IOError, OSError) as err:`. Write `except OSError as err:`, which catches exactly the same exceptions. - B008 # Do not perform function calls in argument defaults. + W504 # line break after binary operator + + # --- flake8-bugbear plugin + B007 # Loop control variable 'keyword' not used within the loop body. If this is intended, start the name with an underscore. + B014 # Redundant exception types in `except (IOError, OSError) as err:`. Write `except OSError as err:`, which catches exactly the same exceptions. + B008 # Do not perform function calls in argument defaults. + + # --- flake8-blind-except plugin + B902 # blind except Exception: statement + per-file-ignores = - # T001 = print() statement - setup.py:T001 - scripts/*:T001 - psutil/tests/runner.py:T001 - psutil/tests/test_memleaks.py:T001 - .github/workflows/*:T001 + # T001, T201 = print() statement (flake8-print plugin) + setup.py:T001,T201 + scripts/*:T001,T201 + psutil/tests/runner.py:T001,T201 + psutil/tests/test_memleaks.py:T001,T201 + .github/workflows/*:T001,T201 @@ -15,8 +15,9 @@ DEPS = \ concurrencytest \ coverage \ flake8 \ - flake8-print \ flake8-bugbear \ + flake8-print \ + flake8-blind-except \ isort \ pyperf \ pypinfo \ diff --git a/scripts/internal/git_pre_commit.py b/scripts/internal/git_pre_commit.py index c6f223bb..c86c9f93 100755 --- a/scripts/internal/git_pre_commit.py +++ b/scripts/internal/git_pre_commit.py @@ -113,10 +113,10 @@ def main(): if "pdb.set_trace" in line: print("%s:%s %s" % (path, lineno, line)) return exit("you forgot a pdb in your python code") - # bare except clause - if "except:" in line and not line.endswith("# NOQA"): - print("%s:%s %s" % (path, lineno, line)) - return exit("bare except clause") + # # 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") # Python linters if py_files: |