Skip to content

Commit 8fa39f1

Browse files
committed
Adapt code repo to AutoConfig
1 parent c83bddd commit 8fa39f1

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Build
2+
on:
3+
workflow_dispatch: # This line enables manual triggering of the workflow
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
jobs:
10+
build:
11+
name: Analyze
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
17+
- uses: sonarsource/sonarqube-scan-action@master
18+
env:
19+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} # SonarQube URL is stored in a GitHub secret
20+
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
= C++ example project scanned on SonarQube using AutoConfig
2+
3+
WIP
4+
15
= Code Description
26

37
An example of a flawed C++ code. The https://github.com/sonarsource-cfamily-examples/code[code repository] can be https://github.com/sonarsource-cfamily-examples/automatic-analysis-sc[analyzed automatically], but it can also be compiled with different build systems using different CI pipelines on Linux, macOS, and Windows.

sonar-project.properties

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
2-
sonar.projectKey=sonarsource-cfamily-examples_...
1+
sonar.projectKey=sonarsource-cfamily-examples_linux-autoconfig-gh-actions-sq_409eae14-979c-4758-b5fb-8513b12efb8c
32
sonar.organization=sonarsource-cfamily-examples
4-
sonar.projectName=
3+
sonar.projectName=sonarsource-cfamily-examples_linux-autoconfig-gh-actions-sq
54
sonar.projectVersion=1.0-SNAPSHOT
65

76
# =====================================================
@@ -11,5 +10,5 @@ sonar.projectVersion=1.0-SNAPSHOT
1110
# SQ standard properties
1211
sonar.sources=src
1312

14-
# Properties specific to the C and C++ analyzer:
15-
sonar.cfamily.compile-commands=bw-output/compile_commands.json
13+
# There is no need to provide the compile-commands property when using the AutoConfig mode
14+
# sonar.cfamily.compile-commands=bw-output/compile_commands.json

0 commit comments

Comments
 (0)