Skip to content

Commit 7066578

Browse files
authored
sonar: fix warnings (#10034)
Fixes Sonar warnings: <img width="550" alt="Screenshot 2024-04-23 at 19 37 53" src="https://github.com/ledgerwatch/erigon/assets/94537774/b85c9607-3800-408d-8a1b-c5bf80da38b2">
1 parent 586416c commit 7066578

File tree

6 files changed

+13
-7
lines changed

6 files changed

+13
-7
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333

3434
steps:
3535
- uses: actions/checkout@v3
36+
with:
37+
fetch-depth: 0
3638
- uses: actions/setup-go@v4
3739
with:
3840
go-version: '1.20'

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ go.work*
7878
docker-compose.*.yml
7979
.env
8080
coverage.out
81-
coverage-erigon.out
82-
coverage-erigon-lib.out
81+
coverage-total.out
8382

8483
dist
8584
__debug_bin

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ test-erigon-ext:
162162

163163
## test: run unit tests with a 100s timeout
164164
test: test-erigon-lib
165-
$(GOTEST) --timeout 10m -coverprofile=coverage-erigon.out
165+
$(GOTEST) --timeout 10m -coverprofile=coverage.out
166166

167167
test3: test-erigon-lib
168168
$(GOTEST) --timeout 10m -tags $(BUILD_TAGS),e3
@@ -313,7 +313,7 @@ user_macos:
313313
## coverage: run code coverage report and output total coverage %
314314
.PHONY: coverage
315315
coverage:
316-
@go test -coverprofile=coverage.out ./... > /dev/null 2>&1 && go tool cover -func coverage.out | grep total | awk '{print substr($$3, 1, length($$3)-1)}'
316+
@go test -coverprofile=coverage-total.out ./... > /dev/null 2>&1 && go tool cover -func coverage-total.out | grep total | awk '{print substr($$3, 1, length($$3)-1)}'
317317

318318
## hive: run hive test suite locally using docker e.g. OUTPUT_DIR=~/results/hive SIM=ethereum/engine make hive
319319
.PHONY: hive

erigon-lib/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,5 @@ libmdbx/build/*
7373
tests/testdata/*
7474

7575
go.work*
76+
77+
coverage.out

erigon-lib/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ lint-deps: lintci-deps lint-licenses-deps
9797
lint: lintci lint-licenses lint-mod-tidy
9898

9999
test:
100-
$(GOTEST) --count 1 -p 2 -coverprofile=coverage-erigon-lib.out ./...
100+
$(GOTEST) --count 1 -p 2 -coverprofile=coverage.out ./...
101101

102102
test-no-fuzz:
103103
$(GOTEST_NOFUZZ) --count 1 -p 2 ./...

sonar-project.properties

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ sonar.organization=ledgerwatch
33
sonar.projectName=erigon
44

55
sonar.sources=.
6-
sonar.exclusions=**/*.pb.go,cmd/rpcdaemon/graphql/graph/generated.go
6+
sonar.exclusions=**/*.pb.go,**/gen_*.go,**/graphql/graph/generated.go,**/*.sol,common/compiler/*.v.py
77

88
sonar.tests=.
99
sonar.test.inclusions=**/*_test.go,tests/**
1010

11-
sonar.go.coverage.reportPaths=coverage-erigon.out,coverage-erigon-lib.out
11+
sonar.go.coverage.reportPaths=coverage.out,erigon-lib/coverage.out
1212

1313
# The only way to get an accurate analysis of C/C++/Objective-C files is
1414
# by using the SonarSource build-wrapper and setting the property "sonar.cfamily.build-wrapper-output"
@@ -19,3 +19,6 @@ sonar.go.coverage.reportPaths=coverage-erigon.out,coverage-erigon-lib.out
1919
sonar.c.file.suffixes=-
2020
sonar.cpp.file.suffixes=-
2121
sonar.objc.file.suffixes=-
22+
23+
# Specify whether to scan python files in the repo following python 2 or 3 rules
24+
sonar.python.version=3.12

0 commit comments

Comments
 (0)