Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kulti/thelper
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.6.3
Choose a base ref
...
head repository: kulti/thelper
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 2 commits
  • 5 files changed
  • 2 contributors

Commits on Nov 16, 2023

  1. docs: update install instructions

    estensen authored and kulti committed Nov 16, 2023
    Copy the full SHA
    6431946 View commit details

Commits on Feb 7, 2024

  1. chore: upgrade go and golangci-lint versions

    kulti committed Feb 7, 2024
    Copy the full SHA
    8c3073f View commit details
Showing with 41 additions and 28 deletions.
  1. +6 −6 .github/workflows/ci.yml
  2. +28 −18 .golangci.yml
  3. +1 −1 README.md
  4. +5 −3 pkg/analyzer/analyzer.go
  5. +1 −0 scripts/generator/generator.go
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -14,20 +14,20 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ^1.18
go-version: ^1.21
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.45.2
version: v1.56.0

tests:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest

steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.18
go-version: ^1.21
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
@@ -39,13 +39,13 @@ jobs:
path-to-profile: coverage.out

tests_race:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest

steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.18
go-version: ^1.21
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
46 changes: 28 additions & 18 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -12,25 +12,35 @@ linters-settings:
locale: US
gci:
local-prefixes: github.com/kulti/thelper
nolintlint:
require-explanation: true
require-specific: true

linters:
enable-all: true
disable:
- lll
- prealloc
- dupl
- wsl
- nlreturn
- goerr113
- exhaustivestruct
- paralleltest
- gomnd
- gocognit
- nestif
- varnamelen
- interfacer
- maligned
- scopelint
- golint
- cyclop
- nilnil
- cyclop
- deadcode # deprecated
- depguard # Not looks useful for this project
- dupl
- exhaustivestruct # deprecated
- exhaustruct # Make use of zero-values and partial initialization.
- gocognit
- goerr113
- golint
- gomnd
- ifshort # deprecated
- interfacer
- lll
- maligned
- nestif
- nilnil
- nlreturn
- nosnakecase # deprecated
- paralleltest
- prealloc
- scopelint
- structcheck # deprecated
- varcheck # deprecated
- varnamelen
- wsl
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ Note that you can also have it as the second parameter - this is primarily inten
## Installation

```
go get github.com/kulti/thelper/cmd/thelper
go install github.com/kulti/thelper/cmd/thelper@latest
```

## Usage
8 changes: 5 additions & 3 deletions pkg/analyzer/analyzer.go
Original file line number Diff line number Diff line change
@@ -16,7 +16,9 @@ import (
)

const (
doc = "thelper detects tests helpers which is not start with t.Helper() method."
doc = "thelper detects tests helpers which is not start with t.Helper() method."

//nolint:goconst // Just a repeated coma, cannot be written better.
checksDoc = `coma separated list of enabled checks
Available checks
@@ -254,7 +256,7 @@ func (t thelper) buildTestCheckFuncOpts(pass *analysis.Pass, ctxType types.Type)
fnHelper: tHelper,
subRun: tRun,
hpType: tType,
subTestFuncType: types.NewSignature(nil, types.NewTuple(tVar), nil, false),
subTestFuncType: types.NewSignatureType(nil, nil, nil, types.NewTuple(tVar), nil, false),
ctxType: ctxType,
checkBegin: t.enabledChecks.Enabled(checkTBegin),
checkFirst: t.enabledChecks.Enabled(checkTFirst),
@@ -315,7 +317,7 @@ func (t thelper) buildBenchmarkCheckFuncOpts(pass *analysis.Pass, ctxType types.
fnHelper: bHelper,
subRun: bRun,
hpType: types.NewPointer(bObj.Type()),
subTestFuncType: types.NewSignature(nil, types.NewTuple(bVar), nil, false),
subTestFuncType: types.NewSignatureType(nil, nil, nil, types.NewTuple(bVar), nil, false),
ctxType: ctxType,
checkBegin: t.enabledChecks.Enabled(checkBBegin),
checkFirst: t.enabledChecks.Enabled(checkBFirst),
1 change: 1 addition & 0 deletions scripts/generator/generator.go
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ import (
"text/template"
)

//nolint:dupword // false positive about double `type`
const tTmpl = `// Code generated by generator. DO NOT EDIT.
package {{$.Name}}