Skip to content

C#: Freeze quality queries in the security-and-quality suite. #19713

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

michaelnebel
Copy link
Contributor

@michaelnebel michaelnebel commented Jun 10, 2025

Freeze the quality queries in security-and-quality for C# (to avoid accidentally adding new quality queries to this suite).

@github-actions github-actions bot added the C# label Jun 10, 2025
@michaelnebel michaelnebel added no-change-note-required This PR does not need a change note and removed C# labels Jun 10, 2025
@michaelnebel michaelnebel force-pushed the csharp/freezequalityinsecurityandquality branch from 752ae4d to a15b9a8 Compare June 10, 2025 11:34
@github-actions github-actions bot added the C# label Jun 10, 2025
@michaelnebel michaelnebel marked this pull request as ready for review June 10, 2025 12:55
@Copilot Copilot AI review requested due to automatic review settings June 10, 2025 12:55
@michaelnebel michaelnebel requested a review from a team as a code owner June 10, 2025 12:55
Copy link
Contributor

@Copilot Copilot AI 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 freezes the set of quality and security queries in the C# security-and-quality suite by replacing the broad selector with explicit include/exclude rules.

  • Replaces the wildcard queries: . selector with targeted include blocks for security and quality queries
  • Enumerates all query IDs explicitly to lock down suite contents
  • Adds exclude rules for deprecated, experimental, and model-related queries
Comments suppressed due to low confidence (1)

csharp/ql/src/codeql-suites/csharp-security-and-quality.qls:12

  • [nitpick] Consider adding a top-of-file comment explaining that this suite is intentionally frozen and must be updated manually, so future maintainers understand the rationale.
include:

Comment on lines +23 to +125
- cs/call-to-object-tostring
- cs/call-to-obsolete-method
- cs/call-to-unmanaged-code
- cs/cast-from-abstract-to-concrete-collection
- cs/cast-of-this-to-type-parameter
- cs/catch-nullreferenceexception
- cs/catch-of-all-exceptions
- cs/chained-type-tests
- cs/class-implements-icloneable
- cs/class-missing-equals
- cs/class-name-comparison
- cs/class-name-matches-base-class
- cs/coalesce-of-identical-expressions
- cs/comparison-of-identical-expressions
- cs/complex-block
- cs/complex-condition
- cs/constant-comparison
- cs/constant-condition
- cs/coupled-types
- cs/dereferenced-value-is-always-null
- cs/dereferenced-value-may-be-null
- cs/dispose-not-called-on-throw
- cs/downcast-of-this
- cs/empty-block
- cs/empty-catch-block
- cs/empty-collection
- cs/empty-lock-statement
- cs/equality-on-floats
- cs/equals-on-arrays
- cs/equals-on-unrelated-types
- cs/equals-uses-as
- cs/equals-uses-is
- cs/expose-implementation
- cs/field-masks-base-field
- cs/gethashcode-is-not-defined
- cs/impossible-array-cast
- cs/inconsistent-compareto-and-equals
- cs/inconsistent-equals-and-gethashcode
- cs/inconsistent-lock-sequence
- cs/index-out-of-bounds
- cs/inefficient-containskey
- cs/invalid-dynamic-call
- cs/invalid-string-formatting
- cs/linq/inconsistent-enumeration
- cs/linq/missed-all
- cs/linq/missed-cast
- cs/linq/missed-oftype
- cs/linq/missed-select
- cs/linq/missed-where
- cs/linq/useless-select
- cs/local-not-disposed
- cs/local-shadows-member
- cs/lock-this
- cs/locked-wait
- cs/loss-of-precision
- cs/mishandling-japanese-era
- cs/misleading-indentation
- cs/missed-readonly-modifier
- cs/missed-ternary-operator
- cs/missed-using-statement
- cs/nested-if-statements
- cs/nested-loops-with-same-variable
- cs/non-short-circuit
- cs/null-argument-to-equals
- cs/path-combine
- cs/recursive-equals-call
- cs/recursive-operator-equals-call
- cs/reference-equality-on-valuetypes
- cs/reference-equality-with-object
- cs/rethrown-exception-variable
- cs/self-assignment
- cs/simplifiable-boolean-expression
- cs/static-field-written-by-instance
- cs/string-concatenation-in-loop
- cs/stringbuilder-creation-in-loop
- cs/stringbuilder-initialized-with-character
- cs/test-for-negative-container-size
- cs/too-many-ref-parameters
- cs/type-test-of-this
- cs/unchecked-cast-in-equals
- cs/unmanaged-code
- cs/unsafe-double-checked-lock
- cs/unsafe-sync-on-field
- cs/unsafe-year-construction
- cs/unsynchronized-getter
- cs/unsynchronized-static-access
- cs/unused-collection
- cs/unused-label
- cs/unused-property-value
- cs/useless-assignment-to-local
- cs/useless-cast-to-self
- cs/useless-gethashcode-call
- cs/useless-if-statement
- cs/useless-tostring-call
- cs/useless-type-test
- cs/useless-upcast
- cs/virtual-call-in-constructor
- cs/wrong-compareto-signature
- cs/wrong-equals-signature
- cs/xmldoc/missing-summary
Copy link
Preview

Copilot AI Jun 10, 2025

Choose a reason for hiding this comment

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

Maintaining a manually curated list of 100+ query IDs is error-prone; consider generating this block via a script or shared selector to streamline updates and avoid omissions.

Suggested change
id:
- cs/asp/response-write
- cs/call-to-gc
- cs/call-to-object-tostring
- cs/call-to-obsolete-method
- cs/call-to-unmanaged-code
- cs/cast-from-abstract-to-concrete-collection
- cs/cast-of-this-to-type-parameter
- cs/catch-nullreferenceexception
- cs/catch-of-all-exceptions
- cs/chained-type-tests
- cs/class-implements-icloneable
- cs/class-missing-equals
- cs/class-name-comparison
- cs/class-name-matches-base-class
- cs/coalesce-of-identical-expressions
- cs/comparison-of-identical-expressions
- cs/complex-block
- cs/complex-condition
- cs/constant-comparison
- cs/constant-condition
- cs/coupled-types
- cs/dereferenced-value-is-always-null
- cs/dereferenced-value-may-be-null
- cs/dispose-not-called-on-throw
- cs/downcast-of-this
- cs/empty-block
- cs/empty-catch-block
- cs/empty-collection
- cs/empty-lock-statement
- cs/equality-on-floats
- cs/equals-on-arrays
- cs/equals-on-unrelated-types
- cs/equals-uses-as
- cs/equals-uses-is
- cs/expose-implementation
- cs/field-masks-base-field
- cs/gethashcode-is-not-defined
- cs/impossible-array-cast
- cs/inconsistent-compareto-and-equals
- cs/inconsistent-equals-and-gethashcode
- cs/inconsistent-lock-sequence
- cs/index-out-of-bounds
- cs/inefficient-containskey
- cs/invalid-dynamic-call
- cs/invalid-string-formatting
- cs/linq/inconsistent-enumeration
- cs/linq/missed-all
- cs/linq/missed-cast
- cs/linq/missed-oftype
- cs/linq/missed-select
- cs/linq/missed-where
- cs/linq/useless-select
- cs/local-not-disposed
- cs/local-shadows-member
- cs/lock-this
- cs/locked-wait
- cs/loss-of-precision
- cs/mishandling-japanese-era
- cs/misleading-indentation
- cs/missed-readonly-modifier
- cs/missed-ternary-operator
- cs/missed-using-statement
- cs/nested-if-statements
- cs/nested-loops-with-same-variable
- cs/non-short-circuit
- cs/null-argument-to-equals
- cs/path-combine
- cs/recursive-equals-call
- cs/recursive-operator-equals-call
- cs/reference-equality-on-valuetypes
- cs/reference-equality-with-object
- cs/rethrown-exception-variable
- cs/self-assignment
- cs/simplifiable-boolean-expression
- cs/static-field-written-by-instance
- cs/string-concatenation-in-loop
- cs/stringbuilder-creation-in-loop
- cs/stringbuilder-initialized-with-character
- cs/test-for-negative-container-size
- cs/too-many-ref-parameters
- cs/type-test-of-this
- cs/unchecked-cast-in-equals
- cs/unmanaged-code
- cs/unsafe-double-checked-lock
- cs/unsafe-sync-on-field
- cs/unsafe-year-construction
- cs/unsynchronized-getter
- cs/unsynchronized-static-access
- cs/unused-collection
- cs/unused-label
- cs/unused-property-value
- cs/useless-assignment-to-local
- cs/useless-cast-to-self
- cs/useless-gethashcode-call
- cs/useless-if-statement
- cs/useless-tostring-call
- cs/useless-type-test
- cs/useless-upcast
- cs/virtual-call-in-constructor
- cs/wrong-compareto-signature
- cs/wrong-equals-signature
- cs/xmldoc/missing-summary
kind:
- problem
- path-problem
precision:
- high
- very-high
- medium
problem.severity:
- error
- warning
tags contain:
- security
- quality

Copilot uses AI. Check for mistakes.

@michaelnebel michaelnebel merged commit dc81f5a into github:main Jun 10, 2025
17 checks passed
@michaelnebel michaelnebel deleted the csharp/freezequalityinsecurityandquality branch June 10, 2025 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C# no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants