Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SonarQube settings #70

Merged
merged 1 commit into from
Mar 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,22 @@ jobs:
- name: Set up msbuild
uses: microsoft/setup-msbuild@v2

- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v3
- name: Install Build Wrapper
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v5

- name: Restore NuGet packages
working-directory: ${{env.GITHUB_WORKSPACE}}
run: nuget restore ${{env.SOLUTION_FILE_PATH}}
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: nuget restore ${{ env.SOLUTION_FILE_PATH }}

- name: Run build-wrapper
run: |
build-wrapper-win-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} msbuild netpbm-wic-codec.sln /t:netpbm-wic-codec:rebuild /p:Configuration="Release" /p:Platform="x64" /nodeReuse:false

- name: Run sonar-scanner
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Put the name of your token here
run: |
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
# Consult https://docs.sonarsource.com/sonarqube-server/latest/analyzing-source-code/scanners/sonarscanner/ for more information and options
args: >
--define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
8 changes: 6 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>

<!-- Explicit define that all projects are compiled according the draft C++23 standard -->
<LanguageStandard>stdcpp23</LanguageStandard>
<LanguageStandard>stdcpplatest</LanguageStandard>
<UseStandardPreprocessor>true</UseStandardPreprocessor>

<!-- To ensure high quality C++ code use warning level 4 and treat warnings as errors to ensure warnings are fixed promptly. -->
Expand Down Expand Up @@ -172,7 +172,6 @@
<EnableCppCoreCheck>true</EnableCppCoreCheck>
<EnableMicrosoftCodeAnalysis>true</EnableMicrosoftCodeAnalysis>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>

<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
Expand All @@ -186,10 +185,15 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WholeProgramOptimization>true</WholeProgramOptimization>

<!-- Enable Optimize Global Data (/Gw). off by default -->
<AdditionalOptions>/Gw /Zc:checkGwOdr %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>

<!-- Store only the filename of the PDB file into the .exe/.dll for deterministic builds and use /Brepo. -->
<AdditionalOptions>/PDBALTPATH:%_PDB% /Brepro %(AdditionalOptions)</AdditionalOptions>
Expand Down
4 changes: 3 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ sonar.sources = src/
sonar.tests = test/

# Encoding of the source code files. Default is the default system encoding, which is not correct.
sonar.sourceEncoding=UTF-8
sonar.sourceEncoding = UTF-8

sonar.cfamily.enableModules = true