Skip to content

Commit

Permalink
Merge pull request #35 from Financial-Times/fix/UPPSF-4330-linter-conf
Browse files Browse the repository at this point in the history
Move linters config file to the orb repository
  • Loading branch information
epavlova authored Apr 7, 2023
2 parents 38b8088 + 89534b4 commit 01c36fc
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ workflows:
context: cm-team-orb-publishing
requires:
- publish-dev
filters: *only_branches
filters: *tags_and_branches
23 changes: 17 additions & 6 deletions src/commands/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,24 @@ parameters:
description: >
Location for golangci config file to be used (downloaded with wget)
type: string
default:
"https://raw.githubusercontent.com/Financial-Times/upp-coding-standard/\
v1.3.2/golangci-config/.golangci.yml"
default: ""
steps:
- run:
name: Download linters' config file
command: wget <<parameters.golangci-config>>
- when:
condition: <<parameters.golangci-config>>
steps:
- run:
name: Download linters' config file if given as parameter
command: wget -O .golangci.yml <<parameters.golangci-config>>
- unless:
condition: <<parameters.golangci-config>>
steps:
- run:
name: >
Copy linters' config file from orb source code into
the job executor’s filesystem
environment:
CONFIG_CONTENT: <<include(conf/.golangci.yml)>>
command: /bin/echo "$CONFIG_CONTENT" > .golangci.yml
- run:
name: Run linters
environment:
Expand Down
54 changes: 54 additions & 0 deletions src/conf/.golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
linters-settings:
govet:
check-shadowing: true
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
revive:
confidence: 0
gocognit:
min-complexity: 20

linters:
disable-all: true
enable:
- bodyclose
- errcheck
- gocognit
- gofmt
- goimports
- gosec
- gosimple
- govet
- ineffassign
- misspell
- revive
- staticcheck
- stylecheck
- typecheck
- unparam
- unused
- whitespace

run:
skip-dirs:
- test/testdata_etc
- pkg/golinters/goanalysis/(checker|passes)

issues:
exclude-rules:
- text: "weak cryptographic primitive"
linters:
- gosec

# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
service:
# use the fixed version to not introduce new linters unexpectedly
golangci-lint-version: 1.17.x
prepare:
- echo "here I can run custom commands"
4 changes: 1 addition & 3 deletions src/jobs/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ parameters:
description: >
Location for golangci config file to be used (downloaded with wget)
type: string
default:
"https://raw.githubusercontent.com/Financial-Times/upp-coding-standard/\
v1.3.2/golangci-config/.golangci.yml"
default: ""
coverage-report-folder:
description: Folder to temporarily store coverage results
type: string
Expand Down

0 comments on commit 01c36fc

Please sign in to comment.