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

Switch to using Golang CI Lint #2503

Closed
phillebaba opened this issue May 14, 2024 · 1 comment
Closed

Switch to using Golang CI Lint #2503

phillebaba opened this issue May 14, 2024 · 1 comment
Assignees

Comments

@phillebaba
Copy link
Member

Describe what should be investigated or refactored

Currently Revive is being used to lint Zarf. While it does have a lot of rules it does not integrate well with other linter projects. Golang CI Lint on the other hand wraps a lot of other linter projects with one of them being Revive. Switching linting tool would allow us to keep the existing linter rules while also expanding with more checks.

We should at minimum aim to enable the default linters in Golang CI Lint ontop of Revive.

  • errcheck
  • gosimple
  • govet
  • ineffassign
  • staticcheck
  • unused

Additional context

Golang CI Lint is already being used by uds-cli so we are not the first to use it.

https://github.com/defenseunicorns/uds-cli/blob/main/.golangci.yml

@phillebaba phillebaba self-assigned this May 14, 2024
Noxsios added a commit that referenced this issue May 15, 2024
## Description

This replaces revive with golang-ci-lint, and instead runs revive
through the aforementioned tool. Additionally it replaces the header
check script with the goheader linter. The benefit of this change is
that we can enable more linters along with revive in the future.

## Related Issue

Part of #2503 

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed

---------

Co-authored-by: Austin Abro <37223396+AustinAbro321@users.noreply.github.com>
Co-authored-by: razzle <harry@razzle.cloud>
AustinAbro321 pushed a commit that referenced this issue May 16, 2024
## Description

Adds testifylint and fixes any issues related to it.

## Related Issue

Part of #2503 
Depends on #2499 

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed
AustinAbro321 pushed a commit that referenced this issue May 20, 2024
## Description

This change enables the ineffassign linter and fixes the only complaint
by refactoring the select state filter.

## Related Issue

Part of #2503 
Depends on #2499 

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed
phillebaba added a commit that referenced this issue May 20, 2024
This change enables the ineffassign linter and fixes the only complaint
by refactoring the select state filter.

Part of #2503
Depends on #2499

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed
phillebaba added a commit that referenced this issue May 20, 2024
This change enables the ineffassign linter and fixes the only complaint
by refactoring the select state filter.

Part of #2503
Depends on #2499

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed
AustinAbro321 pushed a commit that referenced this issue Jun 11, 2024
## Description

This change enables the errcheck linter which requires all returned
errors to be checked.

## Related Issue

Part of #2503
Depends on #2499 

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed
@phillebaba
Copy link
Member Author

All linters we wanted to add have been added.

AustinAbro321 added a commit that referenced this issue Jul 23, 2024
## Description

This replaces revive with golang-ci-lint, and instead runs revive
through the aforementioned tool. Additionally it replaces the header
check script with the goheader linter. The benefit of this change is
that we can enable more linters along with revive in the future.

## Related Issue

Part of #2503

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed

---------

Co-authored-by: Austin Abro <37223396+AustinAbro321@users.noreply.github.com>
Co-authored-by: razzle <harry@razzle.cloud>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
AustinAbro321 pushed a commit that referenced this issue Jul 23, 2024
## Description

Adds testifylint and fixes any issues related to it.

## Related Issue

Part of #2503
Depends on #2499

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed

Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
AustinAbro321 pushed a commit that referenced this issue Jul 23, 2024
## Description

This change enables the ineffassign linter and fixes the only complaint
by refactoring the select state filter.

## Related Issue

Part of #2503
Depends on #2499

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed

Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
AustinAbro321 pushed a commit that referenced this issue Jul 23, 2024
## Description

This change enables the errcheck linter which requires all returned
errors to be checked.

## Related Issue

Part of #2503
Depends on #2499

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed

Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant