Fix CDS extractor database diagnostics to point to source-relative file paths #239
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What This PR Contributes
This pull request introduces significant improvements to the CDS extractor diagnostics system, with a focus on ensuring that all diagnostic file paths are reported as relative to the source root. This change enhances compatibility with CodeQL requirements and improves the clarity of diagnostic messages. The update affects both the implementation in source files and the corresponding test cases, and adds new utility logic for path conversion.
Diagnostic Path Handling Improvements
src/diagnostics.ts
now accept an optionalsourceRoot
parameter and use the newconvertToRelativePath
utility to ensure that diagnostic file paths are relative to the source root, defaulting to.
if the file is outside the source root. [1] [2] [3] [4]cds-extractor.ts
,src/codeql.ts
, andsrc/cds/compiler/retry.ts
have been updated to pass the appropriatesourceRoot
argument, ensuring consistent diagnostic reporting. [1] [2] [3] [4] [5] [6] [7] [8] [9]Diagnostic Utility Enhancements
convertToRelativePath
insrc/diagnostics.ts
to robustly resolve file paths relative to the source root, with fallback logic for files outside the root.addCompilationDiagnostic
,addDependencyGraphDiagnostic
,addDependencyInstallationDiagnostic
,addEnvironmentSetupDiagnostic
,addJavaScriptExtractorDiagnostic
,addNoCdsProjectsDiagnostic
) now support relative path conversion via the new utility. [1] [2] [3] [4] [5] [6] [7] [8]Test Suite Updates
test/src/cds/compiler/retry.test.ts
,test/src/codeql.test.ts
, andtest/src/diagnostics.test.ts
have been updated to include the newsourceRoot
parameter in diagnostic function calls, ensuring correct test coverage of the new logic. [1] [2] [3] [4]Documentation and Instructions
.github/instructions/extractors_cds_tools_ts.instructions.md
to clearly document requirements, preferences, and constraints for CDS extractor TypeScript source and test files, including the new mandate for relative diagnostic paths.References:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26]
Future Works
None