opendatahub-io / opendatahub-operator

Open Data Hub operator to manage ODH component integrations
https://opendatahub.io
Apache License 2.0
59 stars 127 forks source link

fix(lint): explicitly configures ireturn exceptions #1085

Closed bartoszmajsak closed 2 months ago

bartoszmajsak commented 2 months ago

Description

Instead of using //nolint:ireturn the linter allows the use of generic return types through the global config (on top of the listed defaults which now have been explicitly set).

This approach also eliminates a recurring issue where nolintlint reports the directive above as not used by the defined linter.

Related issue: https://github.com/golangci/golangci-lint/issues/3228

On top of that, we have --fix flag enabled for golangci-lint runner. This results in the removal of these comments as nolintlint tries to auto fix.

As a consequence the subsequent run of make lint yields errors for previously disabled linters and the cycle continues :)

[!IMPORTANT] This behaviour has also been observed for other linters.

As part of this work, the declarations of kustomize plugin constructor funcs has been reworked to return struct pointers instead. The reason for this is that in our feature branch, we rely on kustomize plugins and want to iterate over a slice of resmap.Transfomers but these functions cannot be used in the current form because structs returned have pointer receivers. From the current functionality standpoint (on the incubation branch) this change is harmless.

How Has This Been Tested?

make

Screenshot or short clip

Merge criteria

openshift-ci[bot] commented 2 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ykaliuta, zdtsw

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/opendatahub-io/opendatahub-operator/blob/incubation/OWNERS)~~ [ykaliuta,zdtsw] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment