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

Add golint to the linting process #58

Closed
ian-howell opened this issue Feb 19, 2020 · 9 comments
Closed

Add golint to the linting process #58

ian-howell opened this issue Feb 19, 2020 · 9 comments
Assignees
Labels
enhancement New feature or request priority/medium Default priority for items ready for review Change related to the issue is ready for review
Milestone

Comments

@ian-howell
Copy link
Contributor

ian-howell commented Feb 19, 2020

Depends-On: #40

Problem description (if applicable)
Issue #40 aims to improve the code documentation of packages, structs, and functions. This issue suggests a solution for maintaining high quality documentation as airshipctl continues through development.

Proposed change
We should include golint in our suite of linters. The golint linter aims to match the accepted style of the open source Go project, specifically those style suggestions from Effective Go and the CodeReviewComments wiki page.

Potential impacts
The golint tool will include style suggestions that exceed the goals of this issue. These suggestions can not be adjusted - we must adhere to all of its suggestions. This will probably result in an overall healthier codebase, but may have undesirable side-effects.

@ian-howell ian-howell added enhancement New feature or request triage Needs evaluation by project members labels Feb 19, 2020
@ian-howell ian-howell self-assigned this Feb 20, 2020
@ian-howell ian-howell added the wip Work in progress label Feb 20, 2020
@ian-howell
Copy link
Contributor Author

Initial Patchset. This adds the golint linter, but doesn't enforce its suggestions. Enforcement will come later after we've fulfilled the outstanding issues.

@ian-howell ian-howell removed the triage Needs evaluation by project members label Feb 20, 2020
@jezogwza jezogwza added this to the betav1 milestone Feb 26, 2020
@jezogwza jezogwza added the priority/medium Default priority for items label Feb 26, 2020
@airshipbot airshipbot added ready for review Change related to the issue is ready for review and removed wip Work in progress labels Feb 26, 2020
@alexander-hughes alexander-hughes self-assigned this Feb 28, 2020
@airshipbot
Copy link

New Related Change

