Skip to content

Commit 0413b19

Browse files
committed
Add automatic warning error detection depending on issue level
1 parent 9722427 commit 0413b19

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

linter.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ def tmpdir(self, cmd, dir, files, filename, code):
6161
print("golangcilint permission error on `{}`".format(dir))
6262
return ""
6363

64+
def issue_level(self, issue):
65+
return "error" if issue["FromLinter"] == "typecheck" else "warning"
66+
6467
def execute(self, cmd):
6568
lines = []
6669
output = self.communicate(cmd)
@@ -73,6 +76,8 @@ def execute(self, cmd):
7376
mark = name.rfind("/")
7477
mark = 0 if mark == -1 else mark+1
7578
issue["Pos"]["Shortname"] = name[mark:]
79+
"""decide if it is a warning or error"""
80+
issue["Level"] = self.issue_level(issue)
7681
"""skip issues from unrelated files"""
7782
if issue["Pos"]["Shortname"] != currnt:
7883
continue

0 commit comments

Comments
 (0)