medik8s / node-maintenance-operator

Kubernetes Operator to manage node maintenance through NodeMaintenance custom resources
https://www.medik8s.io/maintenance-node/
Apache License 2.0
25 stars 13 forks source link

[WIP] Add Super Linter target and CI #83

Closed razo7 closed 4 weeks ago

razo7 commented 1 year ago

What has changed?

What and why to lint the code?

Linting is the automated checking of your source code for programmatic and stylistic errors. This is done by using a lint tool (otherwise known as linter). A lint tool is a basic static code analyzer.

The term linting originally comes from a Unix utility for C, and it is important to reduce errors and improve the overall quality of your code. Using lint tools can help you accelerate development and reduce costs by finding errors earlier.

More about Super Linter

The super-linter finds issues and reports them to the console output. Fixes are suggested in the console output but not automatically fixed, and a status check will show up as failed on the pull request. It includes many linters such as:

To locally test specific files (and ignore the reset) please use the FILTER_REGEX_INCLUDE environment variable in the super-linter target on Makefile, e.g. for only linting files with names include Makefile or README.md append -e FILTER_REGEX_INCLUDE="Makefile|README.md" \.

In addition, we can exclude directories or files based on regex, e.g. -e FILTER_REGEX_EXCLUDE="/vendor/"

https://issues.redhat.com/browse/ECOPROJECT-1207

openshift-ci[bot] commented 1 year ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: razo7

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: - ~~[OWNERS](https://github.com/medik8s/node-maintenance-operator/blob/main/OWNERS)~~ [razo7] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
razo7 commented 1 year ago

ATM I am expecting Pre Submit / Test and build PRs to fail until we fix the suggestion and errors from super-linter. Corrections will be implemented in a follow up PR

razo7 commented 1 year ago

/retest

slintes commented 1 year ago

in general looks good now 🙂

I would also prefer to fix actual lint issues in this PR, otherwise any other PR gets a red CI until a follow up PR is merged... WDYT?

slintes commented 1 year ago
  • there are many false positives from golangci-lint like undeclared name: AddOrRemoveTaint (typecheck). Looks like it only checks the current file for declarations? I hope that can be fixed somehow?

Did some tests with golangci-lint directly, seems to be an issue with a too old version of it. Tested with $ golangci-lint run --disable-all --enable typecheck

razo7 commented 1 year ago

can you decrease verbosity with LOG_LEVEL="NOTICE" please?

Sure

there are many false positives from golangci-lint like undeclared name: AddOrRemoveTaint (typecheck). Looks like it only checks the current file for declarations? I hope that can be fixed somehow?

Yes, I have seen it as well, and will check it.

for me IGNORE_GITIGNORED_FILES doesn't seem to work, I see that it tries to check /bin and /.idea directories?

For me as well, but I have manged to exclude the bin directory using this environment variable FILTER_REGEX_EXCLUDE="/vendor/|/bin/"

I would also prefer to fix actual lint issues in this PR, otherwise any other PR gets a red CI until a follow up PR is merged... WDYT?

I agree, and I will add a commit with a fix per linter (and each commit message will include the errors and warnings it fixes or ignored).

openshift-merge-robot commented 6 months ago

PR needs rebase.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
openshift-ci[bot] commented 1 month ago

@razo7: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/4.11-ci-index b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.11-ci-index
ci/prow/4.11-images b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.11-images
ci/prow/4.11-openshift-e2e b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.11-openshift-e2e
ci/prow/4.12-images b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.12-images
ci/prow/4.12-ci-index b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.12-ci-index
ci/prow/4.13-ci-index b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.13-ci-index
ci/prow/4.13-images b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.13-images
ci/prow/4.13-openshift-e2e b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.13-openshift-e2e
ci/prow/4.14-ci-index b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.14-ci-index
ci/prow/4.14-images b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.14-images
ci/prow/4.12-openshift-e2e b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.12-openshift-e2e
ci/prow/4.14-openshift-e2e b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.14-openshift-e2e
ci/prow/4.15-ci-index b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.15-ci-index
ci/prow/4.15-images b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.15-images
ci/prow/4.15-openshift-e2e b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.15-openshift-e2e
ci/prow/4.12-ci-bundle-my-bundle b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.12-ci-bundle-my-bundle
ci/prow/4.13-ci-bundle-my-bundle b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.13-ci-bundle-my-bundle
ci/prow/4.15-ci-bundle-my-bundle b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.15-ci-bundle-my-bundle
ci/prow/4.14-ci-bundle-my-bundle b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.14-ci-bundle-my-bundle
ci/prow/4.16-images b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.16-images
ci/prow/4.12-unit-test b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.12-unit-test
ci/prow/4.16-ci-bundle-my-bundle b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.16-ci-bundle-my-bundle
ci/prow/4.16-unit-test b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.16-unit-test
ci/prow/4.16-openshift-e2e b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.16-openshift-e2e
ci/prow/4.13-unit-test b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.13-unit-test
ci/prow/4.15-unit-test b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.15-unit-test
ci/prow/4.14-unit-test b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.14-unit-test
ci/prow/4.17-ci-bundle-my-bundle b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.17-ci-bundle-my-bundle
ci/prow/4.17-images b9a961ad5f4e9973f7339f20d8615ee53912291f link true /test 4.17-images

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
slintes commented 4 weeks ago

will close to save test resources, feel free to reopen when going on with this

/close

openshift-ci[bot] commented 4 weeks ago

@slintes: Closed this PR.

In response to [this](https://github.com/medik8s/node-maintenance-operator/pull/83#issuecomment-2199432970): >will close to save test resources, feel free to reopen when going on with this > >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.