-
Notifications
You must be signed in to change notification settings - Fork 47
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
lint: Introduce Makefile target, introduce pre-commit config and fix issues #495
Conversation
Skipping CI for Draft Pull Request. |
Do you think you can include this linter into our tests? |
Yup indeed that's why this is just a draft for now, I'll try to work something out next week. |
/retest-required |
754fe60
to
82fbfda
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice initiative!
a88f209
to
00aa9af
Compare
00aa9af
to
4172a99
Compare
/hold |
/test ci/prow/images |
@lyarwood: No presubmit jobs available for kubevirt/ssp-operator@master In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Slightly confused by the version of must-gather we are using in CI, I can't seem to find a copy of the SSP CR that is present when I use the kubevirt/must-gather image locally. I'll hack around some more today. |
/retest-required |
Yeah I'll rebase on that shortly once I've worked out the failures |
@@ -60,7 +64,9 @@ func Setup(service Service) { | |||
f2 := klogFlags.Lookup(f1.Name) | |||
if f2 != nil { | |||
value := f1.Value.String() | |||
f2.Value.Set(value) | |||
if err := f2.Value.Set(value); err != nil { | |||
panic(fmt.Sprintf("%v", err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonderful, this is causing a panic in the tests. Looking in more detail now.
panic: syntax error: expect file.go:234
│ goroutine 1 [running]: │
│ kubevirt.io/ssp-operator/internal/template-validator/service.Setup.func1(0xc000284a00) │
│ /workspace/internal/template-validator/service/service.go:68 +0xd9 │
│ github.com/spf13/pflag.(*FlagSet).VisitAll(0xc00014e000?, 0xc00009ff10) │
│ /workspace/vendor/github.com/spf13/pflag/flag.go:290 +0xec │
│ kubevirt.io/ssp-operator/internal/template-validator/service.Setup({0x18c4760?, 0xc000458000?}) │
│ /workspace/internal/template-validator/service/service.go:63 +0x185 │
│ main.Main() │
│ /workspace/internal/template-validator/main.go:13 +0x39 │
│ main.main() │
│ /workspace/internal/template-validator/main.go:20 +0x19
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed by 1650fa6
Signed-off-by: Lee Yarwood <[email protected]>
Signed-off-by: Lee Yarwood <[email protected]>
Signed-off-by: Lee Yarwood <[email protected]>
/unhold |
/retest-required |
Looks good, just one ping about a previous comment. |
Signed-off-by: Lee Yarwood <[email protected]>
Signed-off-by: Lee Yarwood <[email protected]>
Signed-off-by: Lee Yarwood <[email protected]>
Signed-off-by: Lee Yarwood <[email protected]>
Signed-off-by: Lee Yarwood <[email protected]>
This change introduces pre-commit, a useful framework for ensuring changes meet certain requirements *before* they are fully committed. This requires the user install pre-commit itself but this is as easy as: https://pre-commit.com/#usage $ pip install --user pre-commit $ cd path/to/ssp-operator && pre-commit install Signed-off-by: Lee Yarwood <[email protected]>
This change removes some older glue code with a native pflag call to handle the setup of any goflag flags defined by indirect dependencies like glog. This should be removed when this dependency has gone. Signed-off-by: Lee Yarwood <[email protected]>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Thanks! |
/retest-required |
https://prow.ci.openshift.org/job-history/gs/origin-ci-test/pr-logs/directory/pull-ci-kubevirt-ssp-operator-master-e2e-single-node-functests looks like the job is broken? I'll take a look in the morning. |
/retest-required |
1 similar comment
/retest-required |
What this PR does / why we need it:
Adds a
lint
Makefile target usinggolangci-lint
initially with the following plugins enabled:Additionally provides a
pre-commit
config users can opt into using to help catch issues before committing changes locally.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Release note: