-
-
Notifications
You must be signed in to change notification settings - Fork 63
Add MA0180: Detect ILogger<T> type parameter mismatch with containing class #941
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
Co-authored-by: meziantou <[email protected]>
Co-authored-by: meziantou <[email protected]>
Co-authored-by: meziantou <[email protected]>
Co-authored-by: meziantou <[email protected]>
|
@copilot The tests are failing because the diagnostic is not at the right location. The test expect on the type whereas it's reported on the parameter name. Can you fix it? |
Co-authored-by: meziantou <[email protected]>
Fixed in ea8c591. The diagnostic now reports on the type syntax (ILogger) instead of the entire parameter by using DeclaringSyntaxReferences to access ParameterSyntax.Type.GetLocation(). |
|
@copilot Can you use DiagnosticParameterReportOptions.ReportOnType instead of a custom logic |
…ogic Co-authored-by: meziantou <[email protected]>
|
@copilot can you regenerate the documentation, it seems the formatting is not ok |
Co-authored-by: meziantou <[email protected]>
|
@copilot Now the tests are failing for older targets. Can you surround the tests using primary constructor with #if CSHARP12_OR_GREATER |
Co-authored-by: meziantou <[email protected]>
Done in beff2ec. Wrapped all 6 primary constructor tests with |
Updated [Meziantou.Analyzer](https://github.com/meziantou/Meziantou.Analyzer) from 2.0.257 to 2.0.263. <details> <summary>Release notes</summary> _Sourced from [Meziantou.Analyzer's releases](https://github.com/meziantou/Meziantou.Analyzer/releases)._ ## 2.0.263 NuGet package: <https://www.nuget.org/packages/Meziantou.Analyzer/2.0.263> ## What's Changed * Add MA0180: Detect ILogger<T> type parameter mismatch with containing class by @Copilot in meziantou/Meziantou.Analyzer#941 **Full Changelog**: meziantou/Meziantou.Analyzer@2.0.262...2.0.263 ## 2.0.262 NuGet package: <https://www.nuget.org/packages/Meziantou.Analyzer/2.0.262> ## What's Changed * Make DocumentationGenerator ignore trailing whitespace differences by @Copilot in meziantou/Meziantou.Analyzer#942 **Full Changelog**: meziantou/Meziantou.Analyzer@2.0.261...2.0.262 ## 2.0.261 NuGet package: <https://www.nuget.org/packages/Meziantou.Analyzer/2.0.261> ## What's Changed * Add MA0179: Detect inefficient attribute existence checks by @Copilot in meziantou/Meziantou.Analyzer#939 **Full Changelog**: meziantou/Meziantou.Analyzer@2.0.260...2.0.261 ## 2.0.260 NuGet package: <https://www.nuget.org/packages/Meziantou.Analyzer/2.0.260> ## What's Changed * Add concurrency control to serialize CI runs on main branch by @Copilot in meziantou/Meziantou.Analyzer#938 **Full Changelog**: meziantou/Meziantou.Analyzer@2.0.259...2.0.260 ## 2.0.259 NuGet package: <https://www.nuget.org/packages/Meziantou.Analyzer/2.0.259> ## What's Changed * Add opt-in configuration for MA0153 to detect logging of types containing DataClassification members by @Copilot in meziantou/Meziantou.Analyzer#936 **Full Changelog**: meziantou/Meziantou.Analyzer@2.0.258...2.0.259 ## 2.0.258 NuGet package: <https://www.nuget.org/packages/Meziantou.Analyzer/2.0.258> **Full Changelog**: meziantou/Meziantou.Analyzer@2.0.257...2.0.258 Commits viewable in [compare view](meziantou/Meziantou.Analyzer@2.0.257...2.0.263). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Implementation Complete ✅
New analyzer MA0180 has been successfully implemented to detect inconsistencies between containing classes and ILogger type parameters.
Completed Tasks:
Recent Changes:
#if CSHARP12_OR_GREATERdirectivesOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.