BUILD-11394: Adds checking for manual setting of the SQ Project Key on check-sca#261
Conversation
Agentic Analysis: Early ResultsAgentic Analysis and Context Augmentation are available on your project. Here are some issues that could have been prevented. Follow the links to learn how to put them into action. 1 issue(s) found across 1 file(s):
Analyzed by SonarQube Agentic Analysis in 2.7 s |
SummaryThis PR adds support for discovering SonarQube project keys via a new What changed:
What reviewers should knowStart here: Review the two new helper functions ( Key design decisions to verify:
Test coverage is thorough: The spec file includes cases for both file extensions, quoted values, missing sections, priority ordering, and reading from repo root when working in subdirectories. Pay attention to the "prefers .yaml over .yml when both exist" test to confirm precedence logic.
|
There was a problem hiding this comment.
Pull request overview
Adds support in the check-sca GitHub Action for discovering a SonarQube/SonarCloud project key from a manually maintained repo file (.github/check-sca.properties), intended to help repositories that don’t have standard scanner config files.
Changes:
- Extend project-key discovery to read
project-key=...from.github/check-sca.propertieswith high priority. - Add ShellSpec coverage for the new discovery source and update existing priority-order expectations.
- Update
README.mdto document the new manual override file and discovery order.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
check-sca/check-sca.sh |
Adds .github/check-sca.properties as a new discovery source and adjusts priority numbering. |
spec/check-sca_spec.sh |
Adds tests for reading/ignoring/prioritizing the new properties file; updates priority-order test. |
README.md |
Documents the new discovery source and provides instructions for creating .github/check-sca.properties. |
Comments suppressed due to low confidence (1)
check-sca/check-sca.sh:54
- With
set -euo pipefail, thisgrep | head | cut | trpipeline returns a non-zero status when noproject-key=line is present (or the file is malformed). That can causediscover_project_keysto exit early and skip all lower-priority sources, which contradicts the intended "ignore when malformed" behavior. Consider making the parse non-fatal (e.g., tolerate grep exit status) so missing/invalid lines don’t abort key discovery.
if [[ -f "$checksca_props" ]]; then
local key
key=$(grep -E '^project-key=' "$checksca_props" 2>/dev/null | head -1 | cut -d= -f2- | tr -d '[:space:]')
if [[ -n "$key" ]]; then
keys+=("$key")
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
79cc2e5 to
6cd16fd
Compare
6cd16fd to
5733760
Compare
5733760 to
89ac21d
Compare
jayadeep-km-sonarsource
left a comment
There was a problem hiding this comment.
Please check https://sonarsource.atlassian.net/browse/BUILD-11394?focusedCommentId=917983
pre-approving to unblock you
89ac21d to
c4e0347
Compare
c4e0347 to
beb03f6
Compare
|



What Changed?
check-scaaction, the action now checks the consumer repo's.github/check-sca.propertiesfile for setting of theproject-keycheck-scaaction can find their key