mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-06 13:06:53 +00:00
1. mccabe.py support # NOQA 2. run.py support ignore some errors 3. run.py add max_line_length default value
This commit is contained in:
parent
dd92d52f06
commit
ccc7acc62e
3 changed files with 17 additions and 10 deletions
|
|
@ -11,6 +11,7 @@ except ImportError:
|
|||
|
||||
import optparse
|
||||
import sys
|
||||
from flake8.util import skip_warning
|
||||
from collections import defaultdict
|
||||
|
||||
WARNING_CODE = "W901"
|
||||
|
|
@ -243,14 +244,16 @@ def get_code_complexity(code, min=7, filename='stdin'):
|
|||
# ?
|
||||
continue
|
||||
if graph.complexity() >= min:
|
||||
msg = '%s:%d:1: %s %r is too complex (%d)' % (
|
||||
filename,
|
||||
graph.lineno,
|
||||
WARNING_CODE,
|
||||
graph.entity,
|
||||
graph.complexity(),
|
||||
)
|
||||
complex.append(msg)
|
||||
graph.filename = filename
|
||||
if not skip_warning(graph):
|
||||
msg = '%s:%d:1: %s %r is too complex (%d)' % (
|
||||
filename,
|
||||
graph.lineno,
|
||||
WARNING_CODE,
|
||||
graph.entity,
|
||||
graph.complexity(),
|
||||
)
|
||||
complex.append(msg)
|
||||
|
||||
if len(complex) == 0:
|
||||
return 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue