From ba52a771a8fc423f6e2fa6f85145da22778c761f Mon Sep 17 00:00:00 2001 From: Michal Minar Date: Mon, 4 Feb 2013 13:42:25 +0100 Subject: fixed pylint plugins Marking of line positions for error suppression needed finetuning in other to make them more robust. They did not work for multiline statements like decorated functions/methods etc. --- src/python/openlmi/__init__.pyc | Bin 246 -> 0 bytes tools/pylint/plugins/cim_provider_checker.py | 13 +++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 src/python/openlmi/__init__.pyc diff --git a/src/python/openlmi/__init__.pyc b/src/python/openlmi/__init__.pyc deleted file mode 100644 index d7131d7..0000000 Binary files a/src/python/openlmi/__init__.pyc and /dev/null differ diff --git a/tools/pylint/plugins/cim_provider_checker.py b/tools/pylint/plugins/cim_provider_checker.py index 8ce775b..b1b1ae9 100644 --- a/tools/pylint/plugins/cim_provider_checker.py +++ b/tools/pylint/plugins/cim_provider_checker.py @@ -46,9 +46,9 @@ def recursively_clean_cls_values(linter, node): Supress them for any nested class recursively. """ # class has too few public methods - linter.disable('R0903', scope='module', line=node.lineno) + linter.disable('R0903', scope='module', line=node.fromlineno) # class has not docstring - linter.disable('C0111', scope='module', line=node.lineno) + linter.disable('C0111', scope='module', line=node.fromlineno) for child in node.get_children(): if isinstance(child, scoped_nodes.Class): recursively_clean_cls_values(linter, child) @@ -60,10 +60,10 @@ def supress_cim_provider_messages(linter, node): """ assert isinstance(node, scoped_nodes.Class) # class has too many public methods - linter.disable('R0904', scope='module', line=node.lineno) + linter.disable('R0904', scope='module', line=node.fromlineno) if '__init__' in node: # __init__ not called for base class - linter.disable('W0231', scope='module', line=node['__init__'].lineno) + linter.disable('W0231', scope='module', line=node['__init__'].fromlineno) if ( 'Values' in node and isinstance(node['Values'], scoped_nodes.Class)): recursively_clean_cls_values(linter, node['Values']) @@ -79,9 +79,10 @@ def supress_cim_provider_messages(linter, node): or ( child.name not in generated_methods and not child.name.startswith('cim_method_'))): continue - linter.disable('R0201', scope='module', line=node.lineno) + # provider method could be a function + linter.disable('R0201', scope='module', line=child.fromlineno) for arg in child.args.get_children(): - linter.disable('W0613', scope='module', line=arg.lineno) + linter.disable('W0613', scope='module', line=arg.fromlineno) class CIMProviderChecker(BaseChecker): """ -- cgit