Skip to content

[codex] Fix Sonar TypeScript config resolution#488

Draft
davideluque wants to merge 1 commit intomainfrom
codex/fix-sonar-tsconfig-resolution
Draft

[codex] Fix Sonar TypeScript config resolution#488
davideluque wants to merge 1 commit intomainfrom
codex/fix-sonar-tsconfig-resolution

Conversation

@davideluque
Copy link
Copy Markdown
Contributor

What changed

  • install Node dependencies before the Sonar scan runs
  • constrain Sonar TypeScript analysis to tsconfig.json and inertia/tsconfig.json
  • keep the Sonar workflow aligned with the repository CI Node version source via .tool-versions

Why

Sonar was scanning before dependencies were installed, while both TypeScript entry configs extend @adonisjs/tsconfig from node_modules. That can trigger the warning that a referenced or extended tsconfig.json was not found and reduce TypeScript analysis accuracy.

Impact

The Sonar job should now resolve the intended TypeScript configs reliably and analyze the backend and Inertia frontend with the correct compiler settings.

Validation

  • npx tsc --showConfig -p tsconfig.json
  • npx tsc --showConfig -p inertia/tsconfig.json
  • direct push to main was blocked by repository rules, so this PR goes through the required checks

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the sonar-project.properties file to explicitly define TypeScript configuration paths. The review feedback identifies an inconsistency in the project's root tsconfig.json file, which references a non-existent path for the Inertia configuration, and suggests correcting this to allow for more natural project resolution and a cleaner Sonar configuration.

Comment thread sonar-project.properties
@@ -1 +1,2 @@
sonar.projectKey=abtion_adonisjs-template_e6981c04-79a9-46d2-9b70-6706c53d1f55
sonar.typescript.tsconfigPaths=tsconfig.json,inertia/tsconfig.json
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Explicitly defining sonar.typescript.tsconfigPaths addresses the resolution issue for Sonar, but there is an underlying inconsistency in the project configuration. The root tsconfig.json (line 8) references ./tsconfig.inertia.json, yet the actual file is located at inertia/tsconfig.json.

By correcting the reference in the root tsconfig.json to point to ./inertia/tsconfig.json, Sonar (and the TypeScript compiler) would be able to resolve the entire project structure naturally. This would also allow you to simplify the Sonar configuration to just the root config, avoiding potential double-analysis or metric inflation that can occur when overlapping configurations are listed explicitly.

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