1010
1111
1212class Golangcilint (NodeLinter ):
13+ # Here are the statistics of how fast the plugin reports the warnings and
14+ # errors via golangci-lint when all the helpers are disabled and only the
15+ # specified linter is enabled. In total, when all of them are enabled, it
16+ # takes an average of 1.6111 secs in a project with seventy-four (74) Go
17+ # files, 6043 lines (4620 code + 509 comments + 914 blanks).
18+ #
19+ # | Seconds | Linter |
20+ # |---------|-------------|
21+ # | 0.7040s | goconst |
22+ # | 0.7085s | nakedret |
23+ # | 0.7172s | gocyclo |
24+ # | 0.7337s | prealloc |
25+ # | 0.7431s | scopelint |
26+ # | 0.7479s | ineffassign |
27+ # | 0.7553s | golint |
28+ # | 0.7729s | misspell |
29+ # | 0.7733s | gofmt |
30+ # | 0.7854s | dupl |
31+ # | 1.2574s | varcheck |
32+ # | 1.2653s | errcheck |
33+ # | 1.3052s | gocritic |
34+ # | 1.3078s | typecheck |
35+ # | 1.3131s | structcheck |
36+ # | 1.3140s | maligned |
37+ # | 1.3159s | unconvert |
38+ # | 1.3598s | depguard |
39+ # | 1.3678s | deadcode |
40+ # | 1.3942s | govet |
41+ # | 1.4565s | gosec |
1342 cmd = "golangci-lint run --fast --out-format json"
1443 defaults = {"selector" : "source.go" }
1544 line_col_base = (1 , 1 )
@@ -27,6 +56,17 @@ def run(self, cmd, code):
2756 # links of all the files in the current folder, then will write the
2857 # buffer into a file, and finally will execute the linter inside this
2958 # directory.
59+ #
60+ # Note: The idea to execute the Foreground linter “on_load” even if
61+ # “lint_mode” is set to “background” cannot be taken in consideration
62+ # because of the following scenario:
63+ #
64+ # - User makes changes to a file
65+ # - The editor suddently closes
66+ # - Buffer is saved for recovery
67+ # - User opens the editor again
68+ # - Editor loads the unsaved file
69+ # - Linter runs in an unsaved file
3070 if settings .get ("lint_mode" ) == "background" :
3171 return self ._background_lint (cmd , code )
3272 else :
0 commit comments