Skip to content

Commit 05597a8

Browse files
authored
Merge pull request #4 from meengit/review-fixes
Review fixes
2 parents 29e9483 + 281e165 commit 05597a8

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

linter.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@
1111
#
1212

1313
"""This module exports the Codeclimate plugin class."""
14+
import logging
1415
import os
1516
from SublimeLinter.lint import Linter, PermanentError, util
1617

1718

19+
logger = logging.getLogger('SublimeLinter.plugin.codeclimate')
20+
21+
1822
class Codeclimate(Linter):
1923
"""Provides an interface to codeclimate."""
2024
defaults = {
21-
'excludes': ['!${folder::}*'],
2225
'selector': (
2326
'source.css, '
2427
'source.go, '
@@ -35,8 +38,8 @@ class Codeclimate(Linter):
3538
)
3639
}
3740

38-
regex = r'^== ((?P<filename>.*)(?= \(\d+ issue\) ==))( \(\d+ issue\) ==\n(?P<line>\d+))(?:-\d+)?:\s(?P<message>.+)$'
39-
multiline = True
41+
regex = r'^(?P<line>\d+)(?:-\d+)?:\s(?P<message>.+)$'
42+
multiline = False
4043
line_col_base = (1, 1)
4144
tempfile_suffix = '-'
4245
error_stream = util.STREAM_BOTH
@@ -47,13 +50,14 @@ def cmd(self):
4750
abs_path = self.filename
4851
working_dir = self.get_working_dir()
4952

50-
msg = 'The file \'%s\' is not part of the working dir (%s). ' \
51-
'Please see the Linter\'s README.md to get further ' \
52-
'instructions.' % (abs_path, working_dir)
53+
msg = 'The file \'%s\' is not part of any open folder in ' \
54+
'SublimeText. Please see the Linter\'s README.md to ' \
55+
'get further instructions.' % (abs_path)
5356

5457
if not (abs_path.startswith(os.path.abspath(working_dir) + os.sep)):
58+
logger.warning(msg)
5559
self.notify_unassign()
56-
raise PermanentError(msg)
60+
raise PermanentError('File not part of an open folder in SublimeText.')
5761

5862
file = os.path.relpath(abs_path, working_dir)
5963
return ['codeclimate', 'analyze', '${args}', file, '${xoo}']

0 commit comments

Comments
 (0)