Skip to content

Commit

Permalink
Merge pull request #51 from SublimeLinter/real-files
Browse files Browse the repository at this point in the history
only run on the actual files always
  • Loading branch information
braver authored May 24, 2018
2 parents 7892443 + 901d291 commit 0c8b36a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
12 changes: 2 additions & 10 deletions linter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
import re
from SublimeLinter.lint import PythonLinter, persist
from SublimeLinter.lint import PythonLinter


logger = logging.getLogger('SublimeLinter.plugins.pylint')
Expand All @@ -14,6 +14,7 @@ class Pylint(PythonLinter):
)
multiline = True
line_col_base = (1, 0)
tempfile_suffix = '-'
defaults = {
# paths to be added to sys.path through --init-hook
'paths': [],
Expand All @@ -22,15 +23,6 @@ class Pylint(PythonLinter):
'--init-hook=;': None
}

@property
def tempfile_suffix(self):
"""Use the real file if possible."""
mode = persist.settings.get('lint_mode', 'background')
if mode in ('load/save', 'save only') or not self.view.is_dirty():
return '-'
else:
return 'py'

def on_stderr(self, stderr):
stderr = re.sub(
'No config file found, using default configuration\n', '', stderr)
Expand Down
3 changes: 2 additions & 1 deletion messages.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"install": "messages/install.txt",
"1.4.0": "messages/1.4.0.txt"
"1.4.0": "messages/1.4.0.txt",
"1.5.0": "messages/1.5.0.txt"
}
8 changes: 8 additions & 0 deletions messages/1.5.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SublimeLinter-pylint 1.5.0
--------------------------

Pylint now only runs on the actual files, i.e. on load and on save.

This ensures it runs in a context where imports are available etc. Previously,
it would try to switch behaviour on the fly, which would result in different
errors depending on how pylint was run.

0 comments on commit 0c8b36a

Please sign in to comment.