Add paths-ignore support to CDS extractor and update dependencies#327
Open
data-douser wants to merge 5 commits intomainfrom
Open
Add paths-ignore support to CDS extractor and update dependencies#327data-douser wants to merge 5 commits intomainfrom
paths-ignore support to CDS extractor and update dependencies#327data-douser wants to merge 5 commits intomainfrom
Conversation
Read `paths-ignore` patterns from `.github/codeql/codeql-config.{yml,yaml}`
and apply them at two levels:
- CDS file discovery: filter out ignored files and skip entire projects
whose directory matches a pattern (avoids unnecessary compilation)
- JS extraction handoff: append `exclude:` entries to LGTM_INDEX_FILTERS
so compiled .cds.json output is also excluded
Uses js-yaml for config parsing and minimatch for glob matching, consistent
with CodeQL's documented paths-ignore semantics (**, *, directory prefixes).
Results are cached per source root to avoid repeated YAML reads.
Bumps to latest available minor versions for CDS extractor NodeJS dependencies, where a full version upgrade of such (e.g. eslint) dependencies is currently blocked due to conflicts with transitive dependencies.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds CodeQL paths-ignore support to the CDS extractor so that file/project discovery and downstream JavaScript extraction consistently skip user-ignored paths, aligning extractor behavior with CodeQL configuration.
Changes:
- Introduces a
paths-ignoreutility to locate and parse CodeQL config, cache patterns, and match/filter paths. - Applies
paths-ignorefiltering during CDS project/file discovery and propagates excludes to the JavaScript extractor viaLGTM_INDEX_FILTERS. - Updates dependencies and adds/updates Jest tests to validate filtering and environment behavior.
Reviewed changes
Copilot reviewed 9 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| extractors/cds/tools/src/paths-ignore.ts | New module to find CodeQL config, read/cache paths-ignore, and filter/match paths. |
| extractors/cds/tools/src/cds/parser/functions.ts | Filters discovered .cds files using paths-ignore patterns. |
| extractors/cds/tools/src/cds/parser/graph.ts | Skips entire CDS projects that match paths-ignore and skips projects emptied by filtering. |
| extractors/cds/tools/src/environment.ts | Adds helper to append paths-ignore patterns as exclude: rules in LGTM_INDEX_FILTERS. |
| extractors/cds/tools/src/codeql.ts | Calls the new environment helper before running JavaScript extraction. |
| extractors/cds/tools/test/src/paths-ignore.test.ts | New unit tests for config discovery, parsing, caching, and glob matching/filtering behavior. |
| extractors/cds/tools/test/src/environment.test.ts | Adds tests for applyPathsIgnoreToLgtmFilters and mocks paths-ignore. |
| extractors/cds/tools/test/src/codeql.test.ts | Updates mocks to include the new environment helper. |
| extractors/cds/tools/package.json | Adds js-yaml/minimatch and updates dev tooling versions. |
| extractors/cds/tools/package-lock.json | Lockfile updates for added/updated dependencies. |
Files not reviewed (1)
- extractors/cds/tools/package-lock.json: Language not supported
You can also share your feedback on Copilot code review. Take the survey.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Resolves #326
Summary of Changes
This pull request adds support for respecting CodeQL
paths-ignorepatterns throughout the CDS extractor tooling. It introduces a newpaths-ignoreutility module, updates the dependency graph and file discovery logic to filter out ignored files and projects, and ensures that these patterns are also applied to the JavaScript extractor via environment variables. Additionally, the environment and test setup are updated to support and verify this new behavior.Outline of Changes
Key changes include:
Support for CodeQL
paths-ignorepatterns:paths-ignore.tsthat locates, parses, and cachespaths-ignoreglob patterns from a CodeQL config file, and provides utilities to filter or match paths against these patterns.parser/functions.tsandparser/graph.tsto filter out files and projects matchingpaths-ignorepatterns, with logging to indicate when files or projects are skipped. [1] [2] [3] [4]Integration with JavaScript extractor environment:
applyPathsIgnoreToLgtmFiltersinenvironment.tsto appendexclude:rules for eachpaths-ignorepattern to theLGTM_INDEX_FILTERSenvironment variable, so the JavaScript extractor also honors these exclusions. [1] [2]codeql.tsto call this new function before running extraction. [1] [2]Dependency and test updates:
package.jsonto includejs-yamlandminimatchfor YAML parsing and glob matching, and added their type definitions.environment.test.ts. [1] [2] [3]These changes ensure that the extractor and associated tools consistently obey user-specified ignore patterns, improving accuracy and alignment with CodeQL configuration.
Future Works
N/A