-
Notifications
You must be signed in to change notification settings - Fork 36
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 more lint errors from goreportcard #34
Conversation
Fix a few comments to satisfy golint checker Pull getAffinityGroupIDs function to reduce cyclomatic complexity of GetOrCreateVMInstance
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rejoshed, wongni 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 |
@@ -32,6 +32,7 @@ import ( | |||
// log is for logging in this package. | |||
var cloudstackmachinelog = logf.Log.WithName("cloudstackmachine-resource") | |||
|
|||
// SetupWebhookWithManager creates a new webhook managed by passed manager |
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.
Can you please add periods to the end of these comments? I'd like us to stick to the prevailing conventions.
pkg/cloud/affinity_groups.go
Outdated
type AffinityGroup struct { | ||
Type string | ||
Name string | ||
ID string | ||
} | ||
|
||
// AffinityGroupIface contains the collection of functions for AffinityGroup |
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.
Here too, and probably elsewhere.
pkg/cloud/affinity_groups_test.go
Outdated
@@ -14,13 +14,13 @@ See the License for the specific language governing permissions and | |||
limitations under the License. | |||
*/ | |||
|
|||
package cloud_test | |||
package cloud |
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! We separate this on purpose.
cloud_test being a separate module helps us to detect code smell in un-testable regions.
It also helps us to pair down what libs actually make it into our final module.
Why was this change made?
pkg/cloud/affinity_groups_test.go
Outdated
@@ -32,22 +32,22 @@ var _ = Describe("AffinityGroup Unit Tests", func() { | |||
mockCtrl *gomock.Controller | |||
mockClient *cloudstack.CloudStackClient | |||
ags *cloudstack.MockAffinityGroupServiceIface | |||
fakeAG *cloud.AffinityGroup | |||
fakeAG *AffinityGroup |
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, not great.
@@ -47,7 +48,7 @@ var _ = Describe("AffinityGroup Unit Tests", func() { | |||
client = cloud.NewClientFromCSAPIClient(mockClient) | |||
fakeAG = &cloud.AffinityGroup{ | |||
Name: "FakeAffinityGroup", | |||
Type: cloud.AffinityGroupType} | |||
Type: "host affinity"} |
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.
Please revert.
@@ -21,17 +21,14 @@ import ( | |||
"github.com/pkg/errors" | |||
) | |||
|
|||
const ( |
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.
Please revert this too. Mark intentionally made these consts.
I don't particularly care whether there are string literals in the tests or not, but these changes will only aggravate the rebase I will have to do to brink in my dummies module.
@@ -89,7 +90,7 @@ var _ = Describe("AffinityGroup Unit Tests", func() { | |||
if connectionErr != nil { // Only do these tests if an actual ACS instance is available via cloud-config. | |||
Skip("Could not connect to ACS instance.") | |||
} | |||
arbitraryAG = &cloud.AffinityGroup{Name: "ArbitraryAffinityGroup", Type: cloud.AffinityGroupType} | |||
arbitraryAG = &cloud.AffinityGroup{Name: "ArbitraryAffinityGroup", Type: "host affinity"} |
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.
Please revert.
@wongni: The following tests failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
I'm good with this all at my level, pending resolution of Josh's more detailed points, passing of tests and a mergability. |
Created #52 from the latest main branch. |
Issue #, if available:
Description of changes:
Fix misspellings
Fix a few comments to satisfy golint checker
Pull getAffinityGroupIDs function to reduce cyclomatic complexity of GetOrCreateVMInstance
Somehow I was not able to buile goreportcard-cli so I used the following method to run the checks locally. (gojp/goreportcard#379)
Current report from this PR
Testing performed:
Full E2E test results
Ran 13 of 14 Specs in 5094.519 seconds
SUCCESS! -- 13 Passed | 0 Failed | 0 Pending | 1 Skipped
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.