Link: https://review.opendev.org/710459
Subject: [#58] Update var names to be golint compliant
Authored By: Alexander Hughes (Alexander.Hughes@pm.me)

@airshipbot
Copy link

New Related Change

Link: https://review.opendev.org/710454
Subject: [#58] Update error strings to be golint compliant
Authored By: Alexander Hughes (Alexander.Hughes@pm.me)

@airshipbot
Copy link

New Related Change

Link: https://review.opendev.org/710465
Subject: [#58] Make structs golint compliant
Authored By: Alexander Hughes (Alexander.Hughes@pm.me)

@airshipbot
Copy link

New Related Change

Link: https://review.opendev.org/710462
Subject: [#58] Update func names and params for golint
Authored By: Alexander Hughes (Alexander.Hughes@pm.me)

@airshipbot
Copy link

New Related Change

Link: https://review.opendev.org/710472
Subject: [#58] Make constants golint compliant
Authored By: Alexander Hughes (Alexander.Hughes@pm.me)

@airshipbot
Copy link

New Related Change

Link: https://review.opendev.org/710471
Subject: [#58] Update receivers for golint
Authored By: Alexander Hughes (Alexander.Hughes@pm.me)

@airshipbot
Copy link

New Related Change

Link: https://review.opendev.org/710469
Subject: [#58] Update types for golint
Authored By: Alexander Hughes (Alexander.Hughes@pm.me)

@airshipbot
Copy link

New Related Change

Link: https://review.opendev.org/710468
Subject: [#58] Update methods for golint
Authored By: Alexander Hughes (Alexander.Hughes@pm.me)

airshipbot pushed a commit that referenced this issue Mar 2, 2020
Error strings by convention should not end in punctuation, or contain
uppercase letters.

Relates-To: #58

Change-Id: I027fb21a20f08fdd24cf654f3ae1cbceb3e5a6c6
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
airshipbot pushed a commit that referenced this issue Mar 2, 2020
This patch resolves complaints from golint such as:

cmd/config/set_authinfo_test.go:84:3: don't use leading k in Go names;
pkg/remote/redfish/redfish.go:39:2: var systemId should be systemID
pkg/remote/redfish/redfish.go:47:2: var managerId should be managerID
pkg/remote/redfish/redfish.go:51:2: var vMediaId should be vMediaID
pkg/remote/redfish/redfish.go:115:2: var parsedUrl should be parsedURL
pkg/remote/redfish/utils.go:29:2: var trimmedUrl should be trimmedURL
pkg/remote/redfish/utils.go:39:3: var rId should be rID

Relates-To: #58

Change-Id: I758565c84b44aac118d5f1cbf714224ab1ff82c5
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
airshipbot pushed a commit that referenced this issue Mar 2, 2020
This patch addresses golint errors such as:
pkg/config/config.go:994:21: don't use leading k in Go names; func
parameter kCluster should be cluster
pkg/config/config.go:1003:21: don't use leading k in Go names; func
parameter kContext should be context
pkg/config/config.go:1012:22: don't use leading k in Go names; func
parameter kAuthInfo should be authInfo
pkg/remote/redfish/utils.go:49:6: func GetVirtualMediaId should be
GetVirtualMediaID
pkg/remote/redfish/utils.go:51:2: func parameter managerId should be
managerID
pkg/remote/redfish/utils.go:64:2: func parameter systemId should be
systemID
pkg/remote/redfish/utils.go:87:67: func parameter systemId should be
systemID
pkg/remote/redfish/utils.go:108:2: func parameter managerId should be
managerID
pkg/remote/redfish/utils.go:109:2: func parameter vMediaId should be
vMediaID

Relates-To: #58

Change-Id: I231becdb19fa962e888df46ef1a6b66e64d32e72
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
airshipbot pushed a commit that referenced this issue Mar 2, 2020
This patch addresses golint failures such as:
pkg/bootstrap/isogen/command_test.go:24:2: struct field getId should be
getID
pkg/config/types.go:83:2: don't use leading k in Go names; struct field
kCluster should be cluster
pkg/config/types.go:108:2: don't use leading k in Go names; struct field
kContext should be context
pkg/config/types.go:113:2: don't use leading k in Go names; struct field
kAuthInfo should be authInfo
pkg/container/container_docker.go:79:2: struct field imageUrl should be
imageURL
pkg/container/container_docker_test.go:427:3: struct field imageUrl
should be imageURL
pkg/remote/redfish/redfish.go:23:2: struct field EphemeralNodeId should
be EphemeralNodeID
pkg/remote/redfish/redfish.go:29:2: struct field Api should be API

Relates-To: #58

Change-Id: Ie8d1c49c9d392f10be0f38224c98b588a9e2a544
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
airshipbot pushed a commit that referenced this issue Mar 2, 2020
This patch addresses golint failures such as:
pkg/bootstrap/isogen/command_test.go:43:26: method GetId should be GetID
pkg/container/container_docker.go:171:27: method getImageId should be
getImageID
pkg/container/container_docker.go:193:27: method GetId should be GetID

Relates-To: #58

Change-Id: I7eb461387524f23a89bc2ae7ce59dac066c12281
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
airshipbot pushed a commit that referenced this issue Mar 2, 2020
This patch addresses golint failures such as:
pkg/config/constants.go:21:2: const AirshipConfigApiVersion should be
AirshipConfigAPIVersion

Relates-To: #58

Change-Id: I164c907957c8b760c64737c48995f5f3c0d297ec
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
airshipbot pushed a commit that referenced this issue Mar 2, 2020
This patch addresses golint failures such as:
pkg/config/repo.go:35:1: receiver name r should be consistent with
previous receiver name c for RepoCheckout
pkg/config/repo.go:76:1: receiver name r should be consistent with
previous receiver name auth for RepoAuth
pkg/config/repo.go:127:1: receiver name r should be consistent with
previous receiver name repo for Repository
pkg/config/repo.go:135:1: receiver name spec should be consistent with
previous receiver name repo for Repository

Relates-To: #58

Change-Id: I5f7eec779ee6438cb290a9f82febef74a7ea8123
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
airshipbot pushed a commit that referenced this issue Mar 3, 2020
This patch addresses guidance from effective go [0] and golint
failures such as:

pkg/document/document.go:8:6: type name will be used as
document.DocumentFactory by other packages, and that stutters; consider
calling this Factory
pkg/remote/errors.go:9:6: type name will be used as
remote.RemoteDirectError by other packages, and that stutters; consider
calling this DirectError
pkg/remote/remote_direct.go:27:6: type name will be used as
remote.RemoteDirectClient by other packages, and that stutters; consider
calling this DirectClient
pkg/remote/redfish/errors.go:10:6: type name will be used as
redfish.RedfishClientError by other packages, and that stutters;
consider calling this ClientError
pkg/remote/redfish/redfish.go:14:6: type name will be used as
redfish.RedfishRemoteDirect by other packages, and that stutters;
consider calling this RemoteDirect

[0] https://golang.org/doc/effective_go.html#package-names

Relates-To: #58

Change-Id: I6d94da7755c8719bbcc4a77917e283074281309a
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
airshipbot pushed a commit that referenced this issue Mar 6, 2020
This adds the golint linter to the `make lint` target. As of this
commit, the results from golint are not counted as errors. Further
changes to the code will be required to bring it up to golint's
standards, at which point we will allow golint to cause failures for the
`lint` target.

Change-Id: I34134e3deb080e6da0bc0aac299caca6c3b5d0a9
airshipbot pushed a commit that referenced this issue Mar 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority/medium Default priority for items ready for review Change related to the issue is ready for review
Projects
None yet
Development

No branches or pull requests

4 participants