Skip to content

Commit

Permalink
Fix #318: better validate linters and help commands
Browse files Browse the repository at this point in the history
  • Loading branch information
jirfag committed Dec 22, 2018
1 parent a4a7100 commit 21c2590
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/commands/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ func printLinterConfigs(lcs []linter.Config) {
}

func (e Executor) executeLintersHelp(cmd *cobra.Command, args []string) {
if len(args) != 0 {
e.log.Fatalf("Usage: golangci-lint help linters")
}

var enabledLCs, disabledLCs []linter.Config
for _, lc := range e.DBManager.GetAllSupportedLinterConfigs() {
if lc.EnabledByDefault {
Expand Down
4 changes: 4 additions & 0 deletions pkg/commands/linters.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ func IsLinterInConfigsList(name string, linters []linter.Config) bool {
}

func (e *Executor) executeLinters(cmd *cobra.Command, args []string) {
if len(args) != 0 {
e.log.Fatalf("Usage: golangci-lint linters")
}

enabledLCs, err := e.EnabledLintersSet.Get()
if err != nil {
log.Fatalf("Can't get enabled linters: %s", err)
Expand Down

0 comments on commit 21c2590

Please sign in to comment.