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

new lint config verify command #4416

Open
mateusoliveira43 opened this issue Dec 9, 2024 · 4 comments · May be fixed by #4425
Open

new lint config verify command #4416

mateusoliveira43 opened this issue Dec 9, 2024 · 4 comments · May be fixed by #4425
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.

Comments

@mateusoliveira43
Copy link
Contributor

What do you want to happen?

Suggestion to add to scaffold Makefile a call to golangci-lint config verify command

.PHONY: lint-config
lint-config: golangci-lint  ## Verify golangci-lint linter configuration
	$(GOLANGCI_LINT) config verify

.PHONY: lint
lint: lint-config ## Run golangci-lint linter
	$(GOLANGCI_LINT) run

.PHONY: lint-fix
lint-fix: lint-config ## Run golangci-lint linter and perform fixes
	$(GOLANGCI_LINT) run --fix

Extra Labels

No response

@mateusoliveira43 mateusoliveira43 added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 9, 2024
@camilamacedo86
Copy link
Member

Yes, go forward with it
We also need add it to our Makefile (used by the Kubebuilder project itself)
And ensure that our configuration as the lint configuration for end users are accuarted

$ make lint-config
/Users/camilam/go/src/sigs.k8s.io/kubebuilder/bin/golangci-lint config verify
jsonschema: "linters-settings.govet" does not validate with "/properties/linters-settings/properties/govet/additionalProperties": additionalProperties 'enable=fieldalignment' not allowed
jsonschema: "linters-settings.revive.rules.3.arguments" does not validate with "/properties/linters-settings/properties/revive/properties/rules/items/properties/arguments/type": expected array, but got object
Failed executing command with error: the configuration contains invalid elements
make: *** [lint-config] Error 3

We should call it in the GitHub tests:

  • .github/workflows/lint.yml
  • .github/workflows/lint-sample.yml

@camilamacedo86 camilamacedo86 added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. labels Dec 13, 2024
@mateusoliveira43
Copy link
Contributor Author

Agree about adding to CI

Since it uses https://github.com/golangci/golangci-lint-action, could you open an issue there to ask for this feature there?

In the mean time, we do it from Makefile

@mateusoliveira43
Copy link
Contributor Author

/assign

@camilamacedo86
Copy link
Member

We can use the GitHub actions that already exist to lint the code as you did in the PR
So, all fine !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
2 participants