Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Produce separate SARIF file forquality-queries alerts#2935

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mbg merged 29 commits intomainfrommbg/interpret-cq-results
Jun 27, 2025

Conversation

mbg
Copy link
Member

@mbgmbg commentedJun 16, 2025
edited
Loading

Follows on from#2917.

This PR modifies the action to produce separate SARIF files for code quality queries (as specified as arguments to thequality-queries input) and uploads them to the code quality API. The approach here is that:

  • We remove the logic fromAdd newquality-queries input #2917 that adds thequality-queries input to the code scanning configuration file that's used when initialising the database.
  • That means that the quality queries are no longer included in theconfig-queries.qls that's generated by the CLI.
  • When we calldatabase run-queries, and if quality queries are enabled, we explicitly specifyconfig-queries.qls (which the CLI normally does by default if nothing is specified) + the quality queries.
  • Since the quality queries are only specified as argument todatabase run-queries, the existing call todatabase interpret-results generates a SARIF that only includes results relating to security queries (i.e.config-queries.qls).
  • We make an additional call todatabase interpret-results for queries that were specified as arguments to thequality-queries input (if any). This results in SARIF files for those queries.
  • We then upload them to the CQ API endpoint.

Notes

  • The changes aim to be as backwards-compatible as possible. That includes:
    • SARIF files are output to the same place as before (e.g. as opposed to having separate subdirectories for security and quality SARIFs). SARIF files containing quality results are identified by the.quality.sarif extension.
  • We don't supportquery-filter options with respect to code quality results.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm thereadme has been updated if necessary.
  • Confirm thechangelog has been updated if necessary.

@mbgmbgforce-pushed thembg/interpret-cq-results branch 2 times, most recently from87b6687 tofe76653CompareJune 17, 2025 13:37
@mbgmbgforce-pushed thembg/interpret-cq-results branch from2bf7322 to24e4f58CompareJune 23, 2025 17:35
@mbgmbgforce-pushed thembg/interpret-cq-results branch from7e59f77 tof7fbaa0CompareJune 24, 2025 12:09
@mbgmbg marked this pull request as ready for reviewJune 24, 2025 13:08
@mbgmbg requested a review froma team as acode ownerJune 24, 2025 13:08
@mbgmbg requested a review fromCopilotJune 24, 2025 13:09
Copy link
Contributor

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables separate generation and upload of SARIF files for code-quality queries specified via thequality-queries input, in addition to the existing code-scanning SARIF flow.

  • IntroducesSARIF_UPLOAD_TARGET enum andUploadTarget interface to distinguish code scanning vs. code quality uploads.
  • Extends file discovery (findSarifFilesInDir,getSarifFilePaths) and upload logic (uploadFiles,uploadPayload,validateUniqueCategory) to filter and handle.quality.sarif files.
  • Updatesanalyze.ts/analyze-action.ts to produce and upload quality SARIFs whenquality-queries are provided, and adjusts CI workflows to upload/check both SARIF artifacts.

Reviewed Changes

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

Show a summary per file
FileDescription
src/upload-lib.tsAdded enum and targets for separate SARIF uploads, filtering logic for.quality.sarif.
src/upload-lib.test.tsAdded tests for filtering.quality.sarif files andvalidateUniqueCategory prefix.
src/analyze.tsIntroduced default query suites andresolveQuerySuiteAlias; generate quality SARIF.
src/analyze.test.tsAdded tests forresolveQuerySuiteAlias.
src/analyze-action.tsUploads quality SARIF and setsquality-sarif-id output whenquality-queries present.
pr-checks/checks/quality-queries.ymlCI updates to upload security vs. quality SARIF artifacts and adjust checks.
Comments suppressed due to low confidence (2)

src/upload-lib.ts:427

  • ThegetSarifFilePaths function bypasses theisSarif filter whensarifPath is a single file. This can lead to uploading unwanted files (e.g., a.quality.sarif when targeting code-scanning). ApplyisSarif to the single-file case or throw if it does not match.
    sarifFiles = [sarifPath];

pr-checks/checks/quality-queries.yml:29

  • [nitpick] The CI step now only checks config properties in the quality SARIF, omitting the original security SARIF check. Consider adding a separate check for${{ runner.temp }}/results/javascript.sarif to ensure both artifacts are validated.
      SARIF_PATH: "${{ runner.temp }}/results/javascript.quality.sarif"

@mbgmbgforce-pushed thembg/interpret-cq-results branch 2 times, most recently from3393b4e to81969d7CompareJune 25, 2025 13:24
@mbgmbgforce-pushed thembg/interpret-cq-results branch 2 times, most recently from4088317 tob403ba2CompareJune 25, 2025 13:38
@mbgmbgforce-pushed thembg/interpret-cq-results branch fromb403ba2 to79049d9CompareJune 25, 2025 13:42
Copy link
Contributor

@esbenaesbena left a comment

Choose a reason for hiding this comment

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

Nice, and pleasantly surgical.

I think this does the right thing, except for a missing quality.sarif predicate in the very end.

Other than that it's mostly nits, and some concerns about maintenance in the long term. We have already discussed them elsewhere. Perhaps we should update the discussion document with our current choice for query resolution.

@@ -567,6 +581,30 @@ export function buildPayload(
returnpayloadObj;
}

// Represents configurations for different services that we can upload SARIF to.
exportinterfaceUploadTarget{
Copy link
Contributor

Choose a reason for hiding this comment

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

regarding the target/endpoint comment above: this is a much better place to call something target. I'd probably preferSarifUploadConfig but that is splitting hairs.

sentinelPrefix:string;
}

// Represents the Code Scanning upload target.
Copy link
Contributor

Choose a reason for hiding this comment

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

Stray thought. I have seen both line comments and jsdoc comments on your new functions. Is it deliberate that you do not use jsdoc here? If yes, OK.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I think the existing codebase is fairly inconsistent in this regard. I probably just subconsciously mirrored what adjacent definitions do. I'll make this more consistent for my changes.

@mbgmbg mentioned this pull requestJun 26, 2025
3 tasks
@mbgmbgforce-pushed thembg/interpret-cq-results branch froma4d5138 to362ebf8CompareJune 27, 2025 11:33
@mbgmbg requested a review fromesbenaJune 27, 2025 11:42
esbena
esbena previously approved these changesJun 27, 2025
Copy link
Contributor

@esbenaesbena left a comment

Choose a reason for hiding this comment

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

thanks! There's one naming nit left, but it is quite minor.

@mbgmbg requested a review fromesbenaJune 27, 2025 12:50
@mbgmbgenabled auto-mergeJune 27, 2025 12:51
@mbgmbg merged commit4c57370 intomainJun 27, 2025
282 checks passed
@mbgmbg deleted the mbg/interpret-cq-results branchJune 27, 2025 13:03
@github-actionsgithub-actionsbot mentioned this pull requestJun 30, 2025
8 tasks
@jsoref
Copy link
Contributor

This appears to talk about another github api endpoint. Is it documented / will it be documented?

@mbg
Copy link
MemberAuthor

mbg commentedJul 7, 2025

@jsoref It is not documented. This is part of an internal experiment and so is no use to anyone but us right now.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

@esbenaesbenaesbena approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@mbg@jsoref@esbena

[8]ページ先頭

©2009-2025 Movatter.jp