Skip to content

Commit 0c8b36a

Browse files
authored
Merge pull request #51 from SublimeLinter/real-files
only run on the actual files always
2 parents 7892443 + 901d291 commit 0c8b36a

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

linter.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22
import re
3-
from SublimeLinter.lint import PythonLinter, persist
3+
from SublimeLinter.lint import PythonLinter
44

55

66
logger = logging.getLogger('SublimeLinter.plugins.pylint')
@@ -14,6 +14,7 @@ class Pylint(PythonLinter):
1414
)
1515
multiline = True
1616
line_col_base = (1, 0)
17+
tempfile_suffix = '-'
1718
defaults = {
1819
# paths to be added to sys.path through --init-hook
1920
'paths': [],
@@ -22,15 +23,6 @@ class Pylint(PythonLinter):
2223
'--init-hook=;': None
2324
}
2425

25-
@property
26-
def tempfile_suffix(self):
27-
"""Use the real file if possible."""
28-
mode = persist.settings.get('lint_mode', 'background')
29-
if mode in ('load/save', 'save only') or not self.view.is_dirty():
30-
return '-'
31-
else:
32-
return 'py'
33-
3426
def on_stderr(self, stderr):
3527
stderr = re.sub(
3628
'No config file found, using default configuration\n', '', stderr)

messages.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"install": "messages/install.txt",
3-
"1.4.0": "messages/1.4.0.txt"
3+
"1.4.0": "messages/1.4.0.txt",
4+
"1.5.0": "messages/1.5.0.txt"
45
}

messages/1.5.0.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
SublimeLinter-pylint 1.5.0
2+
--------------------------
3+
4+
Pylint now only runs on the actual files, i.e. on load and on save.
5+
6+
This ensures it runs in a context where imports are available etc. Previously,
7+
it would try to switch behaviour on the fly, which would result in different
8+
errors depending on how pylint was run.

0 commit comments

Comments
 (0)