Skip to content

Commit a9afe07

Browse files
committed
Update pylama
1 parent 322da79 commit a9afe07

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

pylibs/pylama/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
"""
77

8-
version_info = 1, 5, 2
8+
version_info = 1, 5, 3
99

1010
__version__ = version = '.'.join(map(str, version_info))
1111
__project__ = __name__

pylibs/pylama/core.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def run(path, ignore=None, select=None, linters=DEFAULT_LINTERS, config=None,
3434
"""
3535
errors = []
3636
params = dict(ignore=ignore, select=select)
37-
37+
code = None
3838
try:
3939
with open(path, 'rU') as f:
4040
code = f.read() + '\n\n'
@@ -66,21 +66,22 @@ def run(path, ignore=None, select=None, linters=DEFAULT_LINTERS, config=None,
6666

6767
except IOError as e:
6868
errors.append(dict(
69-
lnum=0, type='E', col=0, text=str(e)
70-
))
69+
lnum=0, type='E', col=0, text=str(e), filename=path or ''))
7170

7271
except SyntaxError as e:
7372
errors.append(dict(
7473
lnum=e.lineno or 0, type='E', col=e.offset or 0,
75-
text=e.args[0] + ' [%s]' % lint
74+
text=e.args[0] + ' [%s]' % lint, filename=path or ''
7675
))
7776

7877
except Exception:
7978
import traceback
8079
logging.debug(traceback.format_exc())
8180

8281
errors = [er for er in errors if filter_errors(er, **params)]
83-
errors = filter_skiplines(code, errors)
82+
83+
if code:
84+
errors = filter_skiplines(code, errors)
8485

8586
return sorted(errors, key=lambda x: x['lnum'])
8687

0 commit comments

Comments
 (0)