-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use github-action for golangci-lint workflow (#538)
Signed-off-by: odubajDT <[email protected]>
- Loading branch information
Showing
22 changed files
with
125 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Lint checks | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
- '[0-9]+.[1-9][0-9]*.x' | ||
pull_request: | ||
branches: | ||
- 'main' | ||
- '[0-9]+.[1-9][0-9]*.x' | ||
paths: | ||
- "**.go" | ||
- "**/go.mod" | ||
- "**/go.sum" | ||
- ".golangi.yml" | ||
- ".github/workflows/golangci-lint.yml" | ||
- "!docs/**" | ||
env: | ||
# renovate: datasource=github-releases depName=golangci/golangci-lint | ||
GOLANGCI_LINT_VERSION: "v1.55.2" | ||
GO_VERSION: "~1.20" | ||
jobs: | ||
golangci-lint: | ||
name: golangci-lint | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
check-latest: true | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
working-directory: ./ | ||
version: ${{ env.GOLANGCI_LINT_VERSION }} | ||
args: --config ./.golangci.yml -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
run: | ||
timeout: 5m | ||
go: '1.20' | ||
linters: | ||
enable: | ||
- gofmt # Gofmt checks whether code was gofmt-ed. By default, this tool runs with -s option to check for code simplification | ||
- gci # Gci controls golang package import order and makes it always deterministic. | ||
- errorlint # errorlint can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. | ||
- containedctx # containedctx is a linter that detects struct contained context.Context field | ||
- dogsled # Checks assignments with too many blank identifiers (e.g. x, , , _, := f()) | ||
- nilnil # Checks that there is no simultaneous return of nil error and an invalid value. | ||
- noctx # noctx finds sending http request without context.Context | ||
- gocyclo # measure cyclomatic complexity | ||
- gocognit # measure cognitive complexity | ||
- funlen # limit function length | ||
- dupl # Detect code duplication | ||
|
||
issues: | ||
exclude-rules: | ||
- linters: | ||
- containedctx | ||
- gocyclo | ||
- gocognit | ||
- funlen | ||
path: _test\.go | ||
|
||
linters-settings: | ||
gocyclo: | ||
min-complexity: 10 | ||
gocognit: | ||
min-complexity: 20 | ||
funlen: | ||
lines: 120 | ||
statements: 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,8 @@ import ( | |
"strings" | ||
"time" | ||
|
||
"github.com/go-logr/logr" | ||
corev1alpha1 "github.com/open-feature/open-feature-operator/apis/core/v1alpha1" | ||
"github.com/open-feature/open-feature-operator/controllers/common" | ||
appsV1 "k8s.io/api/apps/v1" | ||
"k8s.io/apimachinery/pkg/api/errors" | ||
|
@@ -30,9 +32,6 @@ import ( | |
"sigs.k8s.io/controller-runtime/pkg/builder" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
"sigs.k8s.io/controller-runtime/pkg/predicate" | ||
|
||
"github.com/go-logr/logr" | ||
corev1alpha1 "github.com/open-feature/open-feature-operator/apis/core/v1alpha1" | ||
) | ||
|
||
// FlagSourceConfigurationReconciler reconciles a FlagSourceConfiguration object | ||
|
@@ -55,6 +54,8 @@ type FlagSourceConfigurationReconciler struct { | |
|
||
// For more details, check Reconcile and its Result here: | ||
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile | ||
// | ||
//nolint:gocyclo | ||
func (r *FlagSourceConfigurationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { | ||
r.Log.Info("Searching for FlagSourceConfiguration") | ||
|
||
|
Oops, something went wrong.