Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow lint-govulncheck to be disabled #330

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion internal/project/golang/govulncheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import (
)

// GoVulnCheck provides GoVulnCheck linter.
type GoVulnCheck struct {
type GoVulnCheck struct { //nolint:govet
dag.BaseNode

Disabled bool `yaml:"disabled"`

meta *meta.Options
projectPath string
}
Expand All @@ -34,6 +36,12 @@ func NewGoVulnCheck(meta *meta.Options, projectPath string) *GoVulnCheck {

// CompileMakefile implements makefile.Compiler.
func (lint *GoVulnCheck) CompileMakefile(output *makefile.Output) error {
if lint.Disabled {
output.Target(lint.Name()).Description("Disabled govulncheck linter.")

return nil
}

output.Target(lint.Name()).Description("Runs govulncheck linter.").
Script("@$(MAKE) target-$@")

Expand All @@ -42,6 +50,10 @@ func (lint *GoVulnCheck) CompileMakefile(output *makefile.Output) error {

// CompileDockerfile implements dockerfile.Compiler.
func (lint *GoVulnCheck) CompileDockerfile(output *dockerfile.Output) error {
if lint.Disabled {
return nil
}

output.Stage(lint.Name()).
Description("runs govulncheck").
From("base").
Expand Down