Skip to content

Commit 2a902e0

Browse files
committed
Use asottile/add-trailing-comma
1 parent 286962e commit 2a902e0

19 files changed

+48
-43
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
- id: reorder-python-imports
2424
language_version: python2.7
2525
- repo: https://github.com/asottile/pyupgrade
26-
sha: v1.0.0
26+
sha: v1.1.2
2727
hooks:
2828
- id: pyupgrade
29+
- repo: https://github.com/asottile/add-trailing-comma
30+
sha: v0.3.0
31+
hooks:
32+
- id: add-trailing-comma

pre_commit_hooks/check_added_large_files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def main(argv=None):
5151
parser = argparse.ArgumentParser()
5252
parser.add_argument(
5353
'filenames', nargs='*',
54-
help='Filenames pre-commit believes are changed.'
54+
help='Filenames pre-commit believes are changed.',
5555
)
5656
parser.add_argument(
5757
'--maxkb', type=int, default=500,

pre_commit_hooks/check_ast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def check_ast(argv=None):
2626
sys.version.partition(' ')[0],
2727
))
2828
print('\n{}'.format(
29-
' ' + traceback.format_exc().replace('\n', '\n ')
29+
' ' + traceback.format_exc().replace('\n', '\n '),
3030
))
3131
retval = 1
3232
return retval

pre_commit_hooks/check_case_conflict.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def main(argv=None):
4545
parser = argparse.ArgumentParser()
4646
parser.add_argument(
4747
'filenames', nargs='*',
48-
help='Filenames pre-commit believes are changed.'
48+
help='Filenames pre-commit believes are changed.',
4949
)
5050

5151
args = parser.parse_args(argv)

pre_commit_hooks/check_docstring_first.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import absolute_import
2+
from __future__ import print_function
23
from __future__ import unicode_literals
34

45
import argparse
@@ -30,15 +31,15 @@ def check_docstring_first(src, filename='<unknown>'):
3031
'{}:{} Multiple module docstrings '
3132
'(first docstring on line {}).'.format(
3233
filename, sline, found_docstring_line,
33-
)
34+
),
3435
)
3536
return 1
3637
elif found_code_line is not None:
3738
print(
3839
'{}:{} Module docstring appears after code '
3940
'(code seen on line {}).'.format(
4041
filename, sline, found_code_line,
41-
)
42+
),
4243
)
4344
return 1
4445
else:

pre_commit_hooks/check_merge_conflict.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
b'<<<<<<< ',
88
b'======= ',
99
b'=======\n',
10-
b'>>>>>>> '
10+
b'>>>>>>> ',
1111
]
1212
WARNING_MSG = 'Merge conflict string "{0}" found in {1}:{2}'
1313

pre_commit_hooks/debug_statement_hook.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def visit_Import(self, node):
2929
def visit_ImportFrom(self, node):
3030
if node.module in DEBUG_STATEMENTS:
3131
self.debug_import_statements.append(
32-
DebugStatement(node.module, node.lineno, node.col_offset)
32+
DebugStatement(node.module, node.lineno, node.col_offset),
3333
)
3434

3535

@@ -52,7 +52,7 @@ def check_file_for_debug_statements(filename):
5252
debug_statement.line,
5353
debug_statement.col,
5454
debug_statement.name,
55-
)
55+
),
5656
)
5757
return 1
5858
else:

pre_commit_hooks/detect_aws_credentials.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def get_aws_credential_files_from_env():
1212
files = set()
1313
for env_var in (
1414
'AWS_CONFIG_FILE', 'AWS_CREDENTIAL_FILE', 'AWS_SHARED_CREDENTIALS_FILE',
15-
'BOTO_CONFIG'
15+
'BOTO_CONFIG',
1616
):
1717
if env_var in os.environ:
1818
files.add(os.environ[env_var])
@@ -23,7 +23,7 @@ def get_aws_secrets_from_env():
2323
"""Extract AWS secrets from environment variables."""
2424
keys = set()
2525
for env_var in (
26-
'AWS_SECRET_ACCESS_KEY', 'AWS_SECURITY_TOKEN', 'AWS_SESSION_TOKEN'
26+
'AWS_SECRET_ACCESS_KEY', 'AWS_SECURITY_TOKEN', 'AWS_SESSION_TOKEN',
2727
):
2828
if env_var in os.environ:
2929
keys.add(os.environ[env_var])
@@ -50,7 +50,7 @@ def get_aws_secrets_from_file(credentials_file):
5050
for section in parser.sections():
5151
for var in (
5252
'aws_secret_access_key', 'aws_security_token',
53-
'aws_session_token'
53+
'aws_session_token',
5454
):
5555
try:
5656
keys.add(parser.get(section, var))
@@ -93,13 +93,13 @@ def main(argv=None):
9393
help=(
9494
'Location of additional AWS credential files from which to get '
9595
'secret keys from'
96-
)
96+
),
9797
)
9898
parser.add_argument(
9999
'--allow-missing-credentials',
100100
dest='allow_missing_credentials',
101101
action='store_true',
102-
help='Allow hook to pass when no credentials are detected.'
102+
help='Allow hook to pass when no credentials are detected.',
103103
)
104104
args = parser.parse_args(argv)
105105

@@ -124,7 +124,7 @@ def main(argv=None):
124124
print(
125125
'No AWS keys were found in the configured credential files and '
126126
'environment variables.\nPlease ensure you have the correct '
127-
'setting for --credentials-file'
127+
'setting for --credentials-file',
128128
)
129129
return 2
130130

pre_commit_hooks/pretty_format_json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def pretty_format_json(argv=None):
120120
except simplejson.JSONDecodeError:
121121
print(
122122
"Input File {} is not a valid JSON, consider using check-json"
123-
.format(json_file)
123+
.format(json_file),
124124
)
125125
return 1
126126

pre_commit_hooks/tests_should_end_in_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def validate_files(argv=None):
1111
parser.add_argument('filenames', nargs='*')
1212
parser.add_argument(
1313
'--django', default=False, action='store_true',
14-
help='Use Django-style test naming pattern (test*.py)'
14+
help='Use Django-style test naming pattern (test*.py)',
1515
)
1616
args = parser.parse_args(argv)
1717

@@ -27,8 +27,8 @@ def validate_files(argv=None):
2727
retcode = 1
2828
print(
2929
'{} does not match pattern "{}"'.format(
30-
filename, test_name_pattern
31-
)
30+
filename, test_name_pattern,
31+
),
3232
)
3333

3434
return retcode

0 commit comments

Comments
 (0)