FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Respect `exclude-from-incremental` query tag for diff-informed analysis by cklin · Pull Request #2831 · github/codeql-action · GitHub

Respect exclude-from-incremental query tag for diff-informed analysis - #2831

Merged
cklin merged 8 commits into
mainfrom
cklin/diff-informed-query-filtering
Mar 31, 2025
Merged

cklin merged 8 commits into
mainfrom
cklin/diff-informed-query-filtering

Conversation

cklin commented Mar 27, 2025
edited
Loading

Copy link
Copy Markdown
Contributor

This PR changes the action to add the following settings to the Code Scanning configuration file when performing diff-informed analysis:

query-filters:
    - exclude:
        tags: exclude-from-incremental

Code Scanning configuration file for non-diff-informed analysis remains unchanged.

Commit-by-commit review recommended. The first few commits are preparatory; they change code structure while preserving existing code behavior. The second-last commit adds the new functionality, and the last commit rebuilds the js files.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

cklin added 6 commits March 27, 2025 10:27
This commit adds a defaultQueryFilters field to AugmentationProperties
and incorporates its value into the augmented Code Scanning config.
However, in this commit defaultQueryFilters is always empty, so there is
not yet any actual behavior change.
cklin force-pushed the cklin/diff-informed-query-filtering branch from 4e9ec05 to 1a1a4f3 Compare March 27, 2025 21:23
cklin marked this pull request as ready for review March 27, 2025 21:35
Copilot AI review requested due to automatic review settings March 27, 2025 21:35
cklin requested a review from a team as a code owner March 27, 2025 21:35

Copilot AI left a comment

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull Request Overview

This PR ensures that diff-informed analysis respects the "exclude-from-incremental" query tag by adding a default query filter when running on pull requests. It updates the configuration augmentation logic and replaces the legacy diff filtering utilities with the new diff-informed analysis utilities.

  • Updated import paths and usage of diff utilities across the codebase.
  • Modified the augmentation logic to conditionally add a query filter.
  • Adjusted tests to account for the new asynchronous behavior and defaultQueryFilters property.

Reviewed Changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/upload-lib.ts Updated import to use diff-informed analysis utils.
src/diff-informed-analysis-utils.ts Added new diff utility functions and removal of diff-filtering-utils.
src/diff-filtering-utils.ts Removed legacy diff filtering functionality.
src/config-utils.ts Updated calculateAugmentation to be asynchronous and add defaultQueryFilters.
src/config-utils.test.ts Modified tests to include the new defaultQueryFilters property.
src/codeql.ts Merged defaultQueryFilters into the Code Scanning config generation.
src/analyze.ts Adjusted diff analysis function calls to use the new utilities.
src/analyze-action.ts Updated diff-informed query run call logic with branches check.
lib/upload-lib.js Updated import path for diff-informed analysis utilities.
lib/diff-informed-analysis-utils.js Added new diff utility functions and exported shouldPerformDiffInformedAnalysis.
lib/config-utils.test.js Test adjustments for asynchronous augmentation calculation.
lib/config-utils.js Updated calculateAugmentation to async and integrated defaultQueryFilters.
lib/codeql.js Injected defaultQueryFilters into the augmented Code Scanning config.
lib/analyze.js Replaced legacy diff utility usage with the new diff-informed approaches.
lib/analyze-action.js Adjusted diff-informed analysis setup to use branch information.

Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more

angelapwen previously approved these changes Mar 28, 2025

angelapwen left a comment

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Logic looks 👍!

Non-blocking nit: could shouldPerformDiffInformedQueries return a boolean and then the branches value be returned elsewhere? Or alternatively maybe we could rename the function something even longer and gnarlier, like getBranchesIfDiffInformedQueriesEnabled 😬

Copy link
Copy Markdown
Contributor

Yeah, or just checkDiffInformedQueries — we don't have to explain the return type in the function name, but should is usually associated with a boolean return type.

cklin added 2 commits March 28, 2025 12:29
This commit renames the original shouldPerformDiffInformedAnalysis(),
which returns `PullRequestBranches | undefined`, to
getDiffInformedAnalysisBranches(). It also adds a new
shouldPerformDiffInformedAnalysis() function that returns boolean.

Separating these two functions makes it clear what the intended uses and
return values should be for each.
cklin force-pushed the cklin/diff-informed-query-filtering branch from 1a1a4f3 to e4ca874 Compare March 28, 2025 19:30

cklin commented Mar 28, 2025

Copy link
Copy Markdown
Contributor Author

Thank you for your suggestions @angelapwen and @henrymercer!

I updated the PR, and there are now two helper functions.

  • shouldPerformDiffInformedAnalysis() returns Promise<boolean>
  • getDiffInformedAnalysisBranches() returns Promise<PullRequestBranches | undefined>

cklin requested a review from angelapwen March 28, 2025 19:32

angelapwen left a comment

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thank you 🙇‍♀️

cklin merged commit efffb48 into main Mar 31, 2025
cklin deleted the cklin/diff-informed-query-filtering branch March 31, 2025 15:00
github-actions Bot mentioned this pull request Apr 7, 2025
8 tasks
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL