diff --git a/README.md b/README.md index aa479c60..f803c3e1 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ results in the following output: dead_code.py:1: V104 unused import 'os' (90% confidence) dead_code.py:4: V103 unused function 'greet' (60% confidence) - dead_code.py:8: V106 unused variable 'message' (60% confidence) + dead_code.py:8: V107 unused variable 'message' (60% confidence) Vulture correctly reports "os" and "message" as unused, but it fails to detect that "greet" is actually used. The recommended method to deal @@ -181,7 +181,7 @@ Passing both the original program and the whitelist to Vulture makes Vulture ignore the `greet` method: dead_code.py:1: V104 unused import 'os' (90% confidence) - dead_code.py:8: V106 unused variable 'message' (60% confidence) + dead_code.py:8: V107 unused variable 'message' (60% confidence) diff --git a/tests/test_noqa.py b/tests/test_noqa.py index b511850b..7b364ad8 100644 --- a/tests/test_noqa.py +++ b/tests/test_noqa.py @@ -80,9 +80,9 @@ def test_noqa_specific_issue_codes(v): @underground # noqa: V102 class Cellar: - @property # noqa: V105 + @property # noqa: V106 def wine(self): - grapes = True # noqa: V106 + grapes = True # noqa: V107 @without_ice # noqa: V103 def serve(self, quantity=50): @@ -95,6 +95,7 @@ def serve(self, quantity=50): check(v.unused_classes, []) check(v.unused_funcs, []) check(v.unused_imports, []) + check(v.unused_methods, ["serve"]) check(v.unused_props, []) check(v.unreachable_code, []) check(v.unused_vars, []) @@ -104,7 +105,7 @@ def test_noqa_attributes(v): v.scan( """\ something.x = 'x' # noqa: V101 -something.z = 'z' # noqa: V106 (code for unused variable) +something.z = 'z' # noqa: V107 (code for unused variable) something.u = 'u' # noqa """ ) @@ -191,7 +192,7 @@ def test_noqa_multiple_decorators(v): """\ @bar # noqa: V102 class Foo: - @property # noqa: V105 + @property # noqa: V106 @make_it_cool @log def something(self): @@ -199,7 +200,7 @@ def something(self): @coolify @property - def something_else(self): # noqa: V105 + def something_else(self): # noqa: V106 pass @a @@ -235,10 +236,10 @@ def shave_sheep(sheep): def test_noqa_variables(v): v.scan( """\ -mitsi = "Mother" # noqa: V106 +mitsi = "Mother" # noqa: V107 harry = "Father" # noqa shero = "doggy" # noqa: V101, V104 (code for unused import, attr) -shinchan.friend = ['masao'] # noqa: V106 (code for unused variable) +shinchan.friend = ['masao'] # noqa: V107 (code for unused variable) """ ) check(v.unused_vars, ["shero"]) @@ -254,7 +255,7 @@ def world(axis): # noqa: V103, V201 for _ in range(3): continue - xyz = hello(something, else): # noqa: V201, V106 + xyz = hello(something, else): # noqa: V201, V107 """ ) check(v.get_unused_code(), []) diff --git a/vulture/core.py b/vulture/core.py index 18fb07c5..11f84a7b 100644 --- a/vulture/core.py +++ b/vulture/core.py @@ -47,15 +47,14 @@ if sys.version_info < (3, 4): IGNORED_VARIABLE_NAMES |= {"True", "False"} -# TODO: reorganize codes. ERROR_CODES = { "attribute": "V101", "class": "V102", "function": "V103", "import": "V104", - "method": "V107", - "property": "V105", - "variable": "V106", + "method": "V105", + "property": "V106", + "variable": "V107", "unreachable_code": "V201", } diff --git a/vulture/noqa.py b/vulture/noqa.py index f8d9cc12..70eded9c 100644 --- a/vulture/noqa.py +++ b/vulture/noqa.py @@ -42,7 +42,7 @@ # flake8 F401: module imported but unused. "F401": "V104", # flake8 F841: local variable is assigned to but never used. - "F841": "V106", + "F841": "V107", }