Skip to content

Commit e2d1813

Browse files
committed
Add linter mode detection and one-hundred files limit
1 parent b10119d commit e2d1813

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

linter.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,14 @@ def run(self, cmd, code):
2121
return self._live_lint(cmd, code)
2222
else:
2323
return self._in_place_lint(cmd)
24+
25+
def _live_lint(self, cmd, code):
26+
dir = os.path.dirname(self.filename)
27+
files = [file for file in os.listdir(dir) if file.endswith(".go")]
28+
if len(files) > 100:
29+
print("golangcilint: too many files ({}), live linting skipped".format(len(files)))
30+
return ""
31+
return self.tmpdir(cmd, dir, files, self.filename, code)
32+
33+
def _in_place_lint(self, cmd):
34+
return self.execute(cmd)

0 commit comments

Comments
 (0)