Add flake8-quotes to complain about incorrect quoting so I don't have to!

This commit is contained in:
Dan Helfman 2023-03-07 14:08:35 -08:00
parent 62ae82f2c0
commit 5d19d86e4a
9 changed files with 11 additions and 7 deletions

1
.flake8 Normal file
View file

@ -0,0 +1 @@
select = Q0

View file

@ -139,7 +139,7 @@ def filter_checks_on_frequency(
if datetime.datetime.now() < check_time + frequency_delta: if datetime.datetime.now() < check_time + frequency_delta:
remaining = check_time + frequency_delta - datetime.datetime.now() remaining = check_time + frequency_delta - datetime.datetime.now()
logger.info( logger.info(
f"Skipping {check} check due to configured frequency; {remaining} until next check" f'Skipping {check} check due to configured frequency; {remaining} until next check'
) )
filtered_checks.remove(check) filtered_checks.remove(check)

View file

@ -17,7 +17,7 @@ def resolve_archive_name(
Raise ValueError if "latest" is given but there are no archives in the repository. Raise ValueError if "latest" is given but there are no archives in the repository.
''' '''
if archive != "latest": if archive != 'latest':
return archive return archive
lock_wait = storage_config.get('lock_wait', None) lock_wait = storage_config.get('lock_wait', None)

View file

@ -611,7 +611,7 @@ def make_parsers():
metavar='NAME', metavar='NAME',
nargs='+', nargs='+',
dest='databases', dest='databases',
help='Names of databases to restore from archive, defaults to all databases. Note that any databases to restore must be defined in borgmatic\'s configuration', help="Names of databases to restore from archive, defaults to all databases. Note that any databases to restore must be defined in borgmatic's configuration",
) )
restore_group.add_argument( restore_group.add_argument(
'-h', '--help', action='help', help='Show this help message and exit' '-h', '--help', action='help', help='Show this help message and exit'
@ -805,7 +805,7 @@ def make_parsers():
'borg', 'borg',
aliases=SUBPARSER_ALIASES['borg'], aliases=SUBPARSER_ALIASES['borg'],
help='Run an arbitrary Borg command', help='Run an arbitrary Borg command',
description='Run an arbitrary Borg command based on borgmatic\'s configuration', description="Run an arbitrary Borg command based on borgmatic's configuration",
add_help=False, add_help=False,
) )
borg_group = borg_parser.add_argument_group('borg arguments') borg_group = borg_parser.add_argument_group('borg arguments')

View file

@ -186,5 +186,5 @@ def guard_single_repository_selected(repository, configurations):
if count != 1: if count != 1:
raise ValueError( raise ValueError(
'Can\'t determine which repository to use. Use --repository to disambiguate' "Can't determine which repository to use. Use --repository to disambiguate"
) )

View file

@ -10,6 +10,8 @@ filterwarnings =
[flake8] [flake8]
ignore = E501,W503 ignore = E501,W503
exclude = *.*/* exclude = *.*/*
multiline-quotes = '''
docstring-quotes = '''
[tool:isort] [tool:isort]
force_single_line = False force_single_line = False

View file

@ -5,6 +5,7 @@ click==7.1.2; python_version >= '3.8'
colorama==0.4.4 colorama==0.4.4
coverage==5.3 coverage==5.3
flake8==4.0.1 flake8==4.0.1
flake8-quotes==3.3.2
flexmock==0.10.4 flexmock==0.10.4
isort==5.9.1 isort==5.9.1
mccabe==0.6.1 mccabe==0.6.1

View file

@ -1916,7 +1916,7 @@ def test_create_archive_with_stream_processes_ignores_read_special_false_and_log
(f'repo::{DEFAULT_ARCHIVE_NAME}',) (f'repo::{DEFAULT_ARCHIVE_NAME}',)
) )
flexmock(module.environment).should_receive('make_environment') flexmock(module.environment).should_receive('make_environment')
flexmock(module).should_receive('collect_special_file_paths').and_return(("/dev/null",)) flexmock(module).should_receive('collect_special_file_paths').and_return(('/dev/null',))
create_command = ( create_command = (
'borg', 'borg',
'create', 'create',

View file

@ -72,7 +72,7 @@ def test_dump_databases_runs_mongodump_with_username_and_password():
'name': 'foo', 'name': 'foo',
'username': 'mongo', 'username': 'mongo',
'password': 'trustsome1', 'password': 'trustsome1',
'authentication_database': "admin", 'authentication_database': 'admin',
} }
] ]
process = flexmock() process = flexmock()