double-quote-string-fixer
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4990537..55c6f73 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml
@@ -10,6 +10,7 @@ - id: check-yaml - id: debug-statements - id: name-tests-test + - id: double-quote-string-fixer - id: requirements-txt-fixer - repo: https://gitlab.com/pycqa/flake8 rev: 3.7.1
diff --git a/pre_commit_hooks/fix_encoding_pragma.py b/pre_commit_hooks/fix_encoding_pragma.py index dbe9c6c..bde4e78 100644 --- a/pre_commit_hooks/fix_encoding_pragma.py +++ b/pre_commit_hooks/fix_encoding_pragma.py
@@ -147,5 +147,5 @@ return retv -if __name__ == "__main__": +if __name__ == '__main__': exit(main())
diff --git a/pre_commit_hooks/sort_simple_yaml.py b/pre_commit_hooks/sort_simple_yaml.py index 3c8ef16..a381679 100755 --- a/pre_commit_hooks/sort_simple_yaml.py +++ b/pre_commit_hooks/sort_simple_yaml.py
@@ -115,9 +115,9 @@ new_lines = sort(lines) if lines != new_lines: - print("Fixing file `{filename}`".format(filename=filename)) + print('Fixing file `{filename}`'.format(filename=filename)) f.seek(0) - f.write("\n".join(new_lines) + "\n") + f.write('\n'.join(new_lines) + '\n') f.truncate() retval = 1
diff --git a/pre_commit_hooks/trailing_whitespace_fixer.py b/pre_commit_hooks/trailing_whitespace_fixer.py index b2b6418..2ccc003 100644 --- a/pre_commit_hooks/trailing_whitespace_fixer.py +++ b/pre_commit_hooks/trailing_whitespace_fixer.py
@@ -69,7 +69,7 @@ for ext in md_exts: if any(c in ext[1:] for c in r'./\:'): parser.error( - "bad --markdown-linebreak-ext extension {!r} (has . / \\ :)\n" + 'bad --markdown-linebreak-ext extension {!r} (has . / \\ :)\n' " (probably filename; use '--markdown-linebreak-ext=EXT')" .format(ext), )
diff --git a/tests/check_builtin_literals_test.py b/tests/check_builtin_literals_test.py index dbb9cc4..19263b7 100644 --- a/tests/check_builtin_literals_test.py +++ b/tests/check_builtin_literals_test.py
@@ -47,36 +47,36 @@ # see #285 ('x[0]()', []), # complex - ("0j", []), - ("complex()", [Call('complex', 1, 0)]), - ("complex(0, 0)", []), + ('0j', []), + ('complex()', [Call('complex', 1, 0)]), + ('complex(0, 0)', []), ("complex('0+0j')", []), ('builtins.complex()', []), # float - ("0.0", []), - ("float()", [Call('float', 1, 0)]), + ('0.0', []), + ('float()', [Call('float', 1, 0)]), ("float('0.0')", []), ('builtins.float()', []), # int - ("0", []), - ("int()", [Call('int', 1, 0)]), + ('0', []), + ('int()', [Call('int', 1, 0)]), ("int('0')", []), ('builtins.int()', []), # list - ("[]", []), - ("list()", [Call('list', 1, 0)]), + ('[]', []), + ('list()', [Call('list', 1, 0)]), ("list('abc')", []), ("list([c for c in 'abc'])", []), ("list(c for c in 'abc')", []), ('builtins.list()', []), # str ("''", []), - ("str()", [Call('str', 1, 0)]), + ('str()', [Call('str', 1, 0)]), ("str('0')", []), ('builtins.str()', []), # tuple - ("()", []), - ("tuple()", [Call('tuple', 1, 0)]), + ('()', []), + ('tuple()', [Call('tuple', 1, 0)]), ("tuple('abc')", []), ("tuple([c for c in 'abc'])", []), ("tuple(c for c in 'abc')", []), @@ -91,9 +91,9 @@ @pytest.mark.parametrize( ('expression', 'calls'), [ - ("{}", []), - ("dict()", [Call('dict', 1, 0)]), - ("dict(a=1, b=2, c=3)", []), + ('{}', []), + ('dict()', [Call('dict', 1, 0)]), + ('dict(a=1, b=2, c=3)', []), ("dict(**{'a': 1, 'b': 2, 'c': 3})", []), ("dict([(k, v) for k, v in [('a', 1), ('b', 2), ('c', 3)]])", []), ("dict((k, v) for k, v in [('a', 1), ('b', 2), ('c', 3)])", []), @@ -108,8 +108,8 @@ @pytest.mark.parametrize( ('expression', 'calls'), [ - ("dict()", [Call('dict', 1, 0)]), - ("dict(a=1, b=2, c=3)", [Call('dict', 1, 0)]), + ('dict()', [Call('dict', 1, 0)]), + ('dict(a=1, b=2, c=3)', [Call('dict', 1, 0)]), ("dict(**{'a': 1, 'b': 2, 'c': 3})", [Call('dict', 1, 0)]), ('builtins.dict()', []), ],
diff --git a/tests/detect_aws_credentials_test.py b/tests/detect_aws_credentials_test.py index 31ba33e..777fb48 100644 --- a/tests/detect_aws_credentials_test.py +++ b/tests/detect_aws_credentials_test.py
@@ -123,7 +123,7 @@ mock_secrets_file.return_value = set() ret = main(( get_resource_path('aws_config_without_secrets.ini'), - "--credentials-file=testing/resources/credentailsfilethatdoesntexist", + '--credentials-file=testing/resources/credentailsfilethatdoesntexist', )) assert ret == 2 out, _ = capsys.readouterr() @@ -143,7 +143,7 @@ mock_secrets_file.return_value = set() ret = main(( get_resource_path('aws_config_without_secrets.ini'), - "--credentials-file=testing/resources/credentailsfilethatdoesntexist", - "--allow-missing-credentials", + '--credentials-file=testing/resources/credentailsfilethatdoesntexist', + '--allow-missing-credentials', )) assert ret == 0
diff --git a/tests/pretty_format_json_test.py b/tests/pretty_format_json_test.py index bf7a16f..3b7b9a2 100644 --- a/tests/pretty_format_json_test.py +++ b/tests/pretty_format_json_test.py
@@ -41,7 +41,7 @@ assert ret == expected_retval -@pytest.mark.skipif(PY2, reason="Requires Python3") +@pytest.mark.skipif(PY2, reason='Requires Python3') @pytest.mark.parametrize( ('filename', 'expected_retval'), ( ('not_pretty_formatted_json.json', 1),
diff --git a/tests/sort_simple_yaml_test.py b/tests/sort_simple_yaml_test.py index 72f5bec..4261d5d 100644 --- a/tests/sort_simple_yaml_test.py +++ b/tests/sort_simple_yaml_test.py
@@ -45,7 +45,7 @@ file_path = os.path.join(tmpdir.strpath, 'foo.yaml') with open(file_path, 'w') as f: - f.write("\n".join(bad_lines) + "\n") + f.write('\n'.join(bad_lines) + '\n') assert main([file_path]) == retval