Skip to content

Commit 3db24bd

Browse files
committed
Add simplified short filename assignment for future usage
1 parent f24eef4 commit 3db24bd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

linter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ class Golangcilint(Linter):
1010
regex = r"(?:[^:]+):(?P<line>\d+):(?P<col>\d+):(?:(?P<warning>warning)|(?P<error>error)):(?P<message>.*)"
1111
defaults = {"selector": "source.go"}
1212
error_stream = util.STREAM_STDOUT
13+
shortname = "unknown.go"
1314
multiline = False
1415

1516
def run(self, cmd, code):
1617
dir = os.path.dirname(self.filename)
1718
if not dir:
1819
print("golangcilint: skipped linting of unsaved file")
1920
return
21+
self.shortname = os.path.basename(self.filename)
2022
if settings.get("lint_mode") == "background":
2123
return self._live_lint(cmd, code)
2224
else:
@@ -120,7 +122,6 @@ def execute(self, cmd):
120122
lines = []
121123
output = self.communicate(cmd)
122124
report = json.loads(output)
123-
currnt = os.path.basename(self.filename)
124125

125126
"""merge possible stderr with issues"""
126127
if "Error" in report["Report"]:
@@ -147,7 +148,7 @@ def execute(self, cmd):
147148
"""decide if it is a warning or error"""
148149
issue["Level"] = self.issue_level(issue)
149150
"""skip issues from unrelated files"""
150-
if issue["Pos"]["Shortname"] != currnt:
151+
if issue["Pos"]["Shortname"] != self.shortname:
151152
continue
152153
lines.append(
153154
"{}:{}:{}:{}:{}".format(

0 commit comments

Comments
 (0)