-
Notifications
You must be signed in to change notification settings - Fork 251
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
enable linting and bingo management of the lint tool #1524
enable linting and bingo management of the lint tool #1524
Conversation
e3d597f
to
2a7814d
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1524 +/- ##
==========================================
+ Coverage 46.76% 46.80% +0.04%
==========================================
Files 135 135
Lines 15776 15873 +97
==========================================
+ Hits 7377 7430 +53
- Misses 7358 7402 +44
Partials 1041 1041 ☔ View full report in Codecov by Sentry. |
2a7814d
to
b044ec9
Compare
e831f94
to
3b764ff
Compare
ef05a4a
to
c9deb72
Compare
# Default timeout is 1m, up to give more room | ||
timeout: 4m | ||
|
||
linters: |
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.
you don't have to, but if it's easy enough, we could add govet here as well (then maybe drop it from the Makefile if it's there)
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.
the .golangci.yaml file in this project is a copy of that in op-con. Since that one has just updated, I can take that change, but IMO we can update the Makefile in a separate PR. This one is already way beyond any reasonable complexity.
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.
Hi @grokspawn
You are with an outdated version :-P
See that we added govet there and we cleanup the staff: operator-framework/operator-controller@099a6cf
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.
But I am ok with we move forward as it is and add govet in a follow up.
It is fine for me too. @perdasilva wdyt?
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.
I did add govet in ac872deec7a3f69452cdf7d1cdcc38b7dec70911
@@ -500,13 +500,13 @@ func removeJSONWhitespace(cfg *DeclarativeConfig) { | |||
for ib := range cfg.Bundles { | |||
for ip := range cfg.Bundles[ib].Properties { | |||
var buf bytes.Buffer | |||
json.Compact(&buf, cfg.Bundles[ib].Properties[ip].Value) | |||
_ = json.Compact(&buf, cfg.Bundles[ib].Properties[ip].Value) |
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.
maybe also require.NoError
?
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.
No test object available in this scope, or I would've. 🤷
cfg.Bundles[ib].Properties[ip].Value = buf.Bytes() | ||
} | ||
} | ||
for io := range cfg.Others { | ||
var buf bytes.Buffer | ||
json.Compact(&buf, cfg.Others[io].Blob) | ||
_ = json.Compact(&buf, cfg.Others[io].Blob) |
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.
ditto
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.
Same problem as pre-ditto.
test/e2e/bundle_image_test.go
Outdated
@@ -276,7 +276,7 @@ func pushLoadImages(client *kubernetes.Clientset, w io.Writer, images ...string) | |||
} | |||
} else { | |||
for _, image := range images { | |||
pushWith("docker", image) | |||
err = pushWith("docker", image) |
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.
nit:
if err := pushWith("docker", image); err != nil {
return 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.
err is declared in line 262. Is there some benefit to re-defining it in this scope? (I'd missed this)
e223708
to
edc24a7
Compare
Signed-off-by: Jordan Keister <[email protected]>
Signed-off-by: Jordan Keister <[email protected]>
Signed-off-by: Jordan <[email protected]>
edc24a7
to
8480d85
Compare
8480d85
to
2e6a90b
Compare
- errcheck - stylecheck - nestif - prealloc - errorlint - nonamedreturns - gosec - gosimple - govet - importas - staticcheck - unused Signed-off-by: Jordan Keister <[email protected]>
Signed-off-by: Jordan Keister <[email protected]>
2e6a90b
to
92f5b29
Compare
Signed-off-by: Jordan Keister <[email protected]>
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.
That's great and I completely agree with your decision to back out of actually fixing those lint issues in favor of silencing most of them just to establish a baseline given the already significant scope of work - I'm sure people can be good scouts and gradually make fixes as they touch upon different areas of the code they work on.
I didn't notice anything critical silenced, so if it passes CI, it's good to me.
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.
/lgtm
🚀
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: azych, camilamacedo86, grokspawn The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
5531412
into
operator-framework:master
Closes #1525
Discovered that the lint make target doesn't lint anything. It only checks whether go imports are in expected grouping/ordering.
This PR introduces gci support (replacing goimports) as a targeted linter, and implements golang-linter support via a bingo-managed version.
There are discrete commits to topically collect:
The parent issue has a link to a google sheet which includes a list of every single update made here, categorized and broken down by reporting linter.
The ONLY FOCUS of this PR is to establish a "bright line" beyond which no new reports will slip through the cracks, but due to the age (and the "feature completeness") of much of the reported code, there are a LOT of issues which are specifically and locally disabled to remove them from lint reports without making updates.
I'd initially felt sanguine about updating style changes which modified (read: broke) APIs, but I backed away from this after seeing how prevalent those changes would need to be.
The only included case of a stylistic breaking API change was the JSONUnmarshaller, since this is a recent addition that was added for internal use, so it seemed a safe bet to not break anyone's access.
I was initially much more willing to make updates to test code to bring them up to date, but
Description of the change:
Motivation for the change:
Reviewer Checklist
/docs