Commits

sylv...@logilab.fr  committed 3505a4f

use .fromlineno, not .lineno

  • Participants
  • Parent commits 38ee68b
  • Branches astng2

Comments (0)

Files changed (6)

File checkers/base.py

                 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,
         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"""

File checkers/classes.py

                     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))
         

File checkers/imports.py

         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:
                 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):

File checkers/typecheck.py

             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)
             
 
         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
                     msgid = 'E1103'
                 else:
                     msgid = 'E1101'
-                    #print "msg!", node, msgid, node.lineno
                 self.add_message(msgid, node=node,
                                  args=(display_type(owner), name,
                                        node.attrname))

File checkers/utils.py

     # 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
         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