summaryrefslogtreecommitdiff
path: root/pep8.py
diff options
context:
space:
mode:
Diffstat (limited to 'pep8.py')
-rwxr-xr-xpep8.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/pep8.py b/pep8.py
index c3adc43..7d31e9d 100755
--- a/pep8.py
+++ b/pep8.py
@@ -1153,15 +1153,20 @@ def register_check(check, codes=None):
"""
Register a new check object.
"""
+ def _add_check(check, kind, codes, args):
+ if check in _checks[kind]:
+ _checks[kind][check][0].extend(codes or [])
+ else:
+ _checks[kind][check] = (codes or [''], args)
if inspect.isfunction(check):
args = inspect.getargspec(check)[0]
if args and args[0] in ('physical_line', 'logical_line'):
if codes is None:
codes = ERRORCODE_REGEX.findall(check.__doc__ or '')
- _checks[args[0]][check] = (codes or [''], args)
+ _add_check(check, args[0], codes, args)
elif inspect.isclass(check):
if inspect.getargspec(check.__init__)[0][:2] == ['self', 'tree']:
- _checks['tree'][check] = (codes or [''], None)
+ _add_check(check, 'tree', codes, None)
def init_checks_registry():