Skip to content

Commit fc03705

Browse files
authored
Merge pull request #582 from wpengine/APIH-1912-add-sonarqube
[APIH-1912] Set up SonarQube code analysis
2 parents 632b22e + 0aa5441 commit fc03705

2 files changed

Lines changed: 53 additions & 0 deletions

File tree

.github/workflows/sonar.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
on:
2+
push:
3+
branches:
4+
- develop
5+
pull_request:
6+
types: [opened, synchronize, reopened]
7+
8+
name: Sonarqube
9+
jobs:
10+
sonarqube:
11+
runs-on: ubuntu-latest
12+
if: github.event.pull_request.user.login != 'dependabot[bot]'
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: SonarQube Scan
19+
uses: sonarsource/sonarqube-scan-action@45f27363d4ff7d6b16baa0516490f10c52bdd5fc
20+
env:
21+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
22+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
23+
24+
- name: SonarQube Quality Gate check
25+
uses: sonarsource/sonarqube-quality-gate-action@8e9b0ca0a7273d6f16986388d98393efdfcf56fd
26+
timeout-minutes: 5
27+
env:
28+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

sonar-project.properties

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Server and project configuration
2+
sonar.host.url=https://sonar.wpengine.io/
3+
sonar.projectVersion=1.0
4+
sonar.sourceEncoding=UTF-8
5+
sonar.scm.provider=git
6+
7+
# Project identifiers
8+
sonar.projectName=wpackagist
9+
sonar.projectKey=wpengine_wpackagist_82f90787-67b8-45bc-8b47-99fbcfb1c1e7
10+
11+
# Language
12+
sonar.language=php
13+
14+
# Paths to source code directories (relative paths)
15+
sonar.sources=src
16+
17+
# Exclusions
18+
sonar.exclusions=**/*_test.*, **/mocks/**, **/node_modules/**, **/vendor/**
19+
20+
# Paths to test code directories (relative paths)
21+
sonar.tests=.
22+
sonar.test.inclusions=**/*Test.php
23+
24+
# Public repo: disable PR decoration to limit exposure of internal project details
25+
sonar.pullrequest.github.summary.comment=false

0 commit comments

Comments
 (0)