Sfoglia il codice sorgente

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

Dan Helfman 2 anni fa
parent
commit
5d19d86e4a

+ 1 - 0
.flake8

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

+ 1 - 1
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)
 

+ 1 - 1
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)

+ 2 - 2
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')

+ 1 - 1
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"
         )

+ 2 - 0
setup.cfg

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

+ 1 - 0
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

+ 1 - 1
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',

+ 1 - 1
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()