Skip to content

Commit

Permalink
1. Refactoring linter configuration
Browse files Browse the repository at this point in the history
2. Refactoring GitHub Actions
  • Loading branch information
BorzdeG committed Aug 22, 2024
1 parent b97a361 commit 3c08463
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 41 deletions.
14 changes: 12 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ tab_width = 4
ij_smart_tabs = true
ij_continuation_indent_size = 4
max_line_length = 150
ij_visual_guides = 80, 120
# https://www.jetbrains.com/help/idea/editorconfig.html
ij_visual_guides = 80, 120, 150
ij_formatter_tags_enabled = true
ij_formatter_on_tag = @formatter:on
ij_formatter_off_tag = @formatter:off
Expand All @@ -30,12 +31,21 @@ ij_go_run_go_fmt_on_reformat = true
ij_go_call_parameters_wrap = on_every_item

[{*.yml,*.yaml}]
indent_style = space
indent_size = 2
tab_width = 2
ij_wrap_on_typing = false
ij_yaml_keep_indents_on_empty_lines = false

[.idea/**.xml]
indent_style = space
indent_size = 2
tab_width = 2
ij_xml_space_inside_empty_tag = true
insert_final_newline = false

[Makefile]
ij_wrap_on_typing = false
ij_wrap_on_typing = false

[{LICENSE,*.adoc}]
max_line_length = off
8 changes: 1 addition & 7 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
name: 'Dependency Review'
on: [pull_request]
on: [ pull_request ]

permissions:
contents: read
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: lint

on:
push:
pull_request:

jobs:
test-gomod:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 'stable'
- run: go mod tidy && git diff --exit-code go.mod go.sum

test-generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: 'stable'
check-latest: true

- run: make go-dependencies

- run: make go-generate && git diff --exit-code

editorconfig:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: editorconfig-checker/action-editorconfig-checker@main
- run: editorconfig-checker
2 changes: 1 addition & 1 deletion .github/workflows/test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
with:
go-version: ${{ matrix.go }}

- run: make go-all-tests
- run: make go-test

- name: Test Summary
uses: test-summary/action@v2
Expand Down
14 changes: 1 addition & 13 deletions .github/workflows/test.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@ on:
pull_request:

jobs:
test-gomod:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 'stable'
- run: go mod tidy && git diff --exit-code go.mod go.sum

test:
runs-on: ubuntu-latest
Expand All @@ -27,10 +18,7 @@ jobs:
check-latest: true

- run: make go-dependencies

- run: make go-generate && git diff --exit-code

- run: make go-all-tests
- run: make go-test

- name: Test Summary
uses: test-summary/action@v2
Expand Down
35 changes: 18 additions & 17 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,62 +38,63 @@ linters-settings:
require-specific: true
lll:
line-length: 150
copyloopvar:
check-alias: true

linters:
disable-all: true
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- unused
- asasalint
- bodyclose
- containedctx
- contextcheck
- copyloopvar
- cyclop
- dogsled
- err113
- errcheck
- errname
- errorlint
- exhaustive
- exportloopref
- forbidigo
- funlen
- ginkgolinter
# - gochecknoinits
- goconst
- gocritic
- gocyclo
- err113
- goimports
- mnd
- lll
- gomoddirectives
- goprintffuncname
# - gochecknoinits
- goconst
- gosec
- gosimple
- govet
- grouper
- ineffassign
- interfacebloat
- lll
- misspell
- mnd
- nilerr
- nlreturn
- noctx
- nolintlint
- nonamedreturns
- prealloc
- predeclared
- promlinter
- revive
- wastedassign
- staticcheck
- stylecheck
- tagliatelle
- tenv
- testpackage
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- varnamelen
- wastedassign
- whitespace
- wsl
- ginkgolinter
- interfacebloat
- nonamedreturns
- stylecheck
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ go-dependencies:
$(eval GOBIN=$(shell go env GOPATH 2>/dev/null)/bin)
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) latest
#
go install github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@latest
#
go install github.com/onsi/ginkgo/v2/ginkgo@latest

go-update: go-dependencies
Expand All @@ -12,9 +14,10 @@ go-generate: go-dependencies
$(MAKE) go-update

go-lint:
editorconfig-checker
golangci-lint run

go-test: go-lint
go-test:
ginkgo -race --cover --coverprofile=.coverage-ginkgo.out --junit-report=junit-report.xml ./...
go tool cover -func=.coverage-ginkgo.out -o=.coverage.out
go tool cover -html=.coverage-ginkgo.out -o=coverage.html
Expand Down

0 comments on commit 3c08463

Please sign in to comment.