summaryrefslogtreecommitdiff
path: root/lint.py
diff options
context:
space:
mode:
authorTorsten Marek <tmarek@google.com>2013-06-17 19:16:42 +0200
committerTorsten Marek <tmarek@google.com>2013-06-17 19:16:42 +0200
commit1d83a1c9f6747568d26349bbd8d74b942dbef766 (patch)
tree65e8e1825bf56aa0a4cb58ed847b436896163d0a /lint.py
parent34e999fc8d56fdeadda39bb8f7122e203af7d869 (diff)
downloadpylint-1d83a1c9f6747568d26349bbd8d74b942dbef766.tar.gz
The tokenize module rejects certain source files that are accepted as
valid by the Python interpreter, e.g. modules that end with a line continuation. Catch the exception and skip the files.
Diffstat (limited to 'lint.py')
-rw-r--r--lint.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/lint.py b/lint.py
index 6fe9076..0c52890 100644
--- a/lint.py
+++ b/lint.py
@@ -649,7 +649,11 @@ This is used by the global evaluation report (RP0004).'}),
def check_astroid_module(self, astroid, walker, rawcheckers, tokencheckers):
"""check a module from its astroid representation, real work"""
# call raw checkers if possible
- tokens = tokenize_module(astroid)
+ try:
+ tokens = tokenize_module(astroid)
+ except tokenize.TokenError, ex:
+ self.add_message('E0001', line=ex.args[1][0], args=ex.args[0])
+ return
if not astroid.pure_python:
self.add_message('I0001', args=astroid.name)