Skip to content

Commit

Permalink
style: fix linting (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfalkowski authored Feb 11, 2024
1 parent 0ab455d commit 1590de5
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 13 deletions.
72 changes: 59 additions & 13 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,90 @@
run:
skip-dirs:
- tmp
linters-settings:
lll:
line-length: 130
cyclop:
max-complexity: 21
linters:
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- asasalint
- asciicheck
- bidichk
- containedctx
- contextcheck
- cyclop
- decorder
- dogsled
- dupl
- errcheck
- dupword
- durationcheck
- errchkjson
- errname
- errorlint
- exportloopref
- execinquery
- exhaustive
- exportloopref
- forbidigo
- funlen
- gochecknoinits
- gci
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- gofmt
- gofumpt
- goheader
- goimports
- golint
- gomnd
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosmopolitan
- gosimple
- govet
- ineffassign
- grouper
- importas
- inamedparam
- lll
- loggercheck
- maintidx
- makezero
- mirror
- misspell
- musttag
- nakedret
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nolintlint
- nonamedreturns
- nosprintfhostport
- perfsprint
- prealloc
- predeclared
- promlinter
- protogetter
- reassign
- revive
- rowserrcheck
- staticcheck
- structcheck
- sloglint
- sqlclosecheck
- stylecheck
- typecheck
- tenv
- testableexamples
- testifylint
- testpackage
- thelper
- tparallel
- unconvert
- unparam
- unused
- varcheck
- wastedassign
- whitespace
- wsl
4 changes: 4 additions & 0 deletions gocovmerge.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func mergeProfileBlock(p *cover.Profile, pb cover.ProfileBlock, startIndex int)

sortFunc := func(i int) bool {
pi := p.Blocks[i+startIndex]

return pi.StartLine >= pb.StartLine && (pi.StartLine != pb.StartLine || pi.StartCol >= pb.StartCol)
}

Expand All @@ -42,6 +43,8 @@ func mergeProfileBlock(p *cover.Profile, pb cover.ProfileBlock, startIndex int)
}

i += startIndex

//nolint:nestif
if i < len(p.Blocks) && p.Blocks[i].StartLine == pb.StartLine && p.Blocks[i].StartCol == pb.StartCol {
if p.Blocks[i].EndLine != pb.EndLine || p.Blocks[i].EndCol != pb.EndCol {
log.Fatalf("OVERLAP MERGE: %v %v %v", p.FileName, p.Blocks[i], pb)
Expand All @@ -62,6 +65,7 @@ func mergeProfileBlock(p *cover.Profile, pb cover.ProfileBlock, startIndex int)
log.Fatalf("OVERLAP BEFORE: %v %v %v", p.FileName, pa, pb)
}
}

if i < len(p.Blocks)-1 {
pa := p.Blocks[i+1]
if pa.StartLine <= pb.StartLine && (pa.StartLine != pb.StartLine || pa.StartCol < pb.StartCol) {
Expand Down

0 comments on commit 1590de5

Please sign in to comment.