From 1d4e9a8968c532a473cecdbf9ea7d9420a8e5a67 Mon Sep 17 00:00:00 2001 From: Steven Kryskalla Date: Thu, 23 Feb 2012 15:03:21 -0800 Subject: [PATCH 1/3] mccabe warning message was missing a ":" after the column number update tests to match the new format with the warning code tests pass in python 2.7 and 3.2 --- flake8/mccabe.py | 2 +- flake8/tests/test_mccabe.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flake8/mccabe.py b/flake8/mccabe.py index c41334c..5e55f2f 100644 --- a/flake8/mccabe.py +++ b/flake8/mccabe.py @@ -243,7 +243,7 @@ def get_code_complexity(code, min=7, filename='stdin'): # ? continue if graph.complexity() >= min: - msg = '%s:%d:1 %s %r is too complex (%d)' % ( + msg = '%s:%d:1: %s %r is too complex (%d)' % ( filename, graph.lineno, WARNING_CODE, diff --git a/flake8/tests/test_mccabe.py b/flake8/tests/test_mccabe.py index 42032f2..887599f 100644 --- a/flake8/tests/test_mccabe.py +++ b/flake8/tests/test_mccabe.py @@ -36,6 +36,6 @@ class McCabeTest(unittest.TestCase): self.assertEqual(get_code_complexity(_GLOBAL, 1), 2) self.out.seek(0) res = self.out.read().strip().split('\n') - wanted = ["stdin:5:1: 'a' is too complex (4)", - 'stdin:Loop 2 is too complex (2)'] + wanted = ["stdin:5:1: W901 'a' is too complex (4)", + "stdin:2:1: W901 'Loop 2' is too complex (2)"] self.assertEqual(res, wanted) From 420d998ff34d0dc28df95f44b2ec7afbd51c0d2a Mon Sep 17 00:00:00 2001 From: Steven Kryskalla Date: Thu, 23 Feb 2012 15:25:02 -0800 Subject: [PATCH 2/3] adding a list of all warning / error codes to README adding myself to contributors --- CONTRIBUTORS.txt | 1 + README | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index fd6b7a8..ebecd32 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -8,3 +8,4 @@ Contributors (by order of appearence) : - Chris Adams - Ben Bass - Ask Solem +- Steven Kryskalla diff --git a/README b/README index e30f326..8f6a6ad 100644 --- a/README +++ b/README @@ -133,6 +133,66 @@ projects: - PyFlakes: http://divmod.org/trac/wiki/DivmodPyflakes - McCabe: http://nedbatchelder.com/blog/200803/python_code_complexity_microtool.html +Warning / Error codes +===================== + +Below are lists of all warning and error codes flake8 will generate, broken +out by component. + +pep8: + +- E101: indentation contains mixed spaces and tabs +- E111: indentation is not a multiple of four +- E112: expected an indented block +- E113: unexpected indentation +- E201: whitespace after char +- E202: whitespace before char +- E203: whitespace before char +- E211: whitespace before text +- E223: tab / multiple spaces before operator +- E224: tab / multiple spaces after operator +- E225: missing whitespace around operator +- E225: missing whitespace around operator +- E231: missing whitespace after char +- E241: multiple spaces after separator +- E242: tab after separator +- E251: no spaces around keyword / parameter equals +- E262: inline comment should start with '# ' +- E301: expected 1 blank line, found 0 +- E302: expected 2 blank lines, found +- E303: too many blank lines () +- E304: blank lines found after function decorator +- E401: multiple imports on one line +- E501: line too long ( characters) +- E701: multiple statements on one line (colon) +- E702: multiple statements on one line (semicolon) +- W191: indentation contains tabs +- W291: trailing whitespace +- W292: no newline at end of file +- W293: blank line contains whitespace +- W391: blank line at end of file +- W601: .has_key() is deprecated, use 'in' +- W602: deprecated form of raising exception +- W603: '<>' is deprecated, use '!=' +- W604: backticks are deprecated, use 'repr()' + +pyflakes: + +- W402: imported but unused +- W403: import from line shadowed by loop variable +- W404: 'from import *' used; unable to detect undefined names +- W405: future import(s) after other statements +- W801: redefinition of unused from line +- W802: undefined name +- W803: undefined name in __all__ +- W804: local variable (defined in enclosing scope on line ) referenced before assignment +- W805: duplicate argument in function definition +- W806: redefinition of function from line +- W806: local variable is assigned to but never used + +McCabe: + +- W901: '' is too complex ('') CHANGES ======= From 99bd4737e20e61f337b7501bdbb96eb0e25dbe07 Mon Sep 17 00:00:00 2001 From: Steven Kryskalla Date: Thu, 23 Feb 2012 15:28:39 -0800 Subject: [PATCH 3/3] fix rst syntax in README --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 8f6a6ad..4a3681c 100644 --- a/README +++ b/README @@ -180,7 +180,7 @@ pyflakes: - W402: imported but unused - W403: import from line shadowed by loop variable -- W404: 'from import *' used; unable to detect undefined names +- W404: 'from import ``*``' used; unable to detect undefined names - W405: future import(s) after other statements - W801: redefinition of unused from line - W802: undefined name