Skip to content

Commit 629f46a

Browse files
committed
started README
1 parent 076ef9c commit 629f46a

File tree

97 files changed

+7919
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+7919
-21
lines changed

.golangci.example.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
run:
2-
verbose: true
32
concurrency: 4
43
deadline: 1m
54
issues-exit-code: 1
@@ -44,6 +43,7 @@ linters:
4443
presets:
4544
- bugs
4645
- unused
46+
fast: false
4747

4848
issues:
4949
exclude:

.golangci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
run:
2-
verbose: true
32
deadline: 30s
43
tests: true
54

Gopkg.lock

+26-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+263-1
Large diffs are not rendered by default.

docs/go.png

167 KB
Loading

docs/run_screenshot.png

220 KB
Loading

pkg/commands/linters.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ func (e *Executor) initLinters() {
2121

2222
func printLinterConfigs(lcs []pkg.LinterConfig) {
2323
for _, lc := range lcs {
24-
fmt.Printf("%s: %s\n", color.YellowString(lc.Linter.Name()), lc.Linter.Desc())
24+
fmt.Printf("%s: %s [fast: %t]\n", color.YellowString(lc.Linter.Name()),
25+
lc.Linter.Desc(), !lc.DoesFullImport)
2526
}
2627
}
2728

pkg/commands/run.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ func (e *Executor) initRun() {
8989
runCmd.Flags().BoolVar(&lc.DisableAll, "disable-all", false, "Disable all linters")
9090
runCmd.Flags().StringSliceVarP(&lc.Presets, "presets", "p", []string{},
9191
fmt.Sprintf("Enable presets (%s) of linters. Run 'golangci-lint linters' to see them. This option implies option --disable-all", strings.Join(pkg.AllPresets(), "|")))
92+
runCmd.Flags().BoolVar(&lc.Fast, "fast", false, "Run only fast linters from enabled linters set")
9293

9394
// Issues config
9495
ic := &e.cfg.Issues
@@ -99,7 +100,7 @@ func (e *Executor) initRun() {
99100
runCmd.Flags().IntVar(&ic.MaxIssuesPerLinter, "max-issues-per-linter", 50, "Maximum issues count per one linter. Set to 0 to disable")
100101
runCmd.Flags().IntVar(&ic.MaxSameIssues, "max-same-issues", 3, "Maximum count of issues with the same text. Set to 0 to disable")
101102

102-
runCmd.Flags().BoolVarP(&ic.Diff, "new", "n", false, "Show only new issues: if there are unstaged changes or untracked files, only those changes are shown, else only changes in HEAD~ are shown")
103+
runCmd.Flags().BoolVarP(&ic.Diff, "new", "n", false, "Show only new issues: if there are unstaged changes or untracked files, only those changes are analyzed, else only changes in HEAD~ are analyzed")
103104
runCmd.Flags().StringVar(&ic.DiffFromRevision, "new-from-rev", "", "Show only new issues created after git revision `REV`")
104105
runCmd.Flags().StringVar(&ic.DiffPatchFilePath, "new-from-patch", "", "Show only new issues created in git patch with file path `PATH`")
105106

@@ -348,6 +349,10 @@ func (e *Executor) validateConfig() error {
348349
return errors.New("option run.cpuprofilepath in config isn't allowed")
349350
}
350351

352+
if c.Run.IsVerbose {
353+
return errors.New("can't set run.verbose option with config: only on command-line")
354+
}
355+
351356
return nil
352357
}
353358

pkg/config/config.go

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ type Linters struct {
9595
Disable []string
9696
EnableAll bool `mapstructure:"enable-all"`
9797
DisableAll bool `mapstructure:"disable-all"`
98+
Fast bool
9899

99100
Presets []string
100101
}

pkg/enabled_linters.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func validateAllDisableEnableOptions(cfg *config.Linters) error {
223223
}
224224

225225
if cfg.DisableAll {
226-
if len(cfg.Enable) == 0 {
226+
if len(cfg.Enable) == 0 && len(cfg.Presets) == 0 {
227227
return fmt.Errorf("all linters were disabled, but no one linter was enabled: must enable at least one")
228228
}
229229

@@ -313,6 +313,14 @@ func getEnabledLintersSet(cfg *config.Config) map[string]Linter {
313313
delete(resultLintersSet, name)
314314
}
315315

316+
if lcfg.Fast {
317+
for name := range resultLintersSet {
318+
if GetLinterConfig(name).DoesFullImport {
319+
delete(resultLintersSet, name)
320+
}
321+
}
322+
}
323+
316324
return resultLintersSet
317325
}
318326

0 commit comments

Comments
 (0)