Skip to content

CLI-563 SCA hook: add integrate git option#357

Open
georgii-borovinskikh-sonarsource wants to merge 7 commits into
masterfrom
gb/sca-integrate
Open

CLI-563 SCA hook: add integrate git option#357
georgii-borovinskikh-sonarsource wants to merge 7 commits into
masterfrom
gb/sca-integrate

Conversation

@georgii-borovinskikh-sonarsource

@georgii-borovinskikh-sonarsource georgii-borovinskikh-sonarsource commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Part of CLI-541


Summary by Gitar

  • CLI enhancements:
    • Added --with-dependency-risks and -p, --project options to integrate git command.
    • Restricted --with-dependency-risks to pre-push hooks and enforced project key validation.
  • Feature integration:
    • Implemented SCA scanner binary installation for pre-push hooks.
    • Added mandatory server-side validation for project existence and SCA capability during pre-push setup.
  • Resource management:
    • Updated textSnippet to support legacyStartMarkers, enabling smooth migration of existing hook markers.
  • New utilities:
    • Added project-key.ts for standardized validation of project keys.

This will update automatically on new commits.

@sonarqubecloud

sonarqubecloud Bot commented Jun 2, 2026

Copy link
Copy Markdown

Agentic Analysis: Early Results

Agentic 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.

3 issue(s) found across 2 file(s):

Rule File Line Message
typescript:S109 tests/unit/cli/commands/integrate/git/integrate-git.test.ts 99 No magic number: 401.
typescript:S109 tests/unit/lib/project-key.test.ts 31 No magic number: 400.
typescript:S109 tests/unit/lib/project-key.test.ts 39 No magic number: 401.

Analyzed by SonarQube Agentic Analysis in 6.6 s

@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod Bot changed the title SCA hook: add integrate git option CLI-563 SCA hook: add integrate git option Jun 2, 2026
@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Jun 2, 2026

Copy link
Copy Markdown

CLI-563

Comment thread src/cli/commands/integrate/git/index.ts
@gitar-bot

gitar-bot Bot commented Jun 3, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 resolved / 1 findings

Integrates SCA functionality into the git command with new project key validation and marker support. Adds user feedback for skipped dependency risks, resolving the previous silent failure issue.

✅ 1 resolved
Quality: No user feedback when dependency-risks is silently skipped

📄 src/cli/commands/integrate/git/index.ts:343-346
When resolveProjectKey returns null (user cancels the prompt), installDepRisks becomes false and the integration proceeds without dependency-risks scanning but prints no message explaining why. The user explicitly opted into dep-risks via the confirm prompt but then cancelled the project-key prompt — they may be confused about what was actually installed.

Consider adding a brief info/warn message when depRisksEnabled && projectKey == null, e.g.:

if (depRisksEnabled && projectKey == null) {
  warn('Skipping dependency-risks scanning (no project key provided).');
  blank();
}
Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud

sonarqubecloud Bot commented Jun 3, 2026

Copy link
Copy Markdown

@georgii-borovinskikh-sonarsource georgii-borovinskikh-sonarsource marked this pull request as ready for review June 3, 2026 09:46
@georgii-borovinskikh-sonarsource georgii-borovinskikh-sonarsource force-pushed the gb/sca-hook branch 4 times, most recently from 8383537 to 491e3a6 Compare June 4, 2026 07:30
Base automatically changed from gb/sca-hook to master June 4, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant