Skip to content

Commit 4fd7439

Browse files
authored
introduce sonarqube (#102)
This pull request introduces SonarQube integration to enhance code quality analysis and reporting. The changes include adding a SonarQube job to the CI workflow and configuring the SonarQube project properties for the repository. ### CI Workflow Enhancements: * [`.github/workflows/pull-request-main.yml`](diffhunk://#diff-deba6b8d69fe72e6186b64f7934e93aa1d8213648ef0e99400caa36df42883f0R46-R57): Added a new `sonarqube` job to perform SonarQube scans during pull requests. This job runs after the `ci-test`, `ci-lint-misc`, and `ci-lint` jobs and uses a custom GitHub action for the scan. ### SonarQube Configuration: * [`sonar-project.properties`](diffhunk://#diff-43ed9d31bea2a6d518d69836bcd1a8e6bd81bf4df96c4745792c220ca5aa549cR1-R26): Added a configuration file for SonarQube, specifying project metadata, source directories, exclusions for static analysis (e.g., `docs/**/*`, `**/*.json`, `deployments/**/*`), and coverage exclusions (e.g., `**/*_test.go`, `**/main.go`).
1 parent e1e0286 commit 4fd7439

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

.github/workflows/pull-request-main.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,15 @@ jobs:
4343
with:
4444
go-test-cmd: go test -race -coverprofile=coverage.txt $(go list ./...)
4545
use-go-cache: true
46+
47+
sonarqube:
48+
name: Sonar Scan
49+
if: github.event_name == 'pull_request'
50+
runs-on: ubuntu-24.04
51+
needs: [ ci-test, ci-lint-misc, ci-lint ]
52+
steps:
53+
- name: Scan with Sonarqube
54+
uses: smartcontractkit/.github/actions/ci-sonarqube-go@01d931b0455a754d12e7143cc54a5a3521a8f6f6 # ci-sonarqube-go@0.3.1
55+
with:
56+
sonar-token: ${{ secrets.SONAR_TOKEN }}
57+
sonar-host-url: ${{ secrets.SONAR_HOST_URL }}

sonar-project.properties

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
sonar.projectKey=smartcontractkit_chainlink_deployments_framework
2+
sonar.projectName=chainlink_deployments_framework
3+
sonar.sources=.
4+
sonar.python.version=3.8
5+
6+
# Full exclusions from the static analysis
7+
sonar.exclusions=\
8+
docs/**/*,\
9+
**/*.json, \
10+
**/*.pb.go
11+
12+
# docs/**/*, # Documentation directory
13+
# **/*.json \ # JSON files - speed up indexing
14+
# **/*.pb.go # Protobuf generated files
15+
16+
sonar.coverage.exclusions=\
17+
**/*_test.go, \
18+
deployments/**/*
19+
20+
#deployments/**/* # deployments package - temporary exclusion
21+
22+
# Tests' root folder, inclusions (tests to check and count) and exclusions
23+
sonar.tests=.
24+
25+
sonar.test.inclusions=\
26+
**/*_test.go

0 commit comments

Comments
 (0)