Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
started README
Browse files Browse the repository at this point in the history
golangcidev committed May 15, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 076ef9c commit 588d7cf
Showing 96 changed files with 7,915 additions and 19 deletions.
1 change: 1 addition & 0 deletions .golangci.example.yml
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@ linters:
presets:
- bugs
- unused
fast: false

issues:
exclude:
28 changes: 26 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

264 changes: 263 additions & 1 deletion README.md

Large diffs are not rendered by default.

Binary file added docs/go.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/run_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion pkg/commands/linters.go
Original file line number Diff line number Diff line change
@@ -21,7 +21,8 @@ func (e *Executor) initLinters() {

func printLinterConfigs(lcs []pkg.LinterConfig) {
for _, lc := range lcs {
fmt.Printf("%s: %s\n", color.YellowString(lc.Linter.Name()), lc.Linter.Desc())
fmt.Printf("%s: %s [fast: %t]\n", color.YellowString(lc.Linter.Name()),
lc.Linter.Desc(), !lc.DoesFullImport)
}
}

3 changes: 2 additions & 1 deletion pkg/commands/run.go
Original file line number Diff line number Diff line change
@@ -89,6 +89,7 @@ func (e *Executor) initRun() {
runCmd.Flags().BoolVar(&lc.DisableAll, "disable-all", false, "Disable all linters")
runCmd.Flags().StringSliceVarP(&lc.Presets, "presets", "p", []string{},
fmt.Sprintf("Enable presets (%s) of linters. Run 'golangci-lint linters' to see them. This option implies option --disable-all", strings.Join(pkg.AllPresets(), "|")))
runCmd.Flags().BoolVar(&lc.Fast, "fast", false, "Run only fast linters from enabled linters set")

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

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")
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")
runCmd.Flags().StringVar(&ic.DiffFromRevision, "new-from-rev", "", "Show only new issues created after git revision `REV`")
runCmd.Flags().StringVar(&ic.DiffPatchFilePath, "new-from-patch", "", "Show only new issues created in git patch with file path `PATH`")

1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
@@ -95,6 +95,7 @@ type Linters struct {
Disable []string
EnableAll bool `mapstructure:"enable-all"`
DisableAll bool `mapstructure:"disable-all"`
Fast bool

Presets []string
}
10 changes: 9 additions & 1 deletion pkg/enabled_linters.go
Original file line number Diff line number Diff line change
@@ -223,7 +223,7 @@ func validateAllDisableEnableOptions(cfg *config.Linters) error {
}

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

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

if lcfg.Fast {
for name := range resultLintersSet {
if GetLinterConfig(name).DoesFullImport {
delete(resultLintersSet, name)
}
}
}

return resultLintersSet
}

Loading

0 comments on commit 588d7cf

Please sign in to comment.