Skip to content

fix: resolve SonarQube compilation database path mismatch caused by Nix store paths#8

Merged
FreeYourSoul merged 1 commit intomasterfrom
copilot/fix-fil-build-issue
Mar 31, 2026
Merged

fix: resolve SonarQube compilation database path mismatch caused by Nix store paths#8
FreeYourSoul merged 1 commit intomasterfrom
copilot/fix-fil-build-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 31, 2026

The Nix build sandboxes sources under /nix/store/<hash>-source/, so compile_commands.json contains absolute paths into the store rather than the workspace. SonarQube finds the 8 compilation units in the database but matches 0 files against sonar.sources, causing the scan to fail.

Changes

  • .github/workflows/ci-linux.yml — Adds a "Fix compile_commands.json paths" step between the Nix build and the SonarQube scan:

    • Copies result/compile_commands.json (read-only in the Nix store) into the workspace
    • Detects the /nix/store/<hash> prefix dynamically from the first database entry and replaces it with $PWD
  • sonar-project.properties — Points sonar.cfamily.compile-commands to the patched workspace-local copy instead of result/compile_commands.json

# Dynamically detects and replaces any Nix store prefix
match = re.match(r'^(/nix/store/[^/]+)', file_path)
if nix_prefix:
    content = content.replace(nix_prefix, workspace)

@FreeYourSoul FreeYourSoul reopened this Mar 31, 2026
@FreeYourSoul FreeYourSoul marked this pull request as ready for review March 31, 2026 06:07
@FreeYourSoul FreeYourSoul merged commit bd55a80 into master Mar 31, 2026
1 of 2 checks passed
@FreeYourSoul FreeYourSoul deleted the copilot/fix-fil-build-issue branch March 31, 2026 06:07
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.

2 participants