summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2013-02-25 12:00:10 +0100
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2013-02-25 12:00:10 +0100
commita419a04c28f87027c04139105c9c737024e502f3 (patch)
tree1a1199fe835a9b336857dcf686ffaf3699f718f4
parenta25ffbe3c6e7be7aec889f89a796dc52976afd0b (diff)
downloadpylint-a419a04c28f87027c04139105c9c737024e502f3.tar.gz
use .fromlineno instead of .lineno (which is not reliable)
-rw-r--r--checkers/imports.py2
-rw-r--r--checkers/utils.py4
-rw-r--r--checkers/variables.py4
3 files changed, 5 insertions, 5 deletions
diff --git a/checkers/imports.py b/checkers/imports.py
index 455df94..9944a58 100644
--- a/checkers/imports.py
+++ b/checkers/imports.py
@@ -36,7 +36,7 @@ def get_first_import(node, context, name, base, level):
for first in context.body:
if first is node:
continue
- if first.scope() is node.scope() and first.lineno > node.lineno:
+ if first.scope() is node.scope() and first.fromlineno > node.fromlineno:
continue
if isinstance(first, astng.Import):
if any(fullname == iname[0] for iname in first.names):
diff --git a/checkers/utils.py b/checkers/utils.py
index 2115b51..aa4563e 100644
--- a/checkers/utils.py
+++ b/checkers/utils.py
@@ -1,6 +1,6 @@
# pylint: disable=W0611
#
-# Copyright (c) 2003-2010 LOGILAB S.A. (Paris, FRANCE).
+# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This program is free software; you can redistribute it and/or modify it under
@@ -65,7 +65,7 @@ def clobber_in_except(node):
if (stmts and
not isinstance(stmts[0].ass_type(),
(astng.Assign, astng.AugAssign, astng.ExceptHandler))):
- return (True, (name, 'outer scope (line %s)' % (stmts[0].lineno,)))
+ return (True, (name, 'outer scope (line %s)' % (stmts[0].fromlineno,)))
return (False, None)
diff --git a/checkers/variables.py b/checkers/variables.py
index cf5d9f7..ff9a1d9 100644
--- a/checkers/variables.py
+++ b/checkers/variables.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2003-2012 LOGILAB S.A. (Paris, FRANCE).
+# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This program is free software; you can redistribute it and/or modify it under
@@ -272,7 +272,7 @@ builtins. Remember that you should avoid to define new builtins when possible.'
if is_inside_except(stmt):
continue
if name in globs and not isinstance(stmt, astng.Global):
- line = globs[name][0].lineno
+ line = globs[name][0].fromlineno
self.add_message('W0621', args=(name, line), node=stmt)
elif is_builtin(name):
# do not print Redefining builtin for additional builtins