C#: Add cs/gethashcode-is-not-defined to the Code Quality suite.#19716
Merged
michaelnebel merged 1 commit intogithub:mainfrom Jun 17, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds the new cs/gethashcode-is-not-defined query to the Code Quality suite.
- Updated the query metadata to include the "quality" tag.
- Added the query to the
csharp-code-quality.qls.expectedintegration-test listing.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| csharp/ql/src/Likely Bugs/HashedButNoHash.ql | Added quality tag to query metadata |
| csharp/ql/integration-tests/posix/query-suite/csharp-code-quality.qls.expected | Listed the new query in the expected Code Quality suite |
Comments suppressed due to low confidence (3)
csharp/ql/integration-tests/posix/query-suite/csharp-code-quality.qls.expected:11
- Add corresponding integration test cases or sample code to validate that
cs/gethashcode-is-not-definedtriggers as expected in the suite.
ql/csharp/ql/src/Likely Bugs/HashedButNoHash.ql
csharp/ql/integration-tests/posix/query-suite/csharp-code-quality.qls.expected:11
- Ensure this query is also added to all other platform-specific suite definitions (e.g., Windows and macOS) to keep test coverage consistent across environments.
ql/csharp/ql/src/Likely Bugs/HashedButNoHash.ql
csharp/ql/src/Likely Bugs/HashedButNoHash.ql:10
- [nitpick] Align the indentation of the newly added "quality" tag with the existing tags to maintain consistent formatting.
* quality
tamasvajk
approved these changes
Jun 11, 2025
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.
In this PR we add the query
cs/gethashcode-is-not-definedto the Code Quality suite.It is worth mentioning that
Equalsmethod is overridden, but where theGetHashCodeis not. Our query is a bit more conservative in its approach by only reporting such types, if they are used in a hashing context.HashCode.Combineto create a decent hash function).DCA looks good.