From 5d19d86e4a823bfb37f07485979f4979babe4c44 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Tue, 7 Mar 2023 14:08:35 -0800 Subject: [PATCH] Add flake8-quotes to complain about incorrect quoting so I don't have to! --- .flake8 | 1 + borgmatic/borg/check.py | 2 +- borgmatic/borg/rlist.py | 2 +- borgmatic/commands/arguments.py | 4 ++-- borgmatic/config/validate.py | 2 +- setup.cfg | 2 ++ test_requirements.txt | 1 + tests/unit/borg/test_create.py | 2 +- tests/unit/hooks/test_mongodb.py | 2 +- 9 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..5d93174 --- /dev/null +++ b/.flake8 @@ -0,0 +1 @@ +select = Q0 diff --git a/borgmatic/borg/check.py b/borgmatic/borg/check.py index 484a415..d9beaa6 100644 --- a/borgmatic/borg/check.py +++ b/borgmatic/borg/check.py @@ -139,7 +139,7 @@ def filter_checks_on_frequency( if datetime.datetime.now() < check_time + frequency_delta: remaining = check_time + frequency_delta - datetime.datetime.now() 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) diff --git a/borgmatic/borg/rlist.py b/borgmatic/borg/rlist.py index 9f0de47..2a465fb 100644 --- a/borgmatic/borg/rlist.py +++ b/borgmatic/borg/rlist.py @@ -17,7 +17,7 @@ def resolve_archive_name( Raise ValueError if "latest" is given but there are no archives in the repository. ''' - if archive != "latest": + if archive != 'latest': return archive lock_wait = storage_config.get('lock_wait', None) diff --git a/borgmatic/commands/arguments.py b/borgmatic/commands/arguments.py index 8af9bb5..3acf0d2 100644 --- a/borgmatic/commands/arguments.py +++ b/borgmatic/commands/arguments.py @@ -611,7 +611,7 @@ def make_parsers(): metavar='NAME', nargs='+', 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( '-h', '--help', action='help', help='Show this help message and exit' @@ -805,7 +805,7 @@ def make_parsers(): 'borg', aliases=SUBPARSER_ALIASES['borg'], 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, ) borg_group = borg_parser.add_argument_group('borg arguments') diff --git a/borgmatic/config/validate.py b/borgmatic/config/validate.py index 3a2807f..044e22d 100644 --- a/borgmatic/config/validate.py +++ b/borgmatic/config/validate.py @@ -186,5 +186,5 @@ def guard_single_repository_selected(repository, configurations): if count != 1: raise ValueError( - 'Can\'t determine which repository to use. Use --repository to disambiguate' + "Can't determine which repository to use. Use --repository to disambiguate" ) diff --git a/setup.cfg b/setup.cfg index fe6236b..d8d28f8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -10,6 +10,8 @@ filterwarnings = [flake8] ignore = E501,W503 exclude = *.*/* +multiline-quotes = ''' +docstring-quotes = ''' [tool:isort] force_single_line = False diff --git a/test_requirements.txt b/test_requirements.txt index e47c6fd..9cae8fb 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -5,6 +5,7 @@ click==7.1.2; python_version >= '3.8' colorama==0.4.4 coverage==5.3 flake8==4.0.1 +flake8-quotes==3.3.2 flexmock==0.10.4 isort==5.9.1 mccabe==0.6.1 diff --git a/tests/unit/borg/test_create.py b/tests/unit/borg/test_create.py index 3c4e433..10b5a95 100644 --- a/tests/unit/borg/test_create.py +++ b/tests/unit/borg/test_create.py @@ -1916,7 +1916,7 @@ def test_create_archive_with_stream_processes_ignores_read_special_false_and_log (f'repo::{DEFAULT_ARCHIVE_NAME}',) ) 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 = ( 'borg', 'create', diff --git a/tests/unit/hooks/test_mongodb.py b/tests/unit/hooks/test_mongodb.py index 9544a09..f61f3c7 100644 --- a/tests/unit/hooks/test_mongodb.py +++ b/tests/unit/hooks/test_mongodb.py @@ -72,7 +72,7 @@ def test_dump_databases_runs_mongodump_with_username_and_password(): 'name': 'foo', 'username': 'mongo', 'password': 'trustsome1', - 'authentication_database': "admin", + 'authentication_database': 'admin', } ] process = flexmock()