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

Lint Fix: - funlen - thelper - perfsprint - godox - goconst #65

Merged
merged 4 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This repository contains useful tools for Kyma Eventing:
- [Loadtest](./docs/loadtest/README.md) for load-testing the Eventing components by continuously sending and receiving cloudevents.
- [Publisher](./docs/publisher/README.md) for publishing legacy and cloudevents continuously.
- [Subscriber](./docs/subscriber/README.md) for consuming cloudevents.

- [Linter settings for Kyma modules](https://github.tools.sap/skydivingtunas/how-to/blob/master/golangci-lint-configuration.md)
> Note: The `publisher` and the `subscriber` are using the same Eventing infrastructure (e.g. Kyma subscriptions, subscribers, ...etc).
> This could be useful when verifying Eventing on any cluster by deploying both applications and watching their logs.

Expand Down
42 changes: 16 additions & 26 deletions config/lint/.golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ linters:
- lll
- maligned # deprecated (since v1.38.0)
- nlreturn # too strict and mostly code is not more readable
- nosnakecase # deprecated (since v1.48.1) and replaced by 'revive'
- nosnakecase # deprecated (since v1.48.1) and replaced by 'revive'
- scopelint # deprecated (since v1.39.0) and replaced by 'exportloopref'
- structcheck # deprecated (since v1.49.0) and replaced by 'unused'
- sqlclosecheck # not needed for this project
- varcheck # deprecated (since v1.49.0) and replaced by 'unused'
- wsl # too strict and mostly code is not more readable
### disabled for now... will be enabled 1 by 1
- dupl
- forcetypeassert
- gosec
Expand All @@ -33,19 +32,12 @@ linters:
- unconvert
- varnamelen
- wrapcheck
### Disable linters one by one
- funlen
- testifylint
- bodyclose
- containedctx
- thelper
- tagliatelle
- errchkjson
- perfsprint
- noctx
- godox
- goconst


linters-settings:
gomoddirectives:
Expand All @@ -67,20 +59,20 @@ linters-settings:
- name: line-length-limit
severity: warning
disabled: true
arguments: [ 120 ]
arguments: [120]
funlen:
lines: 80
lines: 100
cyclop:
max-complexity: 20
nestif:
min-complexity: 6
gci:
sections:
- standard # Standard packages.
- default # Imports that could not be matched to another section type.
- prefix(github.com/kyma-project/eventing-manager) # Imports with the specified prefix.
- blank # Blank imports.
- dot # Dot imports.
- standard # Standard packages.
- default # Imports that could not be matched to another section type.
- prefix(github.com/kyma-project/eventing-manager) # Imports with the specified prefix.
- blank # Blank imports.
- dot # Dot imports.
custom-order: true
skip-generated: true
importas:
Expand Down Expand Up @@ -114,24 +106,22 @@ linters-settings:
alias: eppapi
- pkg: github.com/kyma-project/eventing-publisher-proxy/pkg/nats
alias: eppnats
- pkg : github.com/kyma-project/eventing-manager/pkg/logger
- pkg: github.com/kyma-project/eventing-manager/pkg/logger
alias: emlogger
- pkg: github.com/kyma-project/eventing-manager/api/eventing/v1alpha1
alias: emeventingv1alpha1
- pkg: github.com/kyma-project/eventing-manager/api/eventing/v1alpha2
alias: emeventingv2alpha1
- pkg : github.com/cloudevents/sdk-go/v2
- pkg: github.com/cloudevents/sdk-go/v2
alias: ce
- pkg : github.com/cloudevents/sdk-go/v2/protocol/http
- pkg: github.com/cloudevents/sdk-go/v2/protocol/http
alias: cehttp
- pkg : github.com/cloudevents/sdk-go/v2/event
- pkg: github.com/cloudevents/sdk-go/v2/event
alias: ceevent
- pkg : github.com/cloudevents/sdk-go/v2/client
- pkg: github.com/cloudevents/sdk-go/v2/client
alias: ceclient
- pkg : github.com/kyma-project/kyma/components/central-application-gateway/pkg/apis/applicationconnector/v1alpha1
- pkg: github.com/kyma-project/kyma/components/central-application-gateway/pkg/apis/applicationconnector/v1alpha1
alias: kymaappconnv1alpha1



ireturn:
allow:
Expand All @@ -153,7 +143,7 @@ issues:
- funlen # Table driven unit and integration tests exceed function length by design
- maintidx # Table driven unit and integration tests exceed maintainability index by design
- linters:
- importas
- importas
text: has alias "" which is not part of config # Ignore false positives that emerged due to https://github.com/julz/importas/issues/15.
max-issues-per-linter: 0
max-same-issues: 0
Expand All @@ -162,4 +152,4 @@ output:
run:
timeout: 15m
skip-files:
- zz_generated.deepcopy.go
- zz_generated.deepcopy.go
Loading