Skip to content

Commit

Permalink
SONAR-23139 Use -D everywhere for consistency
Browse files Browse the repository at this point in the history
Co-authored-by: Benjamin Raymond <[email protected]>
  • Loading branch information
2 people authored and sonartech committed Sep 26, 2024
1 parent b19fa90 commit 021c7d4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ jobs:
SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: \${{secrets.SONAR_HOST_URL}}
run: |
sonar-scanner --define sonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json""
sonar-scanner -Dsonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json""
`;
exports[`should follow and complete all steps: C++ Linux: .github/workflows/build.yml 1`] = `
Expand Down Expand Up @@ -220,7 +220,7 @@ jobs:
SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: \${{secrets.SONAR_HOST_URL}}
run: |
sonar-scanner --define sonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json""
sonar-scanner -Dsonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json""
`;
exports[`should follow and complete all steps: C++ MacOS: .github/workflows/build.yml 1`] = `
Expand Down Expand Up @@ -256,7 +256,7 @@ jobs:
SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: \${{secrets.SONAR_HOST_URL}}
run: |
sonar-scanner --define sonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json""
sonar-scanner -Dsonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json""
`;
exports[`should follow and complete all steps: C++ Windows: .github/workflows/build.yml 1`] = `
Expand Down Expand Up @@ -292,7 +292,7 @@ jobs:
SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: \${{secrets.SONAR_HOST_URL}}
run: |
sonar-scanner --define sonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json""
sonar-scanner -Dsonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json""
`;
exports[`should follow and complete all steps: C++: sonar-project.properties 1`] = `"sonar.projectKey=my-project"`;
Expand Down Expand Up @@ -442,7 +442,7 @@ jobs:
SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: \${{secrets.SONAR_HOST_URL}}
run: |
sonar-scanner --define sonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json""
sonar-scanner -Dsonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json""
`;
exports[`should follow and complete all steps: Objective-C Linux: .github/workflows/build.yml 1`] = `
Expand Down Expand Up @@ -478,7 +478,7 @@ jobs:
SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: \${{secrets.SONAR_HOST_URL}}
run: |
sonar-scanner --define sonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json""
sonar-scanner -Dsonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json""
`;
exports[`should follow and complete all steps: Objective-C MacOS: .github/workflows/build.yml 1`] = `
Expand Down Expand Up @@ -514,7 +514,7 @@ jobs:
SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: \${{secrets.SONAR_HOST_URL}}
run: |
sonar-scanner --define sonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json""
sonar-scanner -Dsonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json""
`;
exports[`should follow and complete all steps: Objective-C Windows: .github/workflows/build.yml 1`] = `
Expand Down Expand Up @@ -550,7 +550,7 @@ jobs:
SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: \${{secrets.SONAR_HOST_URL}}
run: |
sonar-scanner --define sonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json""
sonar-scanner -Dsonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json""
`;
exports[`should follow and complete all steps: Objective-C: sonar-project.properties 1`] = `"sonar.projectKey=my-project"`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const STEPS = (os?: OSs, arch?: Arch) => {
SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: \${{secrets.SONAR_HOST_URL}}
run: |
sonar-scanner --define sonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"`;
sonar-scanner -Dsonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"`;
} else if (OSs.MacOS === os) {
return `
- name: Install sonar-scanner and build-wrapper
Expand All @@ -72,7 +72,7 @@ const STEPS = (os?: OSs, arch?: Arch) => {
SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: \${{secrets.SONAR_HOST_URL}}
run: |
sonar-scanner --define sonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"`;
sonar-scanner -Dsonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"`;
} else if (OSs.Windows === os) {
return `
- name: Install sonar-scanner and build-wrapper
Expand All @@ -88,7 +88,7 @@ const STEPS = (os?: OSs, arch?: Arch) => {
SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: \${{secrets.SONAR_HOST_URL}}
run: |
sonar-scanner --define sonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"`;
sonar-scanner -Dsonar.cfamily.compile-commands="\${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"`;
}

return '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ build:
stage: build-analyze
script:
- build-wrapper/build-wrapper-linux-x86-64 --out-dir "\${BUILD_WRAPPER_OUT_DIR}" <your clean build command>
- sonar-scanner/bin/sonar-scanner --define sonar.host.url="\${SONAR_HOST_URL}" --define sonar.cfamily.compile-commands="\${BUILD_WRAPPER_OUT_DIR}/compile_commands.json"
- sonar-scanner/bin/sonar-scanner -Dsonar.host.url="\${SONAR_HOST_URL}" -Dsonar.cfamily.compile-commands="\${BUILD_WRAPPER_OUT_DIR}/compile_commands.json"
cache:
policy: pull
key: "\${CI_COMMIT_SHORT_SHA}"
Expand Down Expand Up @@ -153,7 +153,7 @@ sonarqube-check:
paths:
- sonar-scanner/
script: sonar-scanner/bin/sonar-scanner --define sonar.host.url="\${SONAR_HOST_URL}"
script: sonar-scanner/bin/sonar-scanner -Dsonar.host.url="\${SONAR_HOST_URL}"
allow_failure: true
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
Expand Down Expand Up @@ -384,7 +384,7 @@ sonarqube-check:
stage: sonarqube-check
script:
- sonar-scanner --define sonar.host.url="\${SONAR_HOST_URL}"
- sonar-scanner -Dsonar.host.url="\${SONAR_HOST_URL}"
allow_failure: true
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ const BUILD_TOOL_SPECIFIC: {
[BuildTools.Cpp]: {
image: 'gcc',
script: (_, autoConfig?: AutoConfig) =>
`sonar-scanner/bin/sonar-scanner --define sonar.host.url="\${SONAR_HOST_URL}" ` +
`sonar-scanner/bin/sonar-scanner -Dsonar.host.url="\${SONAR_HOST_URL}" ` +
(autoConfig === AutoConfig.Manual
? `--define sonar.cfamily.compile-commands="\${BUILD_WRAPPER_OUT_DIR}/compile_commands.json"`
? `-Dsonar.cfamily.compile-commands="\${BUILD_WRAPPER_OUT_DIR}/compile_commands.json"`
: ''),
},
[BuildTools.ObjectiveC]: {
image: 'gcc',
script: (_) =>
`sonar-scanner/bin/sonar-scanner --define sonar.host.url="\${SONAR_HOST_URL}" ` +
`--define sonar.cfamily.compile-commands="\${BUILD_WRAPPER_OUT_DIR}/compile_commands.json"`,
`sonar-scanner/bin/sonar-scanner -Dsonar.host.url="\${SONAR_HOST_URL}" ` +
`-Dsonar.cfamily.compile-commands="\${BUILD_WRAPPER_OUT_DIR}/compile_commands.json"`,
},
[BuildTools.Dart]: {
image: 'ghcr.io/cirruslabs/flutter:stable',
Expand All @@ -88,7 +88,7 @@ const BUILD_TOOL_SPECIFIC: {
name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""]`,
script: () => `
- sonar-scanner --define sonar.host.url="\${SONAR_HOST_URL}"`,
- sonar-scanner -Dsonar.host.url="\${SONAR_HOST_URL}"`,
},
};

Expand Down

0 comments on commit 021c7d4

Please sign in to comment.