Skip to content

Commit 21c2590

Browse files
committed
Fix #318: better validate linters and help commands
1 parent a4a7100 commit 21c2590

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pkg/commands/help.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ func printLinterConfigs(lcs []linter.Config) {
4444
}
4545

4646
func (e Executor) executeLintersHelp(cmd *cobra.Command, args []string) {
47+
if len(args) != 0 {
48+
e.log.Fatalf("Usage: golangci-lint help linters")
49+
}
50+
4751
var enabledLCs, disabledLCs []linter.Config
4852
for _, lc := range e.DBManager.GetAllSupportedLinterConfigs() {
4953
if lc.EnabledByDefault {

pkg/commands/linters.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ func IsLinterInConfigsList(name string, linters []linter.Config) bool {
3131
}
3232

3333
func (e *Executor) executeLinters(cmd *cobra.Command, args []string) {
34+
if len(args) != 0 {
35+
e.log.Fatalf("Usage: golangci-lint linters")
36+
}
37+
3438
enabledLCs, err := e.EnabledLintersSet.Get()
3539
if err != nil {
3640
log.Fatalf("Can't get enabled linters: %s", err)

0 commit comments

Comments
 (0)