Skip to content

Commit

Permalink
sonar: fix warnings (#10034)
Browse files Browse the repository at this point in the history
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">
  • Loading branch information
taratorio authored Apr 24, 2024
1 parent 586416c commit 7066578
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.20'
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ go.work*
docker-compose.*.yml
.env
coverage.out
coverage-erigon.out
coverage-erigon-lib.out
coverage-total.out

dist
__debug_bin
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ test-erigon-ext:

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

test3: test-erigon-lib
$(GOTEST) --timeout 10m -tags $(BUILD_TAGS),e3
Expand Down Expand Up @@ -313,7 +313,7 @@ user_macos:
## coverage: run code coverage report and output total coverage %
.PHONY: coverage
coverage:
@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)}'
@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)}'

## hive: run hive test suite locally using docker e.g. OUTPUT_DIR=~/results/hive SIM=ethereum/engine make hive
.PHONY: hive
Expand Down
2 changes: 2 additions & 0 deletions erigon-lib/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@ libmdbx/build/*
tests/testdata/*

go.work*

coverage.out
2 changes: 1 addition & 1 deletion erigon-lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ lint-deps: lintci-deps lint-licenses-deps
lint: lintci lint-licenses lint-mod-tidy

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

test-no-fuzz:
$(GOTEST_NOFUZZ) --count 1 -p 2 ./...
7 changes: 5 additions & 2 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ sonar.organization=ledgerwatch
sonar.projectName=erigon

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

sonar.tests=.
sonar.test.inclusions=**/*_test.go,tests/**

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

# The only way to get an accurate analysis of C/C++/Objective-C files is
# by using the SonarSource build-wrapper and setting the property "sonar.cfamily.build-wrapper-output"
Expand All @@ -19,3 +19,6 @@ sonar.go.coverage.reportPaths=coverage-erigon.out,coverage-erigon-lib.out
sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-

# Specify whether to scan python files in the repo following python 2 or 3 rules
sonar.python.version=3.12

0 comments on commit 7066578

Please sign in to comment.