-
Notifications
You must be signed in to change notification settings - Fork 1.7k
C#: Mass add quality queries to the Code Quality suite. #19783
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
f8d8e67
to
d296ee7
Compare
Compared the number of alerts pr query for traced / buildless on approximately the same set of projects (the traced include dotnet/runtime by mistake - but then had other 15 overlapping projects). There doesn't appear to be a difference in the total number of alerts that are off by an order of magnitude (eg. 10x+) for any query, except for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds high-precision C# quality queries to the Code Quality suite and aligns all query metadata tags with the official style guide.
- Systematically updates each query’s
@tags
to include the genericquality
tag, a primary category (maintainability
orreliability
), and relevant sub-categories. - Introduces a new change-notes entry summarizing the tagging updates.
- Updates the
csharp-code-quality.qls.expected
integration test to include all newly tagged queries.
Reviewed Changes
Copilot reviewed 79 out of 79 changed files in this pull request and generated no comments.
File | Description |
---|---|
csharp/ql/src/change-notes/2025-06-16-tagging.md | Add change-notes entry summarizing the metadata tagging changes |
csharp/ql/src/**/*.ql | Retag queries with quality plus appropriate primary/sub-category tags |
csharp/ql/integration-tests/posix/query-suite/csharp-code-quality.qls.expected | Extend expected suite listing to include newly added queries |
Comments suppressed due to low confidence (6)
csharp/ql/src/change-notes/2025-06-16-tagging.md:1
- Consider adding a
title
field in the front-matter (e.g.,title: "2025-06-16 Tagging Update"
) to follow the pattern used by other change-notes and improve discoverability.
---
csharp/ql/src/Language Abuse/ChainedIs.ql:6
- Per the PR description,
cs/chained-type-tests
should be configurable and not added. Please remove the tag changes for this query.
* @id cs/chained-type-tests
csharp/ql/integration-tests/posix/query-suite/csharp-code-quality.qls.expected:1
- [nitpick] The expected suite list has many new entries; consider sorting them alphabetically (or grouping by category) to maintain readability and reduce merge conflicts.
ql/csharp/ql/src/API Abuse/CallToGCCollect.ql
csharp/ql/src/Complexity/ComplexCondition.ql:8
- The PR description states that
cs/complex-condition
should be excluded from the suite; this change re-tags it. Please remove or revert the tag updates for this query to honor the exclusion.
* @tags maintainability
csharp/ql/src/Complexity/BlockWithTooManyStatements.ql:12
- According to the PR description,
cs/complex-block
should not be added to the suite. These tag changes should be reverted for this query.
* testability
csharp/ql/src/Bad Practices/Declarations/TooManyRefParameters.ql:9
- The PR description excludes
cs/too-many-ref-parameters
; this retagging contradicts that. Please revert these metadata updates.
* @tags maintainability
ql/csharp/ql/src/API Abuse/FormatInvalid.ql | ||
ql/csharp/ql/src/API Abuse/NoDisposeCallOnLocalIDisposable.ql | ||
ql/csharp/ql/src/API Abuse/NullArgumentToEquals.ql | ||
ql/csharp/ql/src/ASP/BlockCodeResponseWrite.ql | ||
ql/csharp/ql/src/Architecture/Refactoring Opportunities/InappropriateIntimacy.ql |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This query also uses a hardcoded threshold. I wouldn't include it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right! I missed that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
In this PR we
high
orvery-high
are now included in the Code Quality suite except for some queries that should be configurable. The following queries were not addedcs/too-many-ref-parameters
cs/complex-block
cs/complex-condition
cs/chained-type-tests
cs/coupled-types
The changes were made using Co-Pilot agent mode and the prompt:
Find the queries with the following IDs
<List of query IDS>
Please change the query metadata in the following way