Skip to content
Draft
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
20 changes: 11 additions & 9 deletions .github/workflows/cli-output-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
branches: [main]
workflow_dispatch:

env:
GOPRIVATE: "github.com/brevdev/*"

jobs:
cli-output-compatibility:
runs-on: ubuntu-22.04
Expand All @@ -15,18 +18,17 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22.6'
cache: true

- name: Install dependencies
run: go mod download
- name: Configure git for private modules
env:
TOKEN: ${{ secrets.GH_TOKEN }}
run: git config --global url."https://${TOKEN}@github.com".insteadOf "https://github.com"

- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run CLI output compatibility tests
run: go test -v ./pkg/integration/

- name: Report test results
if: failure()
run: |
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
branches: [main]
workflow_dispatch:

env:
GOPRIVATE: "github.com/brevdev/*"

jobs:
ci:
strategy:
Expand All @@ -20,6 +23,14 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Configure git for private modules
env:
TOKEN: ${{ secrets.GH_TOKEN }}
run: git config --global url."https://${TOKEN}@github.com".insteadOf "https://github.com"

- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: actions/setup-go@v5
with:
go-version: '1.22.6'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:
with:
go-version: '1.22.6'
cache: true
- name: install
run: make install-tools
- name: lint
run: make lint
- name: golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: v2.7.2
# - name: Report Status
# if: always()
# uses: ravsamhq/notify-slack-action@v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ dist/
# binary
brev-cli
brev
brev-local

# golang executable
go1.*
Expand Down
102 changes: 102 additions & 0 deletions .golangci.bck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
linters-settings:
goimports:
local-prefixes: github.com/brevdev/brev-cli
revive:
min-confidence: 0.8
rules:
- name: blank-imports
- name: context-as-argument
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: if-return
- name: increment-decrement
- name: var-naming
- name: var-declaration
- name: package-comments
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: errorf
- name: empty-block
- name: superfluous-else
- name: unused-parameter
- name: unreachable-code
- name: redefines-builtin-id
gocyclo:
min-complexity: 16
govet:
check-shadowing: true
misspell:
locale: US
nolintlint:
allow-leading-space: false # require machine-readable nolint directives (with no leading space)
allow-unused: false # report any unused nolint directives
require-explanation: true # require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
funlen:
lines: 100
wrapcheck:
ignoreSigs:
- .WrapAndTrace
- .Errorf
- .Wrap
- .New
stylecheck:
checks: ["all", "-ST1020", "-ST1000"]

run:
build-tags:
- codeanalysis

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- errcheck
- gosimple
- govet
- ineffassign
# - staticcheck
- typecheck
- unused
- bodyclose
# - depguard
- dupl
- exportloopref
- forcetypeassert
- funlen
# - gci
- gocognit
# - goconst
- gocritic
- gocyclo
# - godot
- gofumpt
# - revive
# - gomnd
- goprintffuncname
- gosec
# - ifshort
- misspell
- noctx
- nolintlint
- rowserrcheck
- sqlclosecheck
- stylecheck
- thelper
- tparallel
- unconvert
- unparam
# - whitespace
# - errorlint
# - goerr113
- wrapcheck
issues:
# enable issues excluded by default
exclude-use-default: false
165 changes: 88 additions & 77 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,102 +1,113 @@
linters-settings:
goimports:
local-prefixes: github.com/brevdev/brev-cli
revive:
min-confidence: 0.8
rules:
- name: blank-imports
- name: context-as-argument
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: if-return
- name: increment-decrement
- name: var-naming
- name: var-declaration
- name: package-comments
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: errorf
- name: empty-block
- name: superfluous-else
- name: unused-parameter
- name: unreachable-code
- name: redefines-builtin-id
gocyclo:
min-complexity: 16
govet:
check-shadowing: true
misspell:
locale: US
nolintlint:
allow-leading-space: false # require machine-readable nolint directives (with no leading space)
allow-unused: false # report any unused nolint directives
require-explanation: true # require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
funlen:
lines: 100
wrapcheck:
ignoreSigs:
- .WrapAndTrace
- .Errorf
- .Wrap
- .New
stylecheck:
checks: ["all", "-ST1020", "-ST1000"]

version: "2"
run:
build-tags:
- codeanalysis

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
default: none
enable:
- errcheck
- gosimple
- govet
- ineffassign
# - staticcheck
- typecheck
- unused
- bodyclose
# - depguard
- copyloopvar
- dupl
- exportloopref
- errcheck
- forcetypeassert
- funlen
# - gci
- gocognit
# - goconst
- goconst
- gocritic
- gocyclo
# - godot
- gofumpt
# - revive
# - gomnd
- goprintffuncname
- gosec
# - ifshort
- govet
- ineffassign
- misspell
- noctx
- nolintlint
- revive
- rowserrcheck
- sqlclosecheck
- stylecheck
- thelper
- staticcheck
- tparallel
- unconvert
- unparam
# - whitespace
# - errorlint
# - goerr113
- unused
- whitespace
- wrapcheck
settings:
errcheck:
exclude-functions:
- (*encoding/json.Encoder).Encode
funlen:
lines: 100
gocyclo:
min-complexity: 15
govet:
check-shadowing: true
misspell:
locale: US
nolintlint:
allow-leading-space: false # require machine-readable nolint directives (with no leading space)
require-explanation: true
require-specific: false
allow-unused: false
revive:
rules:
- name: blank-imports
- name: context-as-argument
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: if-return
- name: increment-decrement
- name: var-naming
- name: var-declaration
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: errorf
- name: empty-block
- name: superfluous-else
- name: unused-parameter
- name: unreachable-code
- name: redefines-builtin-id
staticcheck:
checks:
- all
- -ST1020 # https://staticcheck.dev/docs/checks#ST1020 - ignore exported fuction doc style
- -ST1021 # https://staticcheck.dev/docs/checks#ST1021 - ignore forced exported type doc style
- -S1016 # https://staticcheck.dev/docs/checks/#S1016 - ignore as explicit field copy is preferred
- -QF1008 # https://staticcheck.dev/docs/checks/#QF1008 - ignore as explicit use of embedded fields is preferred
- -QF1001 # https://staticcheck.dev/docs/checks/#QF1001 - De Morgan's law (use of "!a && !b" over "!(a || b)") is typically preferred, but this is always case by case
wrapcheck:
ignore-sigs:
- .WrapAndTrace
- .Errorf
- .Wrap
- .New
- .ValidateStruct
- .Permanent
- .Decode
issues:
# enable issues excluded by default
exclude-use-default: false
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofumpt
settings:
goimports:
local-prefixes:
- github.com/brevdev/brev-cli
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
Loading
Loading