simplify flake8 configuration

we use black since a while, so some stuff does not need to be ignored any more.
This commit is contained in:
Thomas Waldmann 2023-07-25 23:11:27 +02:00
parent c0001fb6ea
commit 3017701958
No known key found for this signature in database
GPG Key ID: 243ACFA951F78E01
9 changed files with 39 additions and 91 deletions

108
setup.cfg
View File

@ -76,112 +76,60 @@ markers =
[flake8]
# for reference ...
# E121 continuation line under-indented for hanging indent
# E122 continuation line missing indentation or outdented
# E123 closing bracket does not match indentation of opening bracket's line
# E125 continuation line with same indent as next logical line
# E126 continuation line over-indented for hanging indent
# E127 continuation line over-indented for visual indent
# E128 continuation line under-indented for visual indent
# E221 multiple spaces before operator
# E226 missing whitespace around arithmetic operator
# E261 at least two spaces before inline comment
# E265 block comment should start with '# '
# E301 expected 1 blank line
# E305 expected 2 blank lines after class or function definition
# E401 multiple imports on one line
# E402 module level import not at top
# E501 line too long
# E722 do not use bare except
# E731 do not assign a lambda expression, use def
# E741 ambiguous variable name
# F401 import unused
# F403 from ... import * used, unable to detect undefined names
# F405 undefined or defined from star imports
# F811 redef of unused var
# F821 undefined name
# W391 blank line at end of file
# #### Pick either W503, or W504 - latest recommendation from pep8 is to ignore W503
# W503 line break before binary operator
# W504 line break after binary operator
# borg code style guidelines:
# Ignoring E203 due to https://github.com/PyCQA/pycodestyle/issues/373
ignore = E226, W503, E203
ignore = W503, E203, F405
# Code style violation exceptions:
# please note that the values are adjusted so that they do not cause failures
# with existing code. if you want to change them, you should first fix all
# flake8 failures that appear with your change.
per_file_ignores =
docs/conf.py:E121,E126,E265,E305,E401,E402
src/borg/archive.py:E122,E125,E127,E402,E501,F401,F405,W504
src/borg/archiver/__init__.py:E402,E501,E722,E741,F405
src/borg/archiver/_common.py:E501,F405
src/borg/archiver/benchmark_cmd.py:F405
src/borg/archiver/config_cmd.py:F405,E722
src/borg/archiver/create_cmd.py:E501,F405
src/borg/archiver/debug_cmd.py:F405
src/borg/archiver/delete_cmd.py:F405
src/borg/archiver/diff_cmd.py:F405
src/borg/archiver/help_cmd.py:E501,F405
src/borg/archiver/key_cmds.py:F405
src/borg/archiver/prune_cmd.py:F405
src/borg/archiver/rcompress_cmd.py:F405
src/borg/archiver/recreate_cmd.py:F405
src/borg/archiver/rdelete_cmd.py:F405
src/borg/archive.py:E402,E501,F401
src/borg/archiver/__init__.py:E402,E741
src/borg/archiver/_common.py:E501
src/borg/archiver/help_cmd.py:E501
src/borg/archiver/rlist_cmd.py:E501
src/borg/archiver/tar_cmds.py:F405
src/borg/cache.py:E127,E128,E402,E501,E722,W504
src/borg/fuse.py:E402,E501,E722,W504
src/borg/fuse_impl.py:F811
src/borg/locking.py:E128,E501,E722
src/borg/manifest.py:E128,E402,E501,F405
src/borg/remote.py:E128,E501,F405
src/borg/repository.py:E126,E128,E501,F401,F405,W504
src/borg/upgrader.py:E501
src/borg/cache.py:E402,E501
src/borg/fuse.py:E402
src/borg/manifest.py:E402,E501
src/borg/remote.py:E501
src/borg/repository.py:E501,F401
src/borg/xattr.py:E402
src/borg/crypto/key.py:E125,E128,E402,E501,F401,F405,W504
src/borg/crypto/keymanager.py:E126,E128,E501,F401
src/borg/crypto/nonces.py:E128,E501
src/borg/helpers/__init__.py:F401,F405
src/borg/crypto/key.py:E402,F401
src/borg/crypto/keymanager.py:F401
src/borg/helpers/__init__.py:F401
src/borg/helpers/checks.py:F401
src/borg/helpers/errors.py:F405
src/borg/helpers/fs.py:F405
src/borg/helpers/misc.py:E402,E722,F401,F405
src/borg/helpers/msgpack.py:E127,F405
src/borg/helpers/parseformat.py:E402,E501,E741,F401,F405
src/borg/helpers/process.py:E402,F401,W504
src/borg/helpers/progress.py:E402
src/borg/helpers/misc.py:E402,F401
src/borg/helpers/parseformat.py:E402,E501,E741,F401
src/borg/helpers/process.py:E402,F401
src/borg/helpers/shellpattern.py:E501
src/borg/platform/__init__.py:F401,F811
src/borg/platform/__init__.py:F401
src/borg/platform/base.py:E402
src/borg/testsuite/__init__.py:E501,F401
src/borg/testsuite/archive.py:E128,W504
src/borg/testsuite/archiver/__init__.py:E128,E501,E722,F401,F405,F811
src/borg/testsuite/archiver/debug_cmds.py:E501,F405
src/borg/testsuite/archiver/disk_full.py:F401,F405,F811
src/borg/testsuite/archiver/extract_cmd.py:F405
src/borg/testsuite/archiver/mount_cmds.py:E501,E722
src/borg/testsuite/archiver/prune_cmd.py:F405
src/borg/testsuite/archiver/rcompress_cmd.py:F405
src/borg/testsuite/archiver/recreate_cmd.py:F405
src/borg/testsuite/archiver/return_codes.py:F401,F405,F811
src/borg/testsuite/__init__.py:F401
src/borg/testsuite/archiver/__init__.py:F401
src/borg/testsuite/archiver/disk_full.py:F401,F811
src/borg/testsuite/archiver/return_codes.py:F401,F811
src/borg/testsuite/benchmark.py:F401,F811
src/borg/testsuite/chunker.py:E501,F405
src/borg/testsuite/chunker_pytest.py:F401,F405
src/borg/testsuite/chunker_slow.py:F405
src/borg/testsuite/crypto.py:E126,E501,E741
src/borg/testsuite/chunker_pytest.py:F401
src/borg/testsuite/crypto.py:E501,E741
src/borg/testsuite/file_integrity.py:F401
src/borg/testsuite/hashindex.py:F401
src/borg/testsuite/helpers.py:E126,E127,E128,E501,F401
src/borg/testsuite/key.py:E501,F401
src/borg/testsuite/locking.py:E126,E128,E501,E722,F401
src/borg/testsuite/patterns.py:E123
src/borg/testsuite/platform.py:E128,E501,F401,F811
src/borg/testsuite/repository.py:E128,E501,F401
src/borg/testsuite/shellpattern.py:E123
src/borg/testsuite/upgrader.py:F405
src/borg/testsuite/helpers.py:E501,F401
src/borg/testsuite/key.py:F401
src/borg/testsuite/locking.py:E501,F401
src/borg/testsuite/platform.py:E501,F401,F811
src/borg/testsuite/repository.py:F401
max_line_length = 120
exclude = build,dist,.git,.idea,.cache,.tox

View File

@ -50,7 +50,7 @@ class ConfigMixIn:
if check_value:
try:
bin_id = unhexlify(value)
except:
except: # noqa
raise ValueError("Invalid value, must be 64 hex digits") from None
if len(bin_id) != 32:
raise ValueError("Invalid value, must be 64 hex digits")

View File

@ -534,7 +534,7 @@ class LocalCache(CacheStatsMixin):
if sync and self.manifest.id != self.cache_config.manifest_id:
self.sync()
self.commit()
except:
except: # noqa
self.close()
raise

View File

@ -52,7 +52,7 @@ def fuse_main():
if has_pyfuse3:
try:
trio.run(llfuse.main)
except:
except: # noqa
return 1 # TODO return signal number if it was killed by signal
else:
return None

View File

@ -31,6 +31,6 @@ for FUSE_IMPL in BORG_FUSE_IMPL.split(","):
else:
raise RuntimeError("unknown fuse implementation in BORG_FUSE_IMPL: '%s'" % BORG_FUSE_IMPL)
else:
llfuse = None
llfuse = None # noqa
has_llfuse = False
has_pyfuse3 = False

View File

@ -35,7 +35,7 @@ def sysinfo():
linux_distribution = None
try:
msgpack_version = ".".join(str(v) for v in msgpack.version)
except:
except: # noqa
msgpack_version = "unknown"
from ..fuse_impl import llfuse, BORG_FUSE_IMPL

View File

@ -157,11 +157,11 @@ class ExclusiveLock:
# should be cleaned up anyway. Try to clean up, but don't crash.
try:
os.unlink(temp_unique_name)
except:
except: # noqa
pass
try:
os.rmdir(temp_path)
except:
except: # noqa
pass
def release(self):
@ -417,7 +417,7 @@ class Lock:
# restore the roster state as before (undo the roster change):
if remove is not None:
self._roster.modify(remove, ADD)
except:
except: # noqa
# avoid orphan lock when an exception happens here, e.g. Ctrl-C!
self._lock.release()
raise

View File

@ -283,7 +283,7 @@ def test_migrate_lock_alive(archivers, request):
try:
with open(assert_data_file, "wb") as _out:
pickle.dump(assert_data, _out)
except:
except: # noqa
pass
try:
return migrate_lock(self, old_id, new_id)
@ -297,7 +297,7 @@ def test_migrate_lock_alive(archivers, request):
try:
with open(assert_data_file, "wb") as _out:
pickle.dump(assert_data, _out)
except:
except: # noqa
pass
wrapper.num_calls = 0

View File

@ -164,7 +164,7 @@ class TestExclusiveLock:
)
except LockTimeout:
print_locked("Thread %2d: Got LockTimeout, finishing my %d. loop cycle." % (thread_id, cycle))
except:
except: # noqa
exception_count = exception_counter.incr()
e = format_exc()
print_locked(