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
🌱 Enabled more golangci linters #1536
🌱 Enabled more golangci linters #1536
Conversation
/hold |
70a0905
to
61b921d
Compare
7cc48c2
to
69d5397
Compare
/test metal3-bmo-e2e-test-pull |
/test-centos-e2e-integration-main |
/test metal3-bmo-e2e-test-pull |
return "" | ||
} | ||
return host.Labels[name] | ||
} |
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.
these two fuctions are unused
type PreprovisioningImageStatus struct { | ||
// imageUrl is the URL from which the built image can be downloaded. | ||
ImageUrl string `json:"imageUrl,omitempty"` | ||
ImageUrl string `json:"imageUrl,omitempty"` //nolint:revive,stylecheck |
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.
ideally this field name should have been ImageURL
as asked by the linters, I was not sure if I should do it here since this will cause an API change. I am up for suggestions.
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 would suggest at least a separate PR for this if the consensus is to change .
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.
For the time being the exclusion is justified IMO.
|
||
// kernelUrl is the URL from which the kernel of the image can be downloaded. | ||
// Only makes sense for initrd images. | ||
// +optional | ||
KernelUrl string `json:"kernelUrl,omitempty"` | ||
KernelUrl string `json:"kernelUrl,omitempty"` //nolint:revive,stylecheck |
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.
ideally this type name should have been KernelURL
as asked by the linters, I was not sure if I should do it here since this will cause an API change. I am up for suggestions.
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 as above
@@ -85,7 +85,7 @@ func (r actionComplete) Dirty() bool { | |||
// deleteComplete is a result indicating that the deletion action has | |||
// completed, and that the resource has now been deleted. | |||
type deleteComplete struct { | |||
actionComplete | |||
actionComplete //nolint:unused |
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 am a bit unsure about this piece of code and how is it used elsewhere. Hence I suppressed the linter.
func (r *BMCEventSubscriptionReconciler) secretManager(log logr.Logger) secretutils.SecretManager { | ||
return secretutils.NewSecretManager(log, r.Client, r.APIReader) | ||
} | ||
|
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.
unused code
|
||
// result.RequeueAfter = deprovisionRequeueDelay | ||
p.log.Info("deprovisioning host") | ||
return result, nil |
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 was not sure how to get rid of this default switch-case only
issue, hence I am putting a log message. Open for discussion/suggestions.
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 don't really get why was this a switch case to begin with...
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.
Is there any significance of accessing the p.objectMeta.Name
field, could that have some effect? (I think no but maybe there is some GO magic that I am no considering)
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.
me neither and I am not sure if theres any go magic.
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.
This is for the "demo" provisioner, so it was probably meant as a way for developers to play with it. You could add specific cases for what you wanted to happen to the hosts. This is also why there is commented out code below. Just a simple way to make it do different things.
That said, I think we can safely remove it, otherwise it will just rot
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.
Yeah, I think it was just copy-and-paste.
(The purpose of the demo provisioner was to test a web UI, by allowing you to create a host that would sit in a certain state. The state it ended up in was determined by the host name.)
|
||
// return result, nil | ||
p.log.Info("powering on host") | ||
return result, nil |
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 was not sure how to get rid of this default case only issue, hence I am putting a log message, open for discussion.
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 as above
|
||
// return result, nil | ||
p.log.Info("powering off host") | ||
return result, nil |
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 was not sure how to get rid of this default case only issue, hence I am putting a log message, open for discussion.
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 as above
69d5397
to
99b7720
Compare
/test metal3-bmo-e2e-test-pull |
/hold cancel |
/test metal3-bmo-e2e-test-pull |
1 similar comment
/test metal3-bmo-e2e-test-pull |
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.
just few questions and comments in general great work!
type PreprovisioningImageStatus struct { | ||
// imageUrl is the URL from which the built image can be downloaded. | ||
ImageUrl string `json:"imageUrl,omitempty"` | ||
ImageUrl string `json:"imageUrl,omitempty"` //nolint:revive,stylecheck |
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 would suggest at least a separate PR for this if the consensus is to change .
type PreprovisioningImageStatus struct { | ||
// imageUrl is the URL from which the built image can be downloaded. | ||
ImageUrl string `json:"imageUrl,omitempty"` | ||
ImageUrl string `json:"imageUrl,omitempty"` //nolint:revive,stylecheck |
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.
For the time being the exclusion is justified IMO.
|
||
// kernelUrl is the URL from which the kernel of the image can be downloaded. | ||
// Only makes sense for initrd images. | ||
// +optional | ||
KernelUrl string `json:"kernelUrl,omitempty"` | ||
KernelUrl string `json:"kernelUrl,omitempty"` //nolint:revive,stylecheck |
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 as above
|
||
// return result, nil | ||
p.log.Info("powering on host") | ||
return result, nil |
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 as above
|
||
// return result, nil | ||
p.log.Info("powering off host") | ||
return result, nil |
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 as above
|
||
// result.RequeueAfter = deprovisionRequeueDelay | ||
p.log.Info("deprovisioning host") | ||
return result, nil |
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.
Is there any significance of accessing the p.objectMeta.Name
field, could that have some effect? (I think no but maybe there is some GO magic that I am no considering)
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.
Thanks so much for doing this!
|
||
// result.RequeueAfter = deprovisionRequeueDelay | ||
p.log.Info("deprovisioning host") | ||
return result, nil |
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.
Yeah, I think it was just copy-and-paste.
(The purpose of the demo provisioner was to test a web UI, by allowing you to create a host that would sit in a certain state. The state it ended up in was determined by the host name.)
8a83e07
to
187b69f
Compare
187b69f
to
00f4320
Compare
/test metal3-bmo-e2e-test-pull |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: zaneb 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 |
7b306ef
to
48cae68
Compare
/test metal3-bmo-e2e-test-pull |
1 similar comment
/test metal3-bmo-e2e-test-pull |
Signed-off-by: Kashif Khan <kashif.khan@est.tech>
48cae68
to
314fc48
Compare
/test metal3-bmo-e2e-test-pull |
/test metal3-bmo-e2e-test-pull |
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
/cherry-pick release-0.5 |
@kashifest: #1536 failed to apply on top of branch "release-0.5":
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. |
/cherry-pick release-0.5 |
@kashifest: #1536 failed to apply on top of branch "release-0.5":
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. |
@@ -89,9 +88,8 @@ func (a *iLOAccessDetails) BIOSInterface() string { | |||
func (a *iLOAccessDetails) BootInterface() string { | |||
if a.useVirtualMedia { | |||
return "ilo-virtual-media" |
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.
Why not constants here?
@@ -8,7 +8,7 @@ import ( | |||
|
|||
func init() { | |||
schemes := []string{"http", "https"} | |||
RegisterFactory("redfish", newRedfishAccessDetails, schemes) | |||
RegisterFactory(redfish, newRedfishAccessDetails, schemes) | |||
RegisterFactory("ilo5-redfish", newRedfishAccessDetails, schemes) | |||
RegisterFactory("idrac-redfish", newRedfishiDracAccessDetails, schemes) |
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 question, it's weird to have one thing as a constant and the two other as plain strings.
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'm going to guess it is because the linter complains only after you have N occurrences of the same string.
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 only fixed those where the linter was unhappy. And linter usually complain when there is around 3 or more mention of the same string.
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.
Yep, understood. Still, I'd prefer us to use constants consistently, regardless of what the linter forces us to.
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.
True, I will send a patch
These linters still were the low hanging fruits. The rest 5 linters which are currently disabled, are expected to create much more noise and code change and I plan to work on them on a followup.