forked from kyma-project/infrastructure-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from m00g3n/gha-test
Gha test
- Loading branch information
Showing
2 changed files
with
161 additions
and
0 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,56 @@ | ||
name: golangci-lint | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
pull_request: | ||
|
||
permissions: | ||
contents: read | ||
# Optional: allow read access to pull request. Use with `only-new-issues` option. | ||
# pull-requests: read | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
cache: false | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
# Require: The version of golangci-lint to use. | ||
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. | ||
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. | ||
version: v1.53 | ||
|
||
# Optional: working directory, useful for monorepos | ||
# working-directory: somedir | ||
|
||
# Optional: golangci-lint command line arguments. | ||
# | ||
# Note: By default, the `.golangci.yml` file should be at the root of the repository. | ||
# The location of the configuration file can be changed by using `--config=` | ||
# args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0 | ||
args: --timeout=5m | ||
|
||
# Optional: show only new issues if it's a pull request. The default value is `false`. | ||
# only-new-issues: true | ||
|
||
# Optional: if set to true, then all caching functionality will be completely disabled, | ||
# takes precedence over all other caching options. | ||
# skip-cache: true | ||
|
||
# Optional: if set to true, then the action won't cache or restore ~/go/pkg. | ||
# skip-pkg-cache: true | ||
|
||
# Optional: if set to true, then the action won't cache or restore ~/.cache/go-build. | ||
# skip-build-cache: true | ||
|
||
# Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'. | ||
# install-mode: "goinstall" |
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,105 @@ | ||
run: | ||
modules-download-mode: readonly | ||
timeout: 10m | ||
|
||
output: | ||
format: tab | ||
sort-results: true | ||
|
||
|
||
# This file contains only configs which differ from defaults. | ||
# All possible options can be found here https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml | ||
linters-settings: | ||
gocritic: | ||
# Settings passed to gocritic. | ||
# The settings key is the name of a supported gocritic checker. | ||
# The list of supported checkers can be find in https://go-critic.github.io/overview. | ||
settings: | ||
captLocal: | ||
# Whether to restrict checker to params only. | ||
# Default: true | ||
paramsOnly: false | ||
underef: | ||
# Whether to skip (*x).method() calls where x is a pointer receiver. | ||
# Default: true | ||
skipRecvDeref: false | ||
|
||
gomnd: | ||
# List of function patterns to exclude from analysis. | ||
# Values always ignored: `time.Date`, | ||
# `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`, | ||
# `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`. | ||
# Default: [] | ||
ignored-functions: | ||
- os.Chmod | ||
- os.Mkdir | ||
- os.MkdirAll | ||
- os.OpenFile | ||
- os.WriteFile | ||
|
||
govet: | ||
# Enable all analyzers. | ||
# Default: false | ||
enable-all: true | ||
# Disable analyzers by name. | ||
# Run `go tool vet help` to see all analyzers. | ||
# Default: [] | ||
disable: | ||
- fieldalignment # too strict | ||
# Settings per analyzer. | ||
settings: | ||
shadow: | ||
# Whether to be strict about shadowing; can be noisy. | ||
# Default: false | ||
strict: false | ||
|
||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
## enabled by default | ||
- errcheck # checking for unchecked errors, these unchecked errors can be critical bugs in some cases | ||
- gosimple # specializes in simplifying a code | ||
- govet # reports suspicious constructs, such as Printf calls whose arguments do not align with the format string | ||
- ineffassign # detects when assignments to existing variables are not used | ||
- staticcheck # is a go vet on steroids, applying a ton of static analysis checks | ||
- typecheck # like the front-end of a Go compiler, parses and type-checks Go code | ||
- unused # checks for unused constants, variables, functions and types | ||
## disabled by default | ||
- asasalint # checks for pass []any as any in variadic func(...any) | ||
- asciicheck # checks that your code does not contain non-ASCII identifiers | ||
- durationcheck # checks for two durations multiplied together | ||
- errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error | ||
- errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13 | ||
- exportloopref # checks for pointers to enclosing loop variables | ||
- gci # controls golang package import order and makes it always deterministic | ||
- gochecknoglobals # checks that no global variables exist | ||
- goconst # finds repeated strings that could be replaced by a constant | ||
- gocritic # provides diagnostics that check for bugs, performance and style issues | ||
- godox # detects TODOs keywords | ||
- goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt | ||
- gomnd # detects magic numbers | ||
- gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod | ||
- nestif # reports deeply nested if statements | ||
- nilerr # finds the code that returns nil even if it checks that the error is not nil | ||
- nilnil # checks that there is no simultaneous return of nil error and an invalid value | ||
- revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint | ||
- unconvert # removes unnecessary type conversions | ||
- unparam # reports unused function parameters | ||
- whitespace # detects leading and trailing whitespace | ||
|
||
|
||
issues: | ||
# Maximum count of issues with the same text. | ||
# Set to 0 to disable. | ||
# Default: 3 | ||
max-same-issues: 5 | ||
|
||
exclude-rules: | ||
- source: "(noinspection|TODO)" | ||
linters: [ godot ] | ||
- source: "//noinspection" | ||
linters: [ gocritic ] | ||
- path: "_test\\.go" | ||
linters: | ||
- goconst |