summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsylvain thenault <sylvain.thenault@logilab.fr>2009-03-19 11:48:40 +0100
committersylvain thenault <sylvain.thenault@logilab.fr>2009-03-19 11:48:40 +0100
commit8df413be17bde57d16b0d4c6a3fd4617546cfdd4 (patch)
treed243a8eb51a391755f32caa2dafd64dcaf33b6e3
parenta112392fc109cdc17f90ea6c9632f9be04adc929 (diff)
downloadpylint-astng2.tar.gz
use .fromlineno, not .linenoastng2
-rwxr-xr-xcheckers/base.py4
-rw-r--r--checkers/classes.py2
-rw-r--r--checkers/imports.py4
-rw-r--r--checkers/typecheck.py3
-rw-r--r--checkers/utils.py4
-rw-r--r--utils.py4
6 files changed, 8 insertions, 13 deletions
diff --git a/checkers/base.py b/checkers/base.py
index 44b2d6c..53fd169 100755
--- a/checkers/base.py
+++ b/checkers/base.py
@@ -395,7 +395,7 @@ functions, methods
return
if node.args.args[i].name != call.args[i].name:
return
- self.add_message('W0108', line=node.lineno, node=node)
+ self.add_message('W0108', line=node.fromlineno, node=node)
def visit_function(self, node):
"""check function name, docstring, arguments, redefinition,
@@ -538,7 +538,7 @@ functions, methods
defined_self = node.parent.frame()[node.name]
if defined_self is not node and not are_exclusive(node, defined_self):
self.add_message('E0102', node=node,
- args=(redef_type, defined_self.lineno))
+ args=(redef_type, defined_self.fromlineno))
def _check_docstring(self, node_type, node):
"""check the node has a non empty docstring"""
diff --git a/checkers/classes.py b/checkers/classes.py
index cc09891..5b8bb64 100644
--- a/checkers/classes.py
+++ b/checkers/classes.py
@@ -340,7 +340,7 @@ instance attributes.'}
frame = def_node.frame()
lno = def_node.fromlineno
for _node in nodes:
- if _node.frame() is frame and _node.lineno < lno:
+ if _node.frame() is frame and _node.fromlineno < lno:
self.add_message('E0203', node=_node,
args=(attr, lno))
diff --git a/checkers/imports.py b/checkers/imports.py
index 293172c..f7f8122 100644
--- a/checkers/imports.py
+++ b/checkers/imports.py
@@ -326,7 +326,7 @@ given file (report R0402 must not be disabled)'}
first = get_first_import(frame, name, basename, level)
if isinstance(first, (astng.Import, astng.From)) and first is not node \
and not are_exclusive(first, node):
- self.add_message('W0404', node=node, args=(name, first.lineno))
+ self.add_message('W0404', node=node, args=(name, first.fromlineno))
else:
root = node.root()
if root is frame:
@@ -336,7 +336,7 @@ given file (report R0402 must not be disabled)'}
return
if first is not node and not are_exclusive(first, node):
self.add_message('W0404', node=node,
- args=(name, first.lineno))
+ args=(name, first.fromlineno))
def report_external_dependencies(self, sect, _, dummy):
diff --git a/checkers/typecheck.py b/checkers/typecheck.py
index a654f93..8cb6633 100644
--- a/checkers/typecheck.py
+++ b/checkers/typecheck.py
@@ -94,7 +94,6 @@ accessed.'}
self.generated_members.extend(('REQUEST', 'acl_users', 'aq_parent'))
def visit_assattr(self, node):
- #print "visit", repr(node), node.attrname, node.lineno
if isinstance(node.ass_type(), astng.AugAssign):
self.visit_getattr(node)
@@ -109,7 +108,6 @@ accessed.'}
function/method, super call and metaclasses are ignored
"""
- #print "visit", repr(node), node.attrname, node.lineno
if node.attrname in self.config.generated_members:
# attribute is marked as generated, stop here
return
@@ -172,7 +170,6 @@ accessed.'}
msgid = 'E1103'
else:
msgid = 'E1101'
- #print "msg!", node, msgid, node.lineno
self.add_message(msgid, node=node,
args=(display_type(owner), name,
node.attrname))
diff --git a/checkers/utils.py b/checkers/utils.py
index 27e508f..41b09e3 100644
--- a/checkers/utils.py
+++ b/checkers/utils.py
@@ -111,8 +111,8 @@ def is_defined_before(var_node, comp_node_types=COMP_NODE_TYPES):
# possibly multiple statements on the same line using semi colon separator
stmt = var_node.statement()
_node = stmt.previous_sibling()
- lineno = stmt.lineno
- while _node and _node.lineno == lineno:
+ lineno = stmt.fromlineno
+ while _node and _node.fromlineno == lineno:
for ass_node in _node.nodes_of_class(astng.AssName):
if ass_node.name == varname:
return True
diff --git a/utils.py b/utils.py
index dc44a59..3257e84 100644
--- a/utils.py
+++ b/utils.py
@@ -241,9 +241,7 @@ class MessagesHandlerMixIn:
provide the line argument.
"""
if line is None and node is not None:
- line = node.fromlineno#lineno or node.statement().lineno
- #if not isinstance(node, Module):
- # assert line > 0, node.__class__
+ line = node.fromlineno
# should this message be displayed
if not self.is_message_enabled(msg_id, line):
return