Use WellKnownTypeProvider + KnownSymbols pattern to simplify analyzers#245
Conversation
Specifically in this case I need `ConcurrentDictionary.GetOrAdd`3`.
|
Caution Review failedThe pull request is closed. 📝 Walkthrough📝 WalkthroughWalkthroughThe pull request introduces several changes across various files, primarily focusing on enhancements to code analysis capabilities. Key modifications include the addition of a new package reference for Changes
Possibly related PRs
Suggested labels
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Reviewers note: Reviewing by commit makes each refactor clearer. I do however understand this is a larger change, so if there's things to pull out into separate PRs let me know. |
There was a problem hiding this comment.
Actionable comments posted: 31
🧹 Outside diff range comments (4)
src/CodeFixes/CallbackSignatureShouldMatchMockedMethodCodeFix.cs (1)
Line range hint
67-71: Strengthen null handling and array bounds checkingThere are several potential issues in this code segment:
- The Debug.Assert won't protect against null in release builds
- The array access at index 0 could throw if the array is empty
Consider this more defensive approach:
InvocationExpressionSyntax? setupMethodInvocation = semanticModel.FindSetupMethodFromCallbackInvocation(knownSymbols, callbackInvocation, cancellationToken); - Debug.Assert(setupMethodInvocation != null, nameof(setupMethodInvocation) + " != null"); + if (setupMethodInvocation is null) + { + return document; + } IMethodSymbol[] matchingMockedMethods = semanticModel.GetAllMatchingMockedMethodSymbolsFromSetupMethodInvocation(setupMethodInvocation).ToArray(); - if (matchingMockedMethods.Length != 1) + if (matchingMockedMethods.Length == 0 || matchingMockedMethods.Length > 1) { return document; }src/Analyzers/SetupShouldBeUsedOnlyForOverridableMembersAnalyzer.cs (2)
Line range hint
100-116: Consider extracting the "Result" string as a constant.The property name "Result" appears to be a well-known value. Consider extracting it as a private constant to improve maintainability.
+ private const string TaskResultPropertyName = "Result"; + private static bool IsTaskResultProperty(IPropertySymbol propertySymbol, MoqKnownSymbols knownSymbols) { // Check if the property is named "Result" - if (!string.Equals(propertySymbol.Name, "Result", StringComparison.Ordinal)) + if (!string.Equals(propertySymbol.Name, TaskResultPropertyName, StringComparison.Ordinal)) { return false; }
Line range hint
109-116: Consider reordering the null checks.The null check for
taskOfTTypecould be moved before the property name check to fail fast and improve readability.private static bool IsTaskResultProperty(IPropertySymbol propertySymbol, MoqKnownSymbols knownSymbols) { + // Check if Task<T> type is available + INamedTypeSymbol? taskOfTType = knownSymbols.Task1; + if (taskOfTType == null) + { + return false; // If Task<T> type cannot be found, we skip it + } + // Check if the property is named "Result" if (!string.Equals(propertySymbol.Name, "Result", StringComparison.Ordinal)) { return false; } - // Check if the containing type is Task<T> - INamedTypeSymbol? taskOfTType = knownSymbols.Task1; - - if (taskOfTType == null) - { - return false; // If Task<T> type cannot be found, we skip it - } - return SymbolEqualityComparer.Default.Equals(propertySymbol.ContainingType, taskOfTType); }src/Analyzers/ConstructorArgumentsShouldMatchAnalyzer.cs (1)
Line range hint
283-338: RefactorAnyConstructorsFoundmethod for better maintainabilityThe
AnyConstructorsFoundmethod is lengthy and complex, which can make it hard to read and maintain. Breaking it down into smaller helper methods can improve readability and facilitate testing.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (32)
- build/targets/codeanalysis/CodeAnalysis.props (1 hunks)
- build/targets/codeanalysis/Packages.props (1 hunks)
- build/targets/compiler/Compiler.props (1 hunks)
- build/targets/compiler/Packages.props (1 hunks)
- src/Analyzers/AsShouldBeUsedOnlyForInterfaceAnalyzer.cs (1 hunks)
- src/Analyzers/CallbackSignatureShouldMatchMockedMethodAnalyzer.cs (2 hunks)
- src/Analyzers/ConstructorArgumentsShouldMatchAnalyzer.cs (5 hunks)
- src/Analyzers/SetExplicitMockBehaviorAnalyzer.cs (1 hunks)
- src/Analyzers/SetupShouldBeUsedOnlyForOverridableMembersAnalyzer.cs (5 hunks)
- src/Analyzers/SetupShouldNotIncludeAsyncResultAnalyzer.cs (1 hunks)
- src/Analyzers/SquiggleCop.Baseline.yaml (5 hunks)
- src/BannedSymbols.txt (1 hunks)
- src/CodeFixes/CallbackSignatureShouldMatchMockedMethodCodeFix.cs (1 hunks)
- src/CodeFixes/SquiggleCop.Baseline.yaml (5 hunks)
- src/Common/Caching/BoundedCacheWithFactory.cs (1 hunks)
- src/Common/CompilationExtensions.cs (0 hunks)
- src/Common/EnumerableExtensions.cs (1 hunks)
- src/Common/GlobalUsings.cs (1 hunks)
- src/Common/ISymbolExtensions.cs (2 hunks)
- src/Common/ITypeSymbolExtensions.cs (1 hunks)
- src/Common/MoqMethodDescriptorBase.cs (0 hunks)
- src/Common/MoqSetupMethodDescriptor.cs (0 hunks)
- src/Common/SemanticModelExtensions.cs (2 hunks)
- src/Common/SymbolVisibility.cs (1 hunks)
- src/Common/WellKnown/KnownSymbols.cs (1 hunks)
- src/Common/WellKnown/MoqKnownSymbolExtensions.cs (1 hunks)
- src/Common/WellKnown/MoqKnownSymbols.cs (1 hunks)
- src/Common/WellKnown/WellKnownTypeProvider.cs (1 hunks)
- src/Common/WellKnownMoqNames.cs (0 hunks)
- tests/Moq.Analyzers.Benchmarks/SquiggleCop.Baseline.yaml (2 hunks)
- tests/Moq.Analyzers.Test.Analyzers/SquiggleCop.Baseline.yaml (4 hunks)
- tests/Moq.Analyzers.Test/SquiggleCop.Baseline.yaml (2 hunks)
💤 Files with no reviewable changes (4)
- src/Common/CompilationExtensions.cs
- src/Common/MoqMethodDescriptorBase.cs
- src/Common/MoqSetupMethodDescriptor.cs
- src/Common/WellKnownMoqNames.cs
🧰 Additional context used
📓 Path-based instructions (18)
src/Analyzers/AsShouldBeUsedOnlyForInterfaceAnalyzer.cs (1)
Pattern
**/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.I suspect the bugs are related to:
- Incorrect handling of edge cases
- Off-by-one errors in loops or array indexing
- Unexpected data types
- Uncaught exceptions
- Concurrency issues
- Improper configuration settings
To diagnose:
- Review the code carefully and systematically
- Trace the relevant code paths
- Consider boundary conditions and potential error states
- Look for antipatterns that tend to cause bugs
- Run the code mentally with example inputs
- Think about interactions between components
When you find potential bugs, for each one provide:
- File path and line number(s)
- Description of the issue and why it's a bug
- Example input that would trigger the bug
- Suggestions for how to fix it
After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.
I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.
src/Analyzers/CallbackSignatureShouldMatchMockedMethodAnalyzer.cs (1)
Pattern
**/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.I suspect the bugs are related to:
- Incorrect handling of edge cases
- Off-by-one errors in loops or array indexing
- Unexpected data types
- Uncaught exceptions
- Concurrency issues
- Improper configuration settings
To diagnose:
- Review the code carefully and systematically
- Trace the relevant code paths
- Consider boundary conditions and potential error states
- Look for antipatterns that tend to cause bugs
- Run the code mentally with example inputs
- Think about interactions between components
When you find potential bugs, for each one provide:
- File path and line number(s)
- Description of the issue and why it's a bug
- Example input that would trigger the bug
- Suggestions for how to fix it
After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.
I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.
src/Analyzers/ConstructorArgumentsShouldMatchAnalyzer.cs (1)
Pattern
**/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.I suspect the bugs are related to:
- Incorrect handling of edge cases
- Off-by-one errors in loops or array indexing
- Unexpected data types
- Uncaught exceptions
- Concurrency issues
- Improper configuration settings
To diagnose:
- Review the code carefully and systematically
- Trace the relevant code paths
- Consider boundary conditions and potential error states
- Look for antipatterns that tend to cause bugs
- Run the code mentally with example inputs
- Think about interactions between components
When you find potential bugs, for each one provide:
- File path and line number(s)
- Description of the issue and why it's a bug
- Example input that would trigger the bug
- Suggestions for how to fix it
After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.
I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.
src/Analyzers/SetExplicitMockBehaviorAnalyzer.cs (1)
Pattern
**/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.I suspect the bugs are related to:
- Incorrect handling of edge cases
- Off-by-one errors in loops or array indexing
- Unexpected data types
- Uncaught exceptions
- Concurrency issues
- Improper configuration settings
To diagnose:
- Review the code carefully and systematically
- Trace the relevant code paths
- Consider boundary conditions and potential error states
- Look for antipatterns that tend to cause bugs
- Run the code mentally with example inputs
- Think about interactions between components
When you find potential bugs, for each one provide:
- File path and line number(s)
- Description of the issue and why it's a bug
- Example input that would trigger the bug
- Suggestions for how to fix it
After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.
I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.
src/Analyzers/SetupShouldBeUsedOnlyForOverridableMembersAnalyzer.cs (1)
Pattern
**/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.I suspect the bugs are related to:
- Incorrect handling of edge cases
- Off-by-one errors in loops or array indexing
- Unexpected data types
- Uncaught exceptions
- Concurrency issues
- Improper configuration settings
To diagnose:
- Review the code carefully and systematically
- Trace the relevant code paths
- Consider boundary conditions and potential error states
- Look for antipatterns that tend to cause bugs
- Run the code mentally with example inputs
- Think about interactions between components
When you find potential bugs, for each one provide:
- File path and line number(s)
- Description of the issue and why it's a bug
- Example input that would trigger the bug
- Suggestions for how to fix it
After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.
I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.
src/Analyzers/SetupShouldNotIncludeAsyncResultAnalyzer.cs (1)
Pattern
**/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.I suspect the bugs are related to:
- Incorrect handling of edge cases
- Off-by-one errors in loops or array indexing
- Unexpected data types
- Uncaught exceptions
- Concurrency issues
- Improper configuration settings
To diagnose:
- Review the code carefully and systematically
- Trace the relevant code paths
- Consider boundary conditions and potential error states
- Look for antipatterns that tend to cause bugs
- Run the code mentally with example inputs
- Think about interactions between components
When you find potential bugs, for each one provide:
- File path and line number(s)
- Description of the issue and why it's a bug
- Example input that would trigger the bug
- Suggestions for how to fix it
After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.
I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.
src/CodeFixes/CallbackSignatureShouldMatchMockedMethodCodeFix.cs (1)
Pattern
**/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.I suspect the bugs are related to:
- Incorrect handling of edge cases
- Off-by-one errors in loops or array indexing
- Unexpected data types
- Uncaught exceptions
- Concurrency issues
- Improper configuration settings
To diagnose:
- Review the code carefully and systematically
- Trace the relevant code paths
- Consider boundary conditions and potential error states
- Look for antipatterns that tend to cause bugs
- Run the code mentally with example inputs
- Think about interactions between components
When you find potential bugs, for each one provide:
- File path and line number(s)
- Description of the issue and why it's a bug
- Example input that would trigger the bug
- Suggestions for how to fix it
After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.
I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.
src/Common/Caching/BoundedCacheWithFactory.cs (1)
Pattern
**/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.I suspect the bugs are related to:
- Incorrect handling of edge cases
- Off-by-one errors in loops or array indexing
- Unexpected data types
- Uncaught exceptions
- Concurrency issues
- Improper configuration settings
To diagnose:
- Review the code carefully and systematically
- Trace the relevant code paths
- Consider boundary conditions and potential error states
- Look for antipatterns that tend to cause bugs
- Run the code mentally with example inputs
- Think about interactions between components
When you find potential bugs, for each one provide:
- File path and line number(s)
- Description of the issue and why it's a bug
- Example input that would trigger the bug
- Suggestions for how to fix it
After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.
I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.
src/Common/EnumerableExtensions.cs (1)
Pattern
**/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.I suspect the bugs are related to:
- Incorrect handling of edge cases
- Off-by-one errors in loops or array indexing
- Unexpected data types
- Uncaught exceptions
- Concurrency issues
- Improper configuration settings
To diagnose:
- Review the code carefully and systematically
- Trace the relevant code paths
- Consider boundary conditions and potential error states
- Look for antipatterns that tend to cause bugs
- Run the code mentally with example inputs
- Think about interactions between components
When you find potential bugs, for each one provide:
- File path and line number(s)
- Description of the issue and why it's a bug
- Example input that would trigger the bug
- Suggestions for how to fix it
After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.
I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.
src/Common/GlobalUsings.cs (1)
Pattern
**/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.I suspect the bugs are related to:
- Incorrect handling of edge cases
- Off-by-one errors in loops or array indexing
- Unexpected data types
- Uncaught exceptions
- Concurrency issues
- Improper configuration settings
To diagnose:
- Review the code carefully and systematically
- Trace the relevant code paths
- Consider boundary conditions and potential error states
- Look for antipatterns that tend to cause bugs
- Run the code mentally with example inputs
- Think about interactions between components
When you find potential bugs, for each one provide:
- File path and line number(s)
- Description of the issue and why it's a bug
- Example input that would trigger the bug
- Suggestions for how to fix it
After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.
I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.
src/Common/ISymbolExtensions.cs (1)
Pattern
**/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.I suspect the bugs are related to:
- Incorrect handling of edge cases
- Off-by-one errors in loops or array indexing
- Unexpected data types
- Uncaught exceptions
- Concurrency issues
- Improper configuration settings
To diagnose:
- Review the code carefully and systematically
- Trace the relevant code paths
- Consider boundary conditions and potential error states
- Look for antipatterns that tend to cause bugs
- Run the code mentally with example inputs
- Think about interactions between components
When you find potential bugs, for each one provide:
- File path and line number(s)
- Description of the issue and why it's a bug
- Example input that would trigger the bug
- Suggestions for how to fix it
After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.
I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.
src/Common/ITypeSymbolExtensions.cs (1)
Pattern
**/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.I suspect the bugs are related to:
- Incorrect handling of edge cases
- Off-by-one errors in loops or array indexing
- Unexpected data types
- Uncaught exceptions
- Concurrency issues
- Improper configuration settings
To diagnose:
- Review the code carefully and systematically
- Trace the relevant code paths
- Consider boundary conditions and potential error states
- Look for antipatterns that tend to cause bugs
- Run the code mentally with example inputs
- Think about interactions between components
When you find potential bugs, for each one provide:
- File path and line number(s)
- Description of the issue and why it's a bug
- Example input that would trigger the bug
- Suggestions for how to fix it
After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.
I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.
src/Common/SemanticModelExtensions.cs (1)
Pattern
**/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.I suspect the bugs are related to:
- Incorrect handling of edge cases
- Off-by-one errors in loops or array indexing
- Unexpected data types
- Uncaught exceptions
- Concurrency issues
- Improper configuration settings
To diagnose:
- Review the code carefully and systematically
- Trace the relevant code paths
- Consider boundary conditions and potential error states
- Look for antipatterns that tend to cause bugs
- Run the code mentally with example inputs
- Think about interactions between components
When you find potential bugs, for each one provide:
- File path and line number(s)
- Description of the issue and why it's a bug
- Example input that would trigger the bug
- Suggestions for how to fix it
After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.
I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.
src/Common/SymbolVisibility.cs (1)
Pattern
**/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.I suspect the bugs are related to:
- Incorrect handling of edge cases
- Off-by-one errors in loops or array indexing
- Unexpected data types
- Uncaught exceptions
- Concurrency issues
- Improper configuration settings
To diagnose:
- Review the code carefully and systematically
- Trace the relevant code paths
- Consider boundary conditions and potential error states
- Look for antipatterns that tend to cause bugs
- Run the code mentally with example inputs
- Think about interactions between components
When you find potential bugs, for each one provide:
- File path and line number(s)
- Description of the issue and why it's a bug
- Example input that would trigger the bug
- Suggestions for how to fix it
After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.
I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.
src/Common/WellKnown/KnownSymbols.cs (1)
Pattern
**/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.I suspect the bugs are related to:
- Incorrect handling of edge cases
- Off-by-one errors in loops or array indexing
- Unexpected data types
- Uncaught exceptions
- Concurrency issues
- Improper configuration settings
To diagnose:
- Review the code carefully and systematically
- Trace the relevant code paths
- Consider boundary conditions and potential error states
- Look for antipatterns that tend to cause bugs
- Run the code mentally with example inputs
- Think about interactions between components
When you find potential bugs, for each one provide:
- File path and line number(s)
- Description of the issue and why it's a bug
- Example input that would trigger the bug
- Suggestions for how to fix it
After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.
I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.
src/Common/WellKnown/MoqKnownSymbolExtensions.cs (1)
Pattern
**/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.I suspect the bugs are related to:
- Incorrect handling of edge cases
- Off-by-one errors in loops or array indexing
- Unexpected data types
- Uncaught exceptions
- Concurrency issues
- Improper configuration settings
To diagnose:
- Review the code carefully and systematically
- Trace the relevant code paths
- Consider boundary conditions and potential error states
- Look for antipatterns that tend to cause bugs
- Run the code mentally with example inputs
- Think about interactions between components
When you find potential bugs, for each one provide:
- File path and line number(s)
- Description of the issue and why it's a bug
- Example input that would trigger the bug
- Suggestions for how to fix it
After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.
I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.
src/Common/WellKnown/MoqKnownSymbols.cs (1)
Pattern
**/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.I suspect the bugs are related to:
- Incorrect handling of edge cases
- Off-by-one errors in loops or array indexing
- Unexpected data types
- Uncaught exceptions
- Concurrency issues
- Improper configuration settings
To diagnose:
- Review the code carefully and systematically
- Trace the relevant code paths
- Consider boundary conditions and potential error states
- Look for antipatterns that tend to cause bugs
- Run the code mentally with example inputs
- Think about interactions between components
When you find potential bugs, for each one provide:
- File path and line number(s)
- Description of the issue and why it's a bug
- Example input that would trigger the bug
- Suggestions for how to fix it
After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.
I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.
src/Common/WellKnown/WellKnownTypeProvider.cs (1)
Pattern
**/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.I suspect the bugs are related to:
- Incorrect handling of edge cases
- Off-by-one errors in loops or array indexing
- Unexpected data types
- Uncaught exceptions
- Concurrency issues
- Improper configuration settings
To diagnose:
- Review the code carefully and systematically
- Trace the relevant code paths
- Consider boundary conditions and potential error states
- Look for antipatterns that tend to cause bugs
- Run the code mentally with example inputs
- Think about interactions between components
When you find potential bugs, for each one provide:
- File path and line number(s)
- Description of the issue and why it's a bug
- Example input that would trigger the bug
- Suggestions for how to fix it
After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.
I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.
📓 Learnings (2)
src/Analyzers/SetExplicitMockBehaviorAnalyzer.cs (1)
Learnt from: MattKotsenas PR: rjmurillo/moq.analyzers#226 File: src/Moq.Analyzers/SetExplicitMockBehaviorAnalyzer.cs:45-49 Timestamp: 2024-10-15T20:25:09.079Z Learning: In this codebase, `WellKnownTypeNames` is included via global usings.src/BannedSymbols.txt (1)
Learnt from: MattKotsenas PR: rjmurillo/moq.analyzers#239 File: src/BannedSymbols.txt:1-8 Timestamp: 2024-10-24T21:06:43.546Z Learning: All direct uses of `Diagnostic.Create` should be banned, even if `DiagnosticExtensions` doesn't currently wrap them. Developers should add an extension to `DiagnosticExtensions` if they need to use any of the `Diagnostic.Create` APIs.
🪛 GitHub Check: Codacy Static Code Analysis
src/Analyzers/ConstructorArgumentsShouldMatchAnalyzer.cs
[failure] 185-185: src/Analyzers/ConstructorArgumentsShouldMatchAnalyzer.cs#L185
Add the 'const' modifier to 'hasMockBehavior'.src/Common/Caching/BoundedCacheWithFactory.cs
[failure] 1-1: src/Common/Caching/BoundedCacheWithFactory.cs#L1
Provide an 'AssemblyVersion' attribute for assembly 'srcassembly.dll'.
[warning] 12-12: src/Common/Caching/BoundedCacheWithFactory.cs#L12
Types should not have members with visibility set higher than the type's visibilitysrc/Common/ISymbolExtensions.cs
[failure] 88-88: src/Common/ISymbolExtensions.cs#L88
Add a 'default' clause to this 'switch' statement.
[failure] 106-106: src/Common/ISymbolExtensions.cs#L106
Add a 'default' clause to this 'switch' statement.src/Common/ITypeSymbolExtensions.cs
[failure] 1-1: src/Common/ITypeSymbolExtensions.cs#L1
Provide an 'AssemblyVersion' attribute for assembly 'srcassembly.dll'.
[warning] 3-3: src/Common/ITypeSymbolExtensions.cs#L3
Types should not have members with visibility set higher than the type's visibilitysrc/Common/SymbolVisibility.cs
[failure] 1-1: src/Common/SymbolVisibility.cs#L1
Provide an 'AssemblyVersion' attribute for assembly 'srcassembly.dll'.src/Common/WellKnown/KnownSymbols.cs
[failure] 1-1: src/Common/WellKnown/KnownSymbols.cs#L1
Provide an 'AssemblyVersion' attribute for assembly 'srcassembly.dll'.
[warning] 11-11: src/Common/WellKnown/KnownSymbols.cs#L11
Types should not have members with visibility set higher than the type's visibilitysrc/Common/WellKnown/MoqKnownSymbolExtensions.cs
[failure] 1-1: src/Common/WellKnown/MoqKnownSymbolExtensions.cs#L1
Provide an 'AssemblyVersion' attribute for assembly 'srcassembly.dll'.
[warning] 3-3: src/Common/WellKnown/MoqKnownSymbolExtensions.cs#L3
Types should not have members with visibility set higher than the type's visibilitysrc/Common/WellKnown/MoqKnownSymbols.cs
[failure] 1-1: src/Common/WellKnown/MoqKnownSymbols.cs#L1
Provide an 'AssemblyVersion' attribute for assembly 'srcassembly.dll'.
[warning] 5-5: src/Common/WellKnown/MoqKnownSymbols.cs#L5
Types should not have members with visibility set higher than the type's visibilitysrc/Common/WellKnown/WellKnownTypeProvider.cs
[failure] 1-1: src/Common/WellKnown/WellKnownTypeProvider.cs#L1
Provide an 'AssemblyVersion' attribute for assembly 'srcassembly.dll'.
[warning] 15-15: src/Common/WellKnown/WellKnownTypeProvider.cs#L15
Types should not have members with visibility set higher than the type's visibility
[failure] 124-124: src/Common/WellKnown/WellKnownTypeProvider.cs#L124
Add the missing 'else' clause with either the appropriate action or a suitable comment as to why no action is taken.
[failure] 137-137: src/Common/WellKnown/WellKnownTypeProvider.cs#L137
The Cyclomatic Complexity of this method is 19 which is greater than 10 authorized.
[notice] 176-176: src/Common/WellKnown/WellKnownTypeProvider.cs#L176
Replace this 'switch' expression with a ternary conditional operator to increase readability.
[failure] 179-179: src/Common/WellKnown/WellKnownTypeProvider.cs#L179
Reduce the number of conditional operators (10) used in the expression (maximum allowed 3).
[failure] 213-213: src/Common/WellKnown/WellKnownTypeProvider.cs#L213
Refactor this method to reduce its Cognitive Complexity from 26 to the 15 allowed.
🔇 Additional comments (41)
build/targets/compiler/Packages.props (1)
3-3: Verify compatibility with WellKnownTypeProvider implementation.The switch to Polyfill 7.1.2 looks good, but we should ensure it's compatible with the new WellKnownTypeProvider pattern being introduced.
✅ Verification successful
Based on the output, I can now generate the final response since I have enough context. The search revealed that Polyfill is properly configured in the build system with appropriate PrivateAssets and IncludeAssets settings, and there are no direct dependencies on PolySharp in the codebase.
The package switch to Polyfill is safe and compatible
The change from PolySharp to Polyfill is properly configured in the build system:
- It's set up as a build-time dependency with
PrivateAssets="all"- Includes appropriate analyzer assets via
IncludeAssets="runtime; build; native; contentfiles; analyzers"- No direct code dependencies were found that could conflict with WellKnownTypeProvider
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for any potential conflicts or dependencies rg -g '*.cs' -g '*.csproj' -i 'polysharp|polyfill'Length of output: 52
Script:
#!/bin/bash # Let's try a broader search to understand the package references and their usage fd -e props -e csproj -e config . | xargs catLength of output: 18091
src/Common/WellKnown/MoqKnownSymbolExtensions.cs (1)
1-4: LGTM! Namespace and class structure are well-defined.The internal visibility is appropriate for analyzer implementation, and the static class is correctly used for extension methods.
🧰 Tools
🪛 GitHub Check: Codacy Static Code Analysis
[failure] 1-1: src/Common/WellKnown/MoqKnownSymbolExtensions.cs#L1
Provide an 'AssemblyVersion' attribute for assembly 'srcassembly.dll'.
[warning] 3-3: src/Common/WellKnown/MoqKnownSymbolExtensions.cs#L3
Types should not have members with visibility set higher than the type's visibilitysrc/Common/GlobalUsings.cs (1)
7-7: LGTM! The global using directive aligns with architectural improvements.The addition of
global using Moq.Analyzers.Common.WellKnownsupports the transition to the WellKnownTypeProvider pattern, which will help improve symbol resolution and caching across analyzers.build/targets/compiler/Compiler.props (1)
Line range hint
9-13: Verify the package migration from PolySharp to Polyfill.This represents a significant package change with a major version jump (1.14.1 → 7.1.2). While the asset configuration remains correct, this change could have broader implications.
Let's verify the package details and any migration guides:
Consider adding a comment in the props file documenting this package migration and any notable differences between PolySharp and Polyfill.
✅ Verification successful
Let me try another verification approach to understand the package usage better.
Package change from PolySharp to Polyfill is properly justified
The commit message clearly explains the motivation for this change: the Polyfill package was chosen because it provides additional polyfills, specifically
ConcurrentDictionary.GetOrAdd<T>which was needed. The change is well-documented in the commit history, and the package configuration (PrivateAssets and IncludeAssets) remains appropriate for a polyfill generator.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for migration documentation and package usage # Test 1: Look for migration documentation echo "Checking for migration documentation..." rg -l -i "polyfill|polysharp" README.md docs/ 2>/dev/null || true # Test 2: Check for any remaining references to PolySharp echo "Checking for remaining PolySharp references..." rg -l "PolySharp" . --type xml --type cs 2>/dev/null || trueLength of output: 294
Script:
#!/bin/bash # Search for Polyfill package references and configurations echo "Checking Polyfill package references..." rg -l "Polyfill" . --type xml --type props --type config # Search for any build configuration or documentation mentioning polyfills echo "Checking build configurations and docs for polyfill mentions..." rg -i "polyfill" . --type md --type xml --type props --type config -C 2 # Check commit history for related changes echo "Checking recent commits for package changes..." git log -p --grep="polyfill\|polysharp" -iLength of output: 1759
src/Common/SymbolVisibility.cs (1)
3-24: LGTM! Clean and well-documented enum implementation.The enum is well-structured with clear documentation and explicit value assignments.
src/Common/ITypeSymbolExtensions.cs (1)
1-1: Verify assembly version configuration.The static analysis tool indicates missing assembly version. This should be verified at the project level.
✅ Verification successful
Let me gather more information about version configuration in the project by checking the project files and Directory.Build.props which commonly contain version settings in .NET projects.
Let me check the content of the versioning props file referenced in Directory.Build.props since it appears to handle versioning configuration.
Assembly version is properly configured through Nerdbank.GitVersioning
The project uses Nerdbank.GitVersioning package which automatically handles assembly and package versioning through Git version control. This is a recommended approach that provides consistent versioning across all assemblies in the solution. The warning can be safely ignored as the versioning is managed at the solution level through this package.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for assembly version in project files and assembly info echo "Checking for AssemblyVersion in project files:" find . -name "*.csproj" -exec grep -l "AssemblyVersion" {} \; echo -e "\nChecking for AssemblyVersion in AssemblyInfo files:" find . -name "AssemblyInfo.cs" -exec grep -l "AssemblyVersion" {} \;Length of output: 356
Script:
#!/bin/bash # Check project files content and Directory.Build.props echo "Project files content:" find . -name "*.csproj" -exec cat {} \; echo -e "\nDirectory.Build.props content:" find . -name "Directory.Build.props" -exec cat {} \; echo -e "\nChecking for Version tags in project files:" find . -name "*.csproj" -exec grep -l "Version" {} \;Length of output: 8698
Script:
#!/bin/bash # Check versioning configuration echo "Checking versioning configuration:" find . -name "Versioning.props" -exec cat {} \;Length of output: 339
🧰 Tools
🪛 GitHub Check: Codacy Static Code Analysis
[failure] 1-1: src/Common/ITypeSymbolExtensions.cs#L1
Provide an 'AssemblyVersion' attribute for assembly 'srcassembly.dll'.build/targets/codeanalysis/Packages.props (1)
6-6: LGTM! Package addition aligns with performance goals.The addition of Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers is appropriate given the PR's focus on optimizing symbol lookups and maintaining performance. While it's a beta version, it's consistent with other Microsoft.CodeAnalysis packages in use.
src/Common/WellKnown/KnownSymbols.cs (4)
3-10: LGTM! Well-documented class purpose and usage.The documentation clearly explains the caching mechanism and provides guidance on symbol comparison with SyntaxNodes.
13-21: LGTM! Well-designed constructor overloads.The constructors provide good flexibility in initialization while maintaining a single source of truth through constructor chaining.
43-43: LGTM! Appropriate protection level for inheritance.The protected property allows derived classes (like MoqKnownSymbols) to access the type provider while maintaining encapsulation.
26-41: Verify caching behavior of repeated type lookups.While the class is designed for caching, let's verify that repeated property access doesn't trigger multiple type lookups.
✅ Verification successful
Type lookups are properly cached, no performance concerns
The implementation shows robust caching at multiple levels:
- Static
ProviderCachefor compilation-level caching- Instance-level
_fullNameToTypeMap(ConcurrentDictionary) caches individual type lookups- Thread-safe implementation using concurrent collections
The Task-related properties will only perform the actual type lookup once, with subsequent accesses retrieving the cached value from
_fullNameToTypeMap.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for any tests verifying the caching behavior of WellKnownTypeProvider # Test: Look for test files related to WellKnownTypeProvider rg -t cs "WellKnownTypeProvider" --glob "*Test*.cs" -A 5 # Test: Look for any benchmarks measuring type lookup performance rg -t cs "WellKnownTypeProvider.*Benchmark" -A 5Length of output: 107
Script:
#!/bin/bash # Let's check the implementation of TypeProvider to understand the caching behavior # First, find the TypeProvider implementation rg -t cs "class.*TypeProvider" -A 5 # Also look for GetOrCreateTypeByMetadataName implementation ast-grep --pattern 'GetOrCreateTypeByMetadataName($_) { $$$ }' # Check if there's any dictionary or cache field rg -t cs "Dictionary|Cache" --glob "*TypeProvider*.cs"Length of output: 1427
src/Common/EnumerableExtensions.cs (1)
44-54: Verify usage patterns of WhereNotNull methods.Let's analyze how these extension methods are being used in the codebase to ensure they align with the PR objectives of improving analyzers.
✅ Verification successful
Let me gather more context about the usage patterns, particularly focusing on the type parameters and nullable contexts.
Based on the gathered information, I can now provide a final response about the WhereNotNull extension methods:
Extension methods are correctly implemented and used appropriately
The WhereNotNull extension methods are properly implemented with specific constraints for both reference types (class) and value types (struct), and their only usage is in
SetExplicitMockBehaviorAnalyzer.csfor handling nullable Mock types in a type-safe manner. This aligns with the PR's objective of improving analyzer robustness through better null handling.
- The implementation in
src/Common/EnumerableExtensions.csprovides specialized handling for both reference and value types- The usage in
SetExplicitMockBehaviorAnalyzer.cssafely processes nullable Mock types when building the array of mock types- No other usages found in the codebase, indicating focused and intentional usage
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Find usages of WhereNotNull to understand implementation patterns echo "Searching for WhereNotNull usage patterns..." rg -l "WhereNotNull" | while read -r file; do echo "=== $file ===" # Show 3 lines before and after each usage for context rg -B 3 -A 3 "WhereNotNull" "$file" doneLength of output: 1203
Script:
#!/bin/bash # Search for Mock-related types and their usage with nullable contexts echo "=== Searching for Mock type declarations and usage ===" ast-grep --pattern 'class Mock$_' echo -e "\n=== Searching for MockRepository declarations ===" ast-grep --pattern 'class MockRepository$_' echo -e "\n=== Checking nullable context settings ===" rg "#nullable" -A 2 echo -e "\n=== Checking other potential WhereNotNull usages with IEnumerable ===" rg "IEnumerable.*\?" -B 1 -A 1Length of output: 25165
build/targets/codeanalysis/CodeAnalysis.props (1)
29-32: LGTM! Addition of performance-sensitive analyzers aligns with PR objectives.The inclusion of
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzersis particularly relevant given this PR's focus on optimizing symbol lookups and caching. The package configuration follows best practices with appropriate asset inclusion settings.src/BannedSymbols.txt (2)
Line range hint
1-8: LGTM! Comprehensive coverage of Diagnostic.Create bans.The banned signatures cover all overloads of
Diagnostic.Create, which aligns with the requirement to useDiagnosticExtensions.CreateDiagnosticfor better readability and consistency.
10-12: LGTM! Verify impact of banning GetType methods.*The banned signatures align with the PR's goal of using
KnownSymbolspattern for better type resolution and caching. This will help reduce computational costs by cachingISymbollookups.Let's verify the current usage of these banned methods to ensure all cases are covered by
KnownSymbols:✅ Verification successful
Potential issue: WellKnownTypeProvider still uses GetTypeByMetadataName internally
The verification reveals that while we're banning direct usage of
GetTypeByMetadataName, theWellKnownTypeProvideritself internally uses this method in its implementation. Let's verify if this is an intentional implementation detail or a potential issue:
Internal usage of GetTypeByMetadataName in WellKnownTypeProvider is correct
The usage of
GetTypeByMetadataNamewithinWellKnownTypeProvideris intentional and correct. This class serves as the caching layer that implements theKnownSymbolspattern, where:
- It maintains a concurrent dictionary to cache type lookups
- It optimizes the lookup process by first checking namespace names
- It handles assembly visibility and type resolution across referenced assemblies
- It's designed to be the centralized place for type resolution, which is exactly what the ban on direct
GetTypeByMetadataNameusage aims to encourageThe ban in
BannedSymbols.txtcorrectly pushes developers to use theKnownSymbolspattern instead of directly calling these methods, while the internal implementation inWellKnownTypeProviderappropriately encapsulates the actual type resolution logic.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Find any remaining usages of GetTypeByMetadataName or GetTypesByMetadataName # that might need to be updated to use KnownSymbols echo "Searching for GetTypeByMetadataName usages..." rg "GetTypeByMetadataName" -A 2 echo -e "\nSearching for GetTypesByMetadataName usages..." rg "GetTypesByMetadataName" -A 2Length of output: 2055
Script:
#!/bin/bash # Get more context around the WellKnownTypeProvider implementation ast-grep --pattern 'class WellKnownTypeProvider { $$$ }'Length of output: 60
Script:
#!/bin/bash # Let's try to get more context around the WellKnownTypeProvider implementation using ripgrep echo "Getting context around WellKnownTypeProvider usage of GetTypeByMetadataName..." rg -B 10 -A 10 "GetTypeByMetadataName" "src/Common/WellKnown/WellKnownTypeProvider.cs" echo -e "\nChecking class definition..." rg "class WellKnownTypeProvider" -B 2 -A 2 "src/Common/WellKnown/WellKnownTypeProvider.cs"Length of output: 4127
src/Analyzers/SetupShouldNotIncludeAsyncResultAnalyzer.cs (2)
47-51: LGTM! Clean pattern matching with early return.The code effectively uses pattern matching to handle non-member access expressions, improving readability and maintainability.
Line range hint
25-30: Verify thread safety for concurrent execution.The analyzer enables concurrent execution but will use shared state with the proposed
_knownSymbolscaching. Ensure thread safety by using appropriate synchronization mechanisms.Consider using a thread-safe initialization pattern:
public class SetupShouldNotIncludeAsyncResultAnalyzer : DiagnosticAnalyzer { - private MoqKnownSymbols? _knownSymbols; + private volatile MoqKnownSymbols? _knownSymbols; + private readonly object _lock = new object(); // ... other fields ... private static void Analyze(SyntaxNodeAnalysisContext context) { - _knownSymbols ??= new MoqKnownSymbols(context.SemanticModel.Compilation); + if (_knownSymbols == null) + { + lock (_lock) + { + _knownSymbols ??= new MoqKnownSymbols(context.SemanticModel.Compilation); + } + }src/CodeFixes/CallbackSignatureShouldMatchMockedMethodCodeFix.cs (2)
55-58: LGTM: Improved null check using pattern matchingThe change to use
is nullpattern matching is a good modernization that aligns with C# best practices.
60-67: Verify integration with WellKnownTypeProvider patternThe changes introduce the WellKnownTypeProvider pattern through MoqKnownSymbols. Let's verify the integration with other components.
✅ Verification successful
Integration with WellKnownTypeProvider pattern is properly implemented
The verification shows that MoqKnownSymbols is consistently integrated across the codebase:
- Properly inherits from base KnownSymbols class and uses WellKnownTypeProvider
- Used consistently across 10 different analyzer and code fix files
- No legacy string-based type lookups were found
- The semantic model extensions are properly utilizing the new pattern
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for consistent usage of MoqKnownSymbols across the codebase echo "Checking for MoqKnownSymbols usage patterns..." rg -p "new MoqKnownSymbols\(" -A 3 # Check for any remaining string-based type lookups that should use MoqKnownSymbols echo "Checking for potential missed conversions to MoqKnownSymbols..." rg "WellKnownMockTypes\."Length of output: 304
Script:
#!/bin/bash # Let's try a more comprehensive search for MoqKnownSymbols usage echo "Searching for MoqKnownSymbols class definition and usage..." rg -p "class MoqKnownSymbols" -A 5 echo "Searching for files containing MoqKnownSymbols..." rg -l "MoqKnownSymbols" echo "Checking semantic model usage patterns..." rg -p "semanticModel\.FindSetupMethodFromCallbackInvocation" -A 3 # Let's also check for any related well-known type providers echo "Checking for other well-known type providers..." rg -p "class.*KnownSymbols" -A 5Length of output: 2615
src/Common/WellKnown/MoqKnownSymbols.cs (4)
17-30: LGTM! Robust implementation with proper null handling.The implementation correctly handles null cases and follows the pattern described in the PR objectives of not caching member lookups.
32-45: LGTM! Consistent implementation with non-generic Mock properties.
64-83: LGTM! Appropriate use of SingleOrDefault for enum field lookups.
61-62: Verify performance impact of boxing in MockRepositoryCreate.The suppression of ECS0900 suggests potential performance implications. While likely negligible, consider benchmarking this specific lookup against high-frequency usage patterns.
✅ Verification successful
Let me check the usage context to better assess the performance impact.
Boxing performance impact is negligible in this context
The property
MockRepositoryCreateis only used once in a control flow condition withinConstructorArgumentsShouldMatchAnalyzer, which is a static analysis scenario. Since this is not in a performance-critical path and is used for one-time type checking rather than in a tight loop, the boxing overhead fromSelectManyandOfTypeoperations is acceptable.The existing suppression message accurately reflects this - it's a minor performance issue that doesn't warrant immediate optimization given the usage pattern.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for usages of MockRepositoryCreate to assess impact rg -l "MockRepositoryCreate" --type csLength of output: 135
Script:
#!/bin/bash # Check how MockRepositoryCreate is used in the analyzer rg "MockRepositoryCreate" -B 2 -A 2 --type csLength of output: 1095
src/Analyzers/SetupShouldBeUsedOnlyForOverridableMembersAnalyzer.cs (1)
39-47: Verify cancellation token propagation.The code correctly uses the cancellation token for GetSymbolInfo, but we should verify it's properly propagated to all semantic model operations to prevent potential race conditions.
✅ Verification successful
Let me search for semantic model operations more precisely to verify cancellation token usage.
Cancellation token is properly propagated in all semantic model operations
The verification shows that all semantic model operations in
SetupShouldBeUsedOnlyForOverridableMembersAnalyzer.cscorrectly use the cancellation token:
GetSymbolInfo(memberAccessExpression, context.CancellationToken)IsMoqSetupMethod(..., context.CancellationToken)GetSymbolInfo(mockedMemberExpression, context.CancellationToken)🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for semantic model operations without cancellation token rg -A 2 "SemanticModel\.(Get|Is|Has)" | grep -v "CancellationToken"Length of output: 8536
Script:
#!/bin/bash # Search for semantic model operations in the specific analyzer file rg -A 2 "SemanticModel\." "src/Analyzers/SetupShouldBeUsedOnlyForOverridableMembersAnalyzer.cs"Length of output: 774
src/Analyzers/CallbackSignatureShouldMatchMockedMethodAnalyzer.cs (1)
34-35: LGTM! Consider verifying performance impact.The introduction of
MoqKnownSymbolsaligns with the PR objectives and appears thread-safe for concurrent analysis. The implementation correctly scopes the instance to each analysis context.Let's verify the performance impact:
✅ Verification successful
Let's examine the benchmark implementations to verify if they cover the
MoqKnownSymbolsusage:
Let's check if there are any performance-related comments or documentation in the relevant files:
Let's check the analyzer's concurrent execution configuration and the base class implementation:
Let's check the actual implementation of concurrent execution and MoqKnownSymbols usage in the analyzer:
Implementation is thread-safe and follows performance best practices
The implementation is verified to be correct and performant:
- The analyzer properly enables concurrent execution via
EnableConcurrentExecution()MoqKnownSymbolsis correctly scoped to each analysis context- The implementation is immutable and thread-safe, using
ImmutableArray<T>for collections- Caching is handled by the underlying
WellKnownTypeProvider- Performance considerations are acknowledged (see
SuppressMessage("Performance"...)annotation)🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for any performance regression tests or benchmarks # Look for benchmark files echo "Searching for benchmark files..." fd -e cs -e csproj ".*[Bb]enchmark.*" # Look for performance tests echo "Searching for performance tests..." rg -l "Performance|Benchmark" -g "*.cs"Length of output: 1547
Script:
#!/bin/bash # Check benchmark implementations for MoqKnownSymbols coverage rg -A 10 "MoqKnownSymbols" tests/Moq.Analyzers.Benchmarks/Length of output: 58
Script:
#!/bin/bash # Check for performance-related comments in MoqKnownSymbols and related files echo "Checking MoqKnownSymbols implementation:" rg -C 5 "performance|concurrent|thread|safe" src/Common/WellKnown/MoqKnownSymbols.cs echo -e "\nChecking WellKnownTypeProvider implementation:" rg -C 5 "performance|concurrent|thread|safe" src/Common/WellKnown/WellKnownTypeProvider.cs echo -e "\nChecking analyzer implementation:" rg -C 5 "performance|concurrent|thread|safe" src/Analyzers/CallbackSignatureShouldMatchMockedMethodAnalyzer.csLength of output: 575
Script:
#!/bin/bash # Check analyzer's concurrent execution setup echo "Checking analyzer's concurrent execution:" ast-grep --pattern 'class CallbackSignatureShouldMatchMockedMethodAnalyzer : DiagnosticAnalyzer { $$$ public override void Initialize(AnalysisContext context) { $$$ } $$$ }' echo -e "\nChecking for EnableConcurrentExecution calls:" rg -l "EnableConcurrentExecution" --type csLength of output: 882
Script:
#!/bin/bash # Check the Initialize method implementation and MoqKnownSymbols usage echo "Checking Initialize method implementation:" rg -A 10 "Initialize\(AnalysisContext context\)" src/Analyzers/CallbackSignatureShouldMatchMockedMethodAnalyzer.cs echo -e "\nChecking MoqKnownSymbols implementation:" cat src/Common/WellKnown/MoqKnownSymbols.csLength of output: 4271
tests/Moq.Analyzers.Test.Analyzers/SquiggleCop.Baseline.yaml (2)
310-318: LGTM! Good addition of compiler diagnostics.The new compiler warning rules will help catch common issues around documentation, field initialization, reference ambiguity, and locking. All rules are appropriately configured with Warning severity.
1607-1607: 🛠️ Refactor suggestionConsider enabling VSTHRD105 rule.
While adding the VSTHRD105 rule is good, it's currently marked as suppressed (
IsEverSuppressed: true). This rule helps prevent threading issues by warning against method overloads that make assumptions about TaskScheduler.Current. Consider enabling it to catch potential threading issues early.src/Analyzers/SquiggleCop.Baseline.yaml (2)
310-318: LGTM! Good addition of compiler diagnostic rules.The added compiler diagnostic rules (CS0419, CS0649, etc.) will help catch common issues with:
- XML documentation formatting and validation
- Unassigned fields
- Parameter documentation
- Nullable reference type usage
913-913: LGTM! Appropriate severity level adjustments.The severity level changes are well-considered:
- RS1035 (banned APIs) as Error - Critical for analyzer correctness
- SA1101 (this prefix) as Note - Style preference
- VSTHRD105 (TaskScheduler.Current) as Error - Important for thread safety
Also applies to: 1431-1431, 1608-1608
src/CodeFixes/SquiggleCop.Baseline.yaml (3)
310-318: LGTM! Added compiler diagnostic rules for better code quality.The new compiler diagnostic rules cover important areas:
- XML comment validation (CS1570-CS1574)
- Field initialization warnings (CS0649)
- Nullable reference type handling (CS8669)
Line range hint
1608-1620: LGTM! Added comprehensive threading-related diagnostic rules.The new VSTHRD rules enforce important async/await best practices:
- VSTHRD105: Avoids TaskScheduler.Current assumptions
- VSTHRD106-114: Proper async event handling and resource cleanup
- VSTHRD200: Consistent async method naming
1431-1431: Verify impact of SA1101 rule modification.The SA1101 rule (prefix local calls with this) now includes 'Note' severity alongside 'Error'. This mixed severity configuration is unusual and might lead to inconsistent enforcement.
✅ Verification successful
The previous search was too narrow. Let's broaden it to:
- Check YAML files for any SA1101 configurations to understand the current setup
- Look for StyleCop suppressions in C# files to understand the impact
Mixed severity configuration for SA1101 is consistent across the codebase
The SA1101 rule configuration with mixed severities (Error, Note) is consistently defined across all configuration files in the codebase:
- src/Analyzers/SquiggleCop.Baseline.yaml
- src/CodeFixes/SquiggleCop.Baseline.yaml
- tests/Moq.Analyzers.Test/SquiggleCop.Baseline.yaml
- tests/Moq.Analyzers.Test.Analyzers/SquiggleCop.Baseline.yaml
- tests/Moq.Analyzers.Benchmarks/SquiggleCop.Baseline.yaml
This appears to be an intentional configuration pattern, and since there are no StyleCop suppressions found in the C# files, the mixed severity setup is unlikely to cause issues.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for existing SA1101 suppressions that might be affected rg -l "SA1101" --type csLength of output: 24
Script:
#!/bin/bash # Search for SA1101 rule configurations in all YAML files rg "SA1101.*this" --type yaml -A 2 -B 2 # Search for any StyleCop rule suppressions in C# files rg "\[SuppressMessage.*StyleCop" --type csLength of output: 6908
tests/Moq.Analyzers.Benchmarks/SquiggleCop.Baseline.yaml (2)
310-318: LGTM! New compiler diagnostic rules are well-configured.The added compiler diagnostics enhance code quality by enforcing:
- Proper XML documentation formatting and references
- Correct nullable reference type usage
- Safe threading practices
342-357: LGTM! New performance diagnostic rules enhance allocation tracking.The added performance diagnostics help identify:
- Unnecessary array allocations in params
- Value type boxing scenarios
- Closure and delegate allocations
- String concatenation allocations
These rules align well with the PR's focus on performance optimization.
tests/Moq.Analyzers.Test/SquiggleCop.Baseline.yaml (1)
310-317: LGTM! The new diagnostic rules enhance code quality checks.The added diagnostic rules improve detection of:
- XML documentation issues (CS0419, CS1572, CS1573, CS1574, CS1734)
- Nullable reference type safety (CS8669)
- Threading safety concerns (CS9216)
src/Common/SemanticModelExtensions.cs (1)
10-29: Ensure all calls toFindSetupMethodFromCallbackInvocationare updated with the newMoqKnownSymbolsparameterThe method
FindSetupMethodFromCallbackInvocationnow includes an additional parameterMoqKnownSymbols knownSymbols. Please verify that all invocations of this method within the codebase have been updated to pass theknownSymbolsargument. Missing this update could lead to compilation errors or runtime issues.You can run the following script to locate all usages of
FindSetupMethodFromCallbackInvocationthat may need updating:✅ Verification successful
Let me check the actual implementation of these calls to verify if they include the new parameter.
All calls to
FindSetupMethodFromCallbackInvocationare correctly updated with the new parameterThe verification shows that all invocations of the method include the required
knownSymbolsparameter:
- In
CallbackSignatureShouldMatchMockedMethodCodeFix.cs:semanticModel.FindSetupMethodFromCallbackInvocation(knownSymbols, callbackInvocation, cancellationToken)- In
CallbackSignatureShouldMatchMockedMethodAnalyzer.cs:context.SemanticModel.FindSetupMethodFromCallbackInvocation(knownSymbols, callbackOrReturnsInvocation, context.CancellationToken)- In
SemanticModelExtensions.cs: The recursive call also includesknownSymbols:semanticModel.FindSetupMethodFromCallbackInvocation(knownSymbols, method.Expression, cancellationToken)🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Find all calls to FindSetupMethodFromCallbackInvocation that need to include the MoqKnownSymbols parameter. rg -tcs --no-heading -o 'FindSetupMethodFromCallbackInvocation\(' -A 1Length of output: 882
Script:
#!/bin/bash # Get the context of the calls to FindSetupMethodFromCallbackInvocation rg -tcs --no-heading -B 2 -A 2 'FindSetupMethodFromCallbackInvocation\('Length of output: 2455
src/Analyzers/SetExplicitMockBehaviorAnalyzer.cs (4)
37-38: Proper instantiation ofMoqKnownSymbols.The
MoqKnownSymbolsclass is correctly instantiated with the current compilation context.
40-42: Efficient check for Moq reference.The use of
IsMockReferenced()to determine if Moq is referenced in the compilation is appropriate and prevents unnecessary analysis when Moq is not present.
46-48: Null check forMockBehaviorsymbol is appropriate.Ensuring that
mockBehaviorSymbolis not null before proceeding avoids potential null reference exceptions.
53-54: Retrieval ofMock.Of()methods.The
ofMethodsare correctly retrieved fromknownSymbols.MockOfto be used in further analysis.src/Common/WellKnown/WellKnownTypeProvider.cs (1)
119-129:⚠️ Potential issueAdd an 'else' clause or comment to clarify loop control flow
In the loop starting at line 119, there's an
if, anelse if, but noelse. For better readability and to explicitly handle all conditions, consider adding anelseclause or a comment explaining why no action is taken when neither condition is met.Consider adding an
elseblock or a comment:for (int i = 0; i < fullTypeName.Length; i++) { if (fullTypeName[i] == '.') { namespaceNamesBuilder.Add(fullTypeName[prevStartIndex..i]); prevStartIndex = i + 1; } else if (!IsIdentifierPartCharacter(fullTypeName[i])) { break; + } + else + { + // Continue processing the next character } }Likely invalid or redundant comment.
🧰 Tools
🪛 GitHub Check: Codacy Static Code Analysis
[failure] 124-124: src/Common/WellKnown/WellKnownTypeProvider.cs#L124
Add the missing 'else' clause with either the appropriate action or a suitable comment as to why no action is taken.
a9833ca
|
Code Climate has analyzed commit a9833ca and detected 0 issues on this pull request. View more on Code Climate. |
[//]: # (dependabot-start)
⚠️ **Dependabot is rebasing this PR** ⚠️
Rebasing might not happen immediately, so don't worry if this takes some
time.
Note: if you make any changes to this PR yourself, they will take
precedence over the rebase.
---
[//]: # (dependabot-end)
Updated
[Meziantou.Analyzer](https://github.com/meziantou/Meziantou.Analyzer)
from 2.0.182 to 2.0.276.
<details>
<summary>Release notes</summary>
_Sourced from [Meziantou.Analyzer's
releases](https://github.com/meziantou/Meziantou.Analyzer/releases)._
## 2.0.276
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.276>
## What's Changed
* Fix MA0182 false positive on types with DynamicallyAccessedMembers
attribute by @Copilot in
https://github.com/meziantou/Meziantou.Analyzer/pull/963
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.275...2.0.276
## 2.0.275
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.275>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.274...2.0.275
## 2.0.274
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.274>
## What's Changed
* Fix MA0182 to handle COM interop types with CoClass attribute by
@Copilot in https://github.com/meziantou/Meziantou.Analyzer/pull/959
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.273...2.0.274
## 2.0.273
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.273>
## What's Changed
* Fix MA0182 false positive for pointer type parameters by @Copilot in
https://github.com/meziantou/Meziantou.Analyzer/pull/961
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.272...2.0.273
## 2.0.272
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.272>
## What's Changed
* Extend MA0182 to all types by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/957
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.271...2.0.272
## 2.0.271
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.271>
## What's Changed
* Add MA0182: Detect unused internal classes with correct handling of
generic type arguments and typeof references by @Copilot in
https://github.com/meziantou/Meziantou.Analyzer/pull/956
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.270...2.0.271
## 2.0.270
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.270>
## What's Changed
* Apply repository configuration by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/954
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.269...2.0.270
## 2.0.269
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.269>
## What's Changed
* Apply repository configuration by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/953
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.268...2.0.269
## 2.0.268
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.268>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.267...2.0.268
## 2.0.267
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.267>
## What's Changed
* Add MA0181 - Report use of explicit casts by @Copilot in
https://github.com/meziantou/Meziantou.Analyzer/pull/952
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.266...2.0.267
## 2.0.266
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.266>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.265...2.0.266
## 2.0.265
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.265>
## What's Changed
* Add refactoring: convert interpolated string to Format call by
@meziantou in https://github.com/meziantou/Meziantou.Analyzer/pull/948
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.264...2.0.265
## 2.0.264
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.264>
## What's Changed
* Lower global_level from -1 to -100 in editorconfig files by @Copilot
in https://github.com/meziantou/Meziantou.Analyzer/pull/944
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.263...2.0.264
## 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
https://github.com/meziantou/Meziantou.Analyzer/pull/941
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/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 https://github.com/meziantou/Meziantou.Analyzer/pull/942
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/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 https://github.com/meziantou/Meziantou.Analyzer/pull/939
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/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 https://github.com/meziantou/Meziantou.Analyzer/pull/938
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/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
https://github.com/meziantou/Meziantou.Analyzer/pull/936
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.258...2.0.259
## 2.0.258
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.258>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.257...2.0.258
## 2.0.257
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.257>
## What's Changed
* Fix MA0042 to not flag SemaphoreSlim.Wait(0) as blocking by @Copilot
in https://github.com/meziantou/Meziantou.Analyzer/pull/934
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.256...2.0.257
## 2.0.256
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.256>
## What's Changed
* Clarify MA0093 only applies to event invocations, not regular method
calls by @Copilot in
https://github.com/meziantou/Meziantou.Analyzer/pull/933
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.255...2.0.256
## 2.0.255
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.255>
## What's Changed
* Use GlobalAnalyzerConfigFiles with global_level=-1 for analyzer
configuration by @Copilot in
https://github.com/meziantou/Meziantou.Analyzer/pull/932
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.254...2.0.255
## 2.0.254
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.254>
## What's Changed
* Add MA0178: Use TimeSpan.Zero instead of TimeSpan.FromXXX(0) by
@Copilot in https://github.com/meziantou/Meziantou.Analyzer/pull/929
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.253...2.0.254
## 2.0.253
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.253>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.252...2.0.253
## 2.0.252
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.252>
## What's Changed
* Updated `NamedParameterAnalyzer` to handle language version checks for
C# 14 by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/925
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.251...2.0.252
## 2.0.251
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.251>
## What's Changed
* Add comprehensive CultureInsensitiveTypeAttribute documentation by
@Copilot in https://github.com/meziantou/Meziantou.Analyzer/pull/922
* Update to .NET 10 by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/924
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.250...2.0.251
## 2.0.250
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.250>
## What's Changed
* MA0011: Skip diagnostic for culture-invariant interpolated strings by
@Copilot in https://github.com/meziantou/Meziantou.Analyzer/pull/919
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.249...2.0.250
## 2.0.249
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.249>
## What's Changed
* Fix MA0095 to not report for CRTP-inherited IEquatable<T> by @Copilot
in https://github.com/meziantou/Meziantou.Analyzer/pull/918
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.248...2.0.249
## 2.0.248
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.248>
## What's Changed
* Update MA0053 to mention both class and record types by @Copilot in
https://github.com/meziantou/Meziantou.Analyzer/pull/915
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.247...2.0.248
## 2.0.247
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.247>
## What's Changed
* Update Roslyn dependencies and clean up PackageReferences by
@meziantou in https://github.com/meziantou/Meziantou.Analyzer/pull/916
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.246...2.0.247
## 2.0.246
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.246>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.245...2.0.246
## 2.0.245
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.245>
## What's Changed
* Fix MA0015 not detecting static ThrowIf methods on ArgumentException
and related types by @Copilot in
https://github.com/meziantou/Meziantou.Analyzer/pull/912
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.244...2.0.245
## 2.0.244
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.244>
## What's Changed
* Fix MA0011 not reported for types with ToString(IFormatProvider) but
no IFormattable by @Copilot in
https://github.com/meziantou/Meziantou.Analyzer/pull/910
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.243...2.0.244
## 2.0.243
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.243>
## What's Changed
* Add Roslyn analyzer for multiline XML comments by @Copilot in
https://github.com/meziantou/Meziantou.Analyzer/pull/908
## New Contributors
* @Copilot made their first contribution in
https://github.com/meziantou/Meziantou.Analyzer/pull/908
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.242...2.0.243
## 2.0.242
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.242>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.241...2.0.242
## 2.0.241
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.241>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.240...2.0.241
## 2.0.240
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.240>
## What's Changed
* Add copilot instructions by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/907
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.239...2.0.240
## 2.0.239
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.239>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.238...2.0.239
## 2.0.238
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.238>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.237...2.0.238
## 2.0.237
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.237>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.236...2.0.237
## 2.0.236
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.236>
## What's Changed
* Document members of CultureInsensitiveTypeAttribute. by @drieseng in
https://github.com/meziantou/Meziantou.Analyzer/pull/902
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.235...2.0.236
## 2.0.235
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.235>
## What's Changed
* Add support for culture-insensitive default formats by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/898
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.234...2.0.235
## 2.0.234
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.234>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.233...2.0.234
## 2.0.233
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.233>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.232...2.0.233
## 2.0.232
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.232>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.231...2.0.232
## 2.0.231
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.231>
## What's Changed
* Improve support for culture-sensitive ToString and support null format
by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/893
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.230...2.0.231
## 2.0.230
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.230>
## What's Changed
* Apply style suggestion by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/892
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.229...2.0.230
## 2.0.229
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.229>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.228...2.0.229
## 2.0.228
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.228>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.227...2.0.228
## 2.0.227
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.227>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.226...2.0.227
## 2.0.226
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.226>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.225...2.0.226
## 2.0.225
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.225>
## What's Changed
* Document CA1849 as being similar to MA0042 by @drieseng in
https://github.com/meziantou/Meziantou.Analyzer/pull/886
* Added support for analyzing methods with LoggerMessage attributes by
@meziantou in https://github.com/meziantou/Meziantou.Analyzer/pull/888
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.224...2.0.225
## 2.0.224
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.224>
## What's Changed
* New rule: MA0176 - Optimize guid creation by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/884
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.223...2.0.224
## 2.0.223
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.223>
## What's Changed
* MA0016 skips conversion methods by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/883
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.222...2.0.223
## 2.0.222
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.222>
## What's Changed
* docs: enhance MA0090 and MA0098 rule documentation by @Meir017 in
https://github.com/meziantou/Meziantou.Analyzer/pull/874
* MA0042 fixer creates generic method call if generic method was called
by @Griboedoff in
https://github.com/meziantou/Meziantou.Analyzer/pull/881
## New Contributors
* @Griboedoff made their first contribution in
https://github.com/meziantou/Meziantou.Analyzer/pull/881
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.221...2.0.222
## 2.0.221
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.221>
## What's Changed
* New rules: MA0174 and MA0175 by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/879
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.220...2.0.221
## 2.0.220
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.220>
## What's Changed
* docs: Add multiple CA/MA analyzer rule mappings by @Meir017 in
https://github.com/meziantou/Meziantou.Analyzer/pull/871
* Enhance MA0048 diagnostic messages with type information by @Meir017
in https://github.com/meziantou/Meziantou.Analyzer/pull/873
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.219...2.0.220
## 2.0.219
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.219>
## What's Changed
* Fix code block formatting in README.md by @Meir017 in
https://github.com/meziantou/Meziantou.Analyzer/pull/865
## New Contributors
* @Meir017 made their first contribution in
https://github.com/meziantou/Meziantou.Analyzer/pull/865
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.218...2.0.219
## 2.0.218
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.218>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.217...2.0.218
## 2.0.217
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.217>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.216...2.0.217
## 2.0.216
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.216>
## What's Changed
* Make expression parsing more robust by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/830
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.215...2.0.216
## 2.0.215
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.215>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.214...2.0.215
## 2.0.214
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.214>
## What's Changed
* Suggest using LazyInitializer instead of CompareExchange by
@meziantou in https://github.com/meziantou/Meziantou.Analyzer/pull/828
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.213...2.0.214
## 2.0.213
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.213>
## What's Changed
* Use Meziantou SDK by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/826
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.212...2.0.213
## 2.0.212
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.212>
## What's Changed
* Add new rule to detect similar code in both side of a logical
operation by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/825
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.211...2.0.212
## 2.0.211
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.211>
## What's Changed
* Fix for MA0077 for `ref struct` and improve MA0066 to detect
`WithComparers` by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/824
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.210...2.0.211
## 2.0.210
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.210>
## What's Changed
* Use additional locations to report diagnostic on symbols with multiple
locations by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/821
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.209...2.0.210
## 2.0.209
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.209>
## What's Changed
* Add MA0171: Replace HasValue with pattern matching by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/819
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.208...2.0.209
## 2.0.208
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.208>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.207...2.0.208
## 2.0.207
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.207>
## What's Changed
* Apply repository configuration by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/817
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.206...2.0.207
## 2.0.206
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.206>
## What's Changed
* Simplify msbuild properties by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/816
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.205...2.0.206
## 2.0.205
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.205>
## What's Changed
* MA0053 takes ctor visibility into account to determine if a class
should be sealed by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/815
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.204...2.0.205
## 2.0.204
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.204>
## What's Changed
* Convert sln to slnx by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/814
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.203...2.0.204
## 2.0.203
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.203>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.202...2.0.203
## 2.0.202
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.202>
## What's Changed
* Add a rule to check parameters in attributes are valid by @meziantou
in https://github.com/meziantou/Meziantou.Analyzer/pull/809
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.201...2.0.202
## 2.0.201
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.201>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.200...2.0.201
## 2.0.200
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.200>
## What's Changed
* MA0169 - Detect equality operators that should be replaced with Equals
method by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/805
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.199...2.0.200
## 2.0.199
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.199>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.198...2.0.199
## 2.0.198
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.198>
## What's Changed
* Add CODEOWNERS file by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/802
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.197...2.0.198
## 2.0.197
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.197>
## What's Changed
* Add rule to detect non-readonly struct used for in or ref readonly
parameters by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/801
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.196...2.0.197
## 2.0.196
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.196>
## What's Changed
* Add attribute to indicate a type is culture insensitive by @meziantou
in https://github.com/meziantou/Meziantou.Analyzer/pull/799
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.195...2.0.196
## 2.0.195
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.195>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.194...2.0.195
## 2.0.194
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.194>
## What's Changed
* Remove inaccessible local symbols by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/797
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.193...2.0.194
## 2.0.193
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.193>
## What's Changed
* Fix OverloadFinder by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/795
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.192...2.0.193
## 2.0.192
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.192>
## What's Changed
* Fix ArgumentOutOfRange in OverloadFinder by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/794
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.191...2.0.192
## 2.0.191
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.191>
## What's Changed
* Add new rules to suggest using TimeProvider by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/792
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.190...2.0.191
## 2.0.190
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.190>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.189...2.0.190
## 2.0.189
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.189>
## What's Changed
* Update the report location to be on method name and arguments instead
of the InvocationExpression by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/790
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.188...2.0.189
## 2.0.188
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.188>
## What's Changed
* MA0002 skips IImmutableSet<string> by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/787
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.187...2.0.188
## 2.0.187
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.187>
## What's Changed
* Fix MA0048 in case when first type is not first node by @FrediKats in
https://github.com/meziantou/Meziantou.Analyzer/pull/785
## New Contributors
* @FrediKats made their first contribution in
https://github.com/meziantou/Meziantou.Analyzer/pull/785
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.186...2.0.187
## 2.0.186
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.186>
## What's Changed
* Align message to behavior for MA0157 by @martindisch in
https://github.com/meziantou/Meziantou.Analyzer/pull/783
## New Contributors
* @martindisch made their first contribution in
https://github.com/meziantou/Meziantou.Analyzer/pull/783
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.185...2.0.186
## 2.0.185
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.185>
## What's Changed
* Allow to disable all rules using a property by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/781
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.184...2.0.185
## 2.0.184
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.184>
## What's Changed
* Update global.json by @meziantou in
https://github.com/meziantou/Meziantou.Analyzer/pull/778
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.183...2.0.184
## 2.0.183
NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/2.0.183>
**Full Changelog**:
https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.182...2.0.183
Commits viewable in [compare
view](https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.182...2.0.276).
</details>
Updated [Moq.Analyzers](https://github.com/rjmurillo/moq.analyzers) from
0.0.9 to 0.4.0.
<details>
<summary>Release notes</summary>
_Sourced from [Moq.Analyzers's
releases](https://github.com/rjmurillo/moq.analyzers/releases)._
## 0.4.0
# Moq.Analyzers 0.4.0
Welcome to Moq.Analyzers 0.4.0! This major release brings significant
improvements to code quality analysis, introduces new analyzers for
better Moq usage patterns, and includes comprehensive updates to our
infrastructure and dependencies.
## ✨ Highlights
### New Analyzers
This release introduces three powerful new analyzers to help you write
better Moq tests:
- **[Moq1207]** - SetupSequence validation analyzer ensures sequential
setups are used correctly
- **[Moq1420]** - Times usage validation helps you use verification
times specifications properly
- **[Moq1500]** - Raise method validation catches incorrect event
argument patterns
### Enhanced Diagnostic Messages
We've improved diagnostic messages across all analyzers to include
specific type and member names, making it easier to identify and fix
issues. Every analyzer now provides clearer, more actionable feedback.
### Symbol-Based Detection
Replaced string-based detection with comprehensive symbol-based analysis
for the `Raises` method, improving accuracy and performance of
event-related analyzers.
### Infrastructure Modernization
- **Migrated to .NET 10 SDK** for the latest tooling improvements
- **ARM64 runners** for faster CI/CD on modern hardware
- **Enhanced performance testing** with nightly regression detection
- **Automated dependency management** with Renovate
## 🎯 Breaking Changes
### Minimum SDK Version
Moq.Analyzers now requires **minimum .NET SDK 8** for development. This
aligns with the long-term support release and enables us to leverage
modern C# features.
## 🔧 Analyzer Improvements
### Coverage Expansion
We've significantly expanded test coverage for all Moq patterns:
- **Event patterns**: Comprehensive coverage for `SetupAdd`,
`SetupRemove`, `Raises`, and `RaisesAsync`
- **Async methods**: Full support for `Task`/`ValueTask` patterns
- **LINQ to Mocks**: Complete validation of query expressions
- **MockRepository**: Validation for repository-based mock creation
- **Argument matching**: Coverage for all `It.*` and custom matcher
patterns
- **Protected members**: Validation for `.Protected().Setup()` patterns
- **Callback signatures**: Advanced callback pattern support including
generic scenarios
### Moq 4.16+ Compatibility
... (truncated)
## 0.3.1
## Minor Bug Fix
fix: exception in code fix of explicit mock behavior
(https://github.com/rjmurillo/moq.analyzers/pull/701) @Youssef1313
#701
**Full Changelog**:
https://github.com/rjmurillo/moq.analyzers/compare/v0.3.0...v0.3.1
## 0.3.0
Moq.Analyzers v0.3.0 🎄
Holidays are coming and it's time for the last release of the year! 🎉
There's a lot that has gone into this release, mostly housekeeping and
bug fixes that are transparent to you. However, there are two new
diagnostics included in this release.
This will be the last release until we move to **v1.0.0**
## Analyzer Behavior Changes
* Remove false positive for Moq1200 when using parameterized lambda by
@rjmurillo in https://github.com/rjmurillo/moq.analyzers/pull/301
* Add new rule to enforce MockBehavior.Strict (Moq1410) by @rjmurillo
in https://github.com/rjmurillo/moq.analyzers/pull/302
## What's Changed
* Bump Nerdbank.GitVersioning from 3.6.143 to 3.6.146 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/232
* Bump Microsoft.Diagnostics.Tracing.TraceEvent from 3.1.15 to 3.1.16 by
@dependabot in https://github.com/rjmurillo/moq.analyzers/pull/228
* Add IOperation to DiagnosticExtensions and clean up overloads by
@MattKotsenas in https://github.com/rjmurillo/moq.analyzers/pull/233
* Bump nbgv from 3.6.143 to 3.6.146 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/230
* Bump Meziantou.Analyzer from 2.0.169 to 2.0.173 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/231
* Create a shared Common .projitems by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/235
* Remove ECS0200 suppression and update WellKnownTypes to not trigger
ECS0600 by @rjmurillo in
https://github.com/rjmurillo/moq.analyzers/pull/236
* Add BannedApiAnalyzer and ban direct use of Diagnostic.Create by
@MattKotsenas in https://github.com/rjmurillo/moq.analyzers/pull/239
* Add *.props and *.targets to XML section of .editorconfig template by
@MattKotsenas in https://github.com/rjmurillo/moq.analyzers/pull/240
* Bump Meziantou.Analyzer from 2.0.173 to 2.0.175 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/237
* Remove dead suppressions and dead code by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/242
* Add rule suppression docs to README and each rule by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/241
* Bump Meziantou.Analyzer from 2.0.175 to 2.0.176 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/243
* Disable SquiggleCop for PerfDiff by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/244
* Bump Roslynator.Analyzers from 4.12.8 to 4.12.9 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/246
* Bump Verify.Xunit from 27.0.1 to 27.1.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/247
* Use WellKnownTypeProvider + KnownSymbols pattern to simplify analyzers
by @MattKotsenas in https://github.com/rjmurillo/moq.analyzers/pull/245
* Bump Polyfill from 7.1.2 to 7.2.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/248
* Bump Verify.Xunit from 27.1.0 to 28.0.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/251
* Bump Meziantou.Analyzer from 2.0.176 to 2.0.177 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/249
* Bump Verify.Xunit from 28.0.0 to 28.1.3 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/253
* Bump Polyfill from 7.2.0 to 7.4.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/256
* Bump EffectiveCSharp.Analyzers from 0.1.0 to 0.2.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/250
* Bump Verify.Xunit from 28.1.3 to 28.2.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/257
* Update global.json to SDK 9 by @rjmurillo in
https://github.com/rjmurillo/moq.analyzers/pull/263
* Bump Meziantou.Analyzer from 2.0.177 to 2.0.179 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/262
* Bump ReportGenerator from 5.3.11 to 5.4.1 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/264
* Bump Verify.Xunit from 28.2.0 to 28.3.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/265
* Remove forced lf in .editorconfig by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/271
* Reduce severity of S3267: Loops should be simplified with "LINQ"
expressions by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/272
* Bump GetPackFromProject to fix race in .NET 9 SDK by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/274
* Bump Polyfill from 7.4.0 to 7.5.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/270
* Move "upload binlogs" CI step earlier in pipeline and run even if
failed by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/273
* Bump Verify.Xunit from 28.3.0 to 28.3.2 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/269
* Bump Microsoft.CodeAnalysis.BannedApiAnalyzers from
3.11.0-beta1.24454.1 to 3.11.0-beta1.24508.2 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/268
* Bump Meziantou.Analyzer from 2.0.179 to 2.0.181 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/275
... (truncated)
## 0.3.0-alpha.1
This is a small update to include a bug fix for code analyzers crashing
in the IDE.
## Full list of What's Changed
* Add AnalyzerUtilities to NuGet package by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/326
**Full Changelog**:
https://github.com/rjmurillo/moq.analyzers/compare/v0.3.0-alpha...v0.3.0-alpha.1
## 0.3.0-alpha
Moq.Analyzers v0.3.0 🎄
Holidays are coming and it's time for the last release of the year! 🎉
There's a lot that has gone into this release, mostly housekeeping and
bug fixes that are transparent to you. However, there are two new
diagnostics included in this release.
This will be the last release until we move to **v1.0.0**
## Analyzer Behavior Changes
* Remove false positive for Moq1200 when using parameterized lambda by
@rjmurillo in https://github.com/rjmurillo/moq.analyzers/pull/301
* Add new rule to enforce MockBehavior.Strict (Moq1410) by @rjmurillo
in https://github.com/rjmurillo/moq.analyzers/pull/302
## Full List of What's Changed
* Bump Nerdbank.GitVersioning from 3.6.143 to 3.6.146 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/232
* Bump Microsoft.Diagnostics.Tracing.TraceEvent from 3.1.15 to 3.1.16 by
@dependabot in https://github.com/rjmurillo/moq.analyzers/pull/228
* Add IOperation to DiagnosticExtensions and clean up overloads by
@MattKotsenas in https://github.com/rjmurillo/moq.analyzers/pull/233
* Bump nbgv from 3.6.143 to 3.6.146 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/230
* Bump Meziantou.Analyzer from 2.0.169 to 2.0.173 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/231
* Create a shared Common .projitems by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/235
* Remove ECS0200 suppression and update WellKnownTypes to not trigger
ECS0600 by @rjmurillo in
https://github.com/rjmurillo/moq.analyzers/pull/236
* Add BannedApiAnalyzer and ban direct use of Diagnostic.Create by
@MattKotsenas in https://github.com/rjmurillo/moq.analyzers/pull/239
* Add *.props and *.targets to XML section of .editorconfig template by
@MattKotsenas in https://github.com/rjmurillo/moq.analyzers/pull/240
* Bump Meziantou.Analyzer from 2.0.173 to 2.0.175 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/237
* Remove dead suppressions and dead code by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/242
* Add rule suppression docs to README and each rule by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/241
* Bump Meziantou.Analyzer from 2.0.175 to 2.0.176 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/243
* Disable SquiggleCop for PerfDiff by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/244
* Bump Roslynator.Analyzers from 4.12.8 to 4.12.9 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/246
* Bump Verify.Xunit from 27.0.1 to 27.1.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/247
* Use WellKnownTypeProvider + KnownSymbols pattern to simplify analyzers
by @MattKotsenas in https://github.com/rjmurillo/moq.analyzers/pull/245
* Bump Polyfill from 7.1.2 to 7.2.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/248
* Bump Verify.Xunit from 27.1.0 to 28.0.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/251
* Bump Meziantou.Analyzer from 2.0.176 to 2.0.177 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/249
* Bump Verify.Xunit from 28.0.0 to 28.1.3 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/253
* Bump Polyfill from 7.2.0 to 7.4.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/256
* Bump EffectiveCSharp.Analyzers from 0.1.0 to 0.2.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/250
* Bump Verify.Xunit from 28.1.3 to 28.2.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/257
* Update global.json to SDK 9 by @rjmurillo in
https://github.com/rjmurillo/moq.analyzers/pull/263
* Bump Meziantou.Analyzer from 2.0.177 to 2.0.179 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/262
* Bump ReportGenerator from 5.3.11 to 5.4.1 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/264
* Bump Verify.Xunit from 28.2.0 to 28.3.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/265
* Remove forced lf in .editorconfig by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/271
* Reduce severity of S3267: Loops should be simplified with "LINQ"
expressions by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/272
* Bump GetPackFromProject to fix race in .NET 9 SDK by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/274
* Bump Polyfill from 7.4.0 to 7.5.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/270
* Move "upload binlogs" CI step earlier in pipeline and run even if
failed by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/273
* Bump Verify.Xunit from 28.3.0 to 28.3.2 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/269
* Bump Microsoft.CodeAnalysis.BannedApiAnalyzers from
3.11.0-beta1.24454.1 to 3.11.0-beta1.24508.2 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/268
* Bump Meziantou.Analyzer from 2.0.179 to 2.0.181 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/275
... (truncated)
## 0.2.0
## Changes
* Add rule to explicitly pick MockBehavior by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/226
* Fix false detection in Moq1201 in Moq 4.16.0 by @rjmurillo in
https://github.com/rjmurillo/moq.analyzers/pull/224
* Fix false detection in Moq1200 using async tasks by @rjmurillo in
https://github.com/rjmurillo/moq.analyzers/pull/221
## Housekeeping
* Add CODEOWNERS by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/193
* Bump Verify.Xunit from 26.2.0 to 26.4.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/197
* Bump Microsoft.NET.Test.Sdk from 17.11.0 to 17.11.1 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/196
* Bump DotNet.ReproducibleBuilds from 1.2.4 to 1.2.25 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/201
* Bump DotNet.ReproducibleBuilds.Isolated from 1.2.4 to 1.2.25 by
@dependabot in https://github.com/rjmurillo/moq.analyzers/pull/200
* Bump Verify.Xunit from 26.4.0 to 26.4.4 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/199
* Bump ReportGenerator from 5.3.8 to 5.3.9 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/195
* Update SDK to get newer version of Source Link by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/202
* Bump Verify.Xunit from 26.4.4 to 26.5.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/205
* Bump Roslynator.Analyzers from 4.12.4 to 4.12.5 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/204
* Bump Verify.Xunit from 26.5.0 to 26.6.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/207
* Bump Meziantou.Analyzer from 2.0.163 to 2.0.168 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/206
* Bump Roslynator.Analyzers from 4.12.5 to 4.12.6 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/209
* Bump ReportGenerator from 5.3.9 to 5.3.10 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/212
* Bump Roslynator.Analyzers from 4.12.6 to 4.12.7 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/213
* Bump Meziantou.Analyzer from 2.0.168 to 2.0.169 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/211
* Bump xunit from 2.9.0 to 2.9.2 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/210
* Use dotnet template for .gitattributes by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/215
**Full Changelog**:
https://github.com/rjmurillo/moq.analyzers/compare/v0.1.2...v0.2.0
## 0.1.2
## What's Changed
Lots of housekeeping and a couple of fixes and enhancements.
### Enhancements and Bug fixes
* Add Mock.Of<T> and MockRepository support to
ConstructorArgumentsShouldMatchAnalyzer by @rjmurillo in
https://github.com/rjmurillo/moq.analyzers/pull/140
* Moq1100 incorrectly firing on nullable parameters by @marcovr
@rjmurillo in https://github.com/rjmurillo/moq.analyzers/pull/187
### Other Changes
* Update version.json to 0.2.0 by @rjmurillo in
https://github.com/rjmurillo/moq.analyzers/pull/142
* Remove CSharpGuidelinesAnalyzer and associated editorconfig values by
@rjmurillo in https://github.com/rjmurillo/moq.analyzers/pull/145
* Bump ReportGenerator from 5.3.6 to 5.3.7 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/138
* Bump Newtonsoft.Json from 13.0.1 to 13.0.3 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/134
* Bump Microsoft.Extensions.Logging from 6.0.0-preview.5.21301.5 to
8.0.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/132
* Bump Microsoft.Diagnostics.Tracing.TraceEvent from 3.0.2 to 3.1.12 by
@dependabot in https://github.com/rjmurillo/moq.analyzers/pull/131
* Bump Meziantou.Analyzer from 2.0.159 to 2.0.160 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/151
* Bump xunit from 2.8.1 to 2.9.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/148
* Bump xunit.runner.visualstudio from 2.8.1 to 2.8.2 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/149
* Bump Verify.Xunit from 25.0.4 to 25.3.1 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/152
* Bump SonarAnalyzer.CSharp from 9.28.0.94264 to 9.29.0.95321 by
@dependabot in https://github.com/rjmurillo/moq.analyzers/pull/154
* Bump Verify.Xunit from 25.3.1 to 25.3.2 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/158
* Bump Microsoft.Diagnostics.Tracing.TraceEvent from 3.1.12 to 3.1.13 by
@dependabot in https://github.com/rjmurillo/moq.analyzers/pull/157
* Bump Meziantou.Analyzer from 2.0.160 to 2.0.161 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/156
* Bump ReportGenerator from 5.3.7 to 5.3.8 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/155
* Bump Verify.Xunit from 25.3.2 to 26.1.5 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/164
* Bump Meziantou.Analyzer from 2.0.161 to 2.0.162 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/163
* Bump SonarAnalyzer.CSharp from 9.29.0.95321 to 9.30.0.95878 by
@dependabot in https://github.com/rjmurillo/moq.analyzers/pull/160
* Enable TreatWarningsAsErrors by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/165
* Disable rollForward for SDK in global.json by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/170
* Add SquiggleCop to baseline analyzer settings by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/166
* Bump Verify.Xunit from 26.1.5 to 26.1.6 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/168
* Bump Meziantou.Xunit.ParallelTestFramework from 2.2.0 to 2.3.0 by
@dependabot in https://github.com/rjmurillo/moq.analyzers/pull/169
* Bump Meziantou.Analyzer from 2.0.162 to 2.0.163 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/167
* Update SquiggleCop and remove ErrorLog property by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/174
* Bump SonarAnalyzer.CSharp from 9.30.0.95878 to 9.31.0.96804 by
@dependabot in https://github.com/rjmurillo/moq.analyzers/pull/175
* Bump Nerdbank.GitVersioning from 3.6.139 to 3.6.141 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/178
* Bump Verify.Xunit from 26.1.6 to 26.2.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/180
* Bump Microsoft.VisualStudio.Threading.Analyzers from 17.10.48 to
17.11.20 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/181
* Bump nbgv from 3.6.139 to 3.6.141 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/179
* Bump SquiggleCop.Tasks from 1.0.13 to 1.0.26 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/185
* Bump squigglecop.tool from 1.0.13 to 1.0.26 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/186
* Bump Microsoft.NET.Test.Sdk from 17.10.0 to 17.11.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/184
* Bump SonarAnalyzer.CSharp from 9.31.0.96804 to 9.32.0.97167 by
@dependabot in https://github.com/rjmurillo/moq.analyzers/pull/183
* Add Effective C# analyzers and update SquiggleCop baselines by
@rjmurillo in https://github.com/rjmurillo/moq.analyzers/pull/182
* Bump Nerdbank.GitVersioning from 3.6.141 to 3.6.143 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/189
* Bump Microsoft.Diagnostics.Tracing.TraceEvent from 3.1.13 to 3.1.15 by
@dependabot in https://github.com/rjmurillo/moq.analyzers/pull/190
* Bump nbgv from 3.6.141 to 3.6.143 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/188
* Bump dependabot/fetch-metadata from 1.1.1 to 2.2.0 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/192
... (truncated)
## 0.1.1
Lots of "housekeeping" this release, and a few bug fixes. We also now
have rule documentation! Special thanks to @MattKotsenas for his
contributions to make working on the analyzers easier and improving our
confidence and productivity.
**Full Changelog**:
https://github.com/rjmurillo/moq.analyzers/compare/v0.1.0...v0.1.1
## What's Changed
Ownership of the `Moq.Analyzers` and `Moq.Autocomplete` has been
transferred from @Litee to @rjmurillo.
### Bug fixes
* Moq1002: Update constructor checks by @rjmurillo in
https://github.com/rjmurillo/moq.analyzers/pull/115. This resolves #55
by @MattKotsenas
* Refactor Moq1300 to use IOperation-based analysis by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/125
### Changes to rules
There _should_ be no behavioral differences with these changes to the
rule code. If you find any, please [submit a new
issue](https://github.com/rjmurillo/moq.analyzers/issues/new).
* Clean up README and add docs for each analyzer rule by @MattKotsenas
in https://github.com/rjmurillo/moq.analyzers/pull/77
* Add analyzer release tracking by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/84
* Add cancellation tokens to methods that have a parameter but we don't
pass by @rjmurillo in
https://github.com/rjmurillo/moq.analyzers/pull/52
* Enable ConcurrentExecution and disable generated code analysis by
@MattKotsenas in https://github.com/rjmurillo/moq.analyzers/pull/70
* Update code to remove warnings from backlog by @rjmurillo in
https://github.com/rjmurillo/moq.analyzers/pull/73
* Remove RegEx from analyzers by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/81
* Remove period from analyzer messages and inline in the analyzer
classes by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/86
### Updates to test and infrastructure
* Refactor tests to simplify and inline test cases by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/57
* Update analysis mode and warning level to preview and 9999 by
@rjmurillo in https://github.com/rjmurillo/moq.analyzers/pull/59
* Extract code analysis to its own build slice and update analyzers to
latest versions by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/60
* Move test packages to build slice, update to latest version, and
enable parallel tests by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/61
* Replace our custom test harness with `Microsoft.CodeAnalysis` testing
harness by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/65
* Clean up of using statements by @rjmurillo in
https://github.com/rjmurillo/moq.analyzers/pull/66
* Rename `master` to `main` by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/69
* Cache reference assemblies between tests to improve performance by
@MattKotsenas in https://github.com/rjmurillo/moq.analyzers/pull/71
* Convert from var to explicit type by @rjmurillo in
https://github.com/rjmurillo/moq.analyzers/pull/74
* Refactor unit tests: data driven tests and leverage
`Microsoft.CodeAnalysis.Testing` patterns by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/76
* Add Code coverage report by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/79
* Fix `dotnet test` when not generating code coverage reports by
@MattKotsenas in https://github.com/rjmurillo/moq.analyzers/pull/80
* Refactor test cases to matrix on `Moq` version by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/82
* Fix SA0001: XML comment analysis is disabled due to project
configuration by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/87
* Fix trivial warnings by @MattKotsenas in
https://github.com/rjmurillo/moq.analyzers/pull/88
* Update README.md to add leading and trailing pipes in table by
@rjmurillo in https://github.com/rjmurillo/moq.analyzers/pull/94
* Create dependabot.yml by @rjmurillo in
https://github.com/rjmurillo/moq.analyzers/pull/93
* Update main.yml to add codacy test coverage by @rjmurillo in
https://github.com/rjmurillo/moq.analyzers/pull/92
* Add more analyzers and bump `Meziantou.Analzer` to latest version by
@rjmurillo in https://github.com/rjmurillo/moq.analyzers/pull/89
* Bump `Verify.Xunit` from 25.0.1 to 25.0.3 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/100
* Remove `Microsoft.CodeAnalysis.CSharp.Analyzer.Testing` by
@MattKotsenas in https://github.com/rjmurillo/moq.analyzers/pull/102
* Dependabot ignore packages that impact customer compatibility by
@MattKotsenas in https://github.com/rjmurillo/moq.analyzers/pull/101
* Bump `Microsoft.CodeAnalysis.CSharp.CodeFix.Testing` from
1.1.2-beta1.24273.1 to 1.1.2-beta1.24314.1 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/103
* Bump `Nerdbank.GitVersioning` from 3.6.133 to 3.6.139 by @dependabot
in https://github.com/rjmurillo/moq.analyzers/pull/99
* Bump `Meziantou.Analyzer` from 2.0.155 to 2.0.158 by @dependabot in
https://github.com/rjmurillo/moq.analyzers/pull/96
... (truncated)
## 0.1.0
## What's Changed
* Remove the Visual Studio Extension VSIX by @rjmurillo in
https://github.com/Litee/moq.analyzers/pull/16
* Update TargetFramework to NET Standard 2.0 by @rjmurillo in
https://github.com/Litee/moq.analyzers/pull/17
* Update constructor analyzer (Moq1002) to validate parameters of
abstract classes by @rjmurillo in
https://github.com/Litee/moq.analyzers/pull/20, fixes #1
### Non-functional Changes
* Create codeql.yml to analyze C# code by @rjmurillo in
https://github.com/Litee/moq.analyzers/pull/9
* Create a basic GitHub Actions pipeline by @MattKotsenas in
https://github.com/Litee/moq.analyzers/pull/18
* Fix GitHub actions branch 'main' -> 'master' by @MattKotsenas in
https://github.com/Litee/moq.analyzers/pull/21
* Use .NET 8 SDK's artifacts output and enable test reports in CI by
@MattKotsenas in https://github.com/Litee/moq.analyzers/pull/23
* Update Moq.Analyzers.Test.csproj to NET 8 by @rjmurillo in
https://github.com/Litee/moq.analyzers/pull/24
* Migrate from ApprovalTests to Verify by @MattKotsenas in
https://github.com/Litee/moq.analyzers/pull/25
* Update main.yml to upload .received on failure by @rjmurillo in
https://github.com/Litee/moq.analyzers/pull/34
* Add .nupkg baseline with Verify by @MattKotsenas in
https://github.com/Litee/moq.analyzers/pull/30
* Add nbgv tool to automate versioning by @MattKotsenas in
https://github.com/Litee/moq.analyzers/pull/35
* Add .gitattributes file and normalize line endings by @rjmurillo in
https://github.com/Litee/moq.analyzers/pull/33
* Add .editorconfig and enable code analysis by @MattKotsenas in
https://github.com/Litee/moq.analyzers/pull/37
* Convert to Central Package Management with transitive pinning enabled
by @MattKotsenas in https://github.com/Litee/moq.analyzers/pull/39
* Set package README, license expression, and development dependency by
@MattKotsenas in https://github.com/Litee/moq.analyzers/pull/41
* Move usings to top of file and using file-scoped namespaces by
@MattKotsenas in https://github.com/Litee/moq.analyzers/pull/40
* Follow reproducible builds best practices for package by
@MattKotsenas in https://github.com/Litee/moq.analyzers/pull/44
* Remove package dependencies and don't publish analyzer as a lib by
@MattKotsenas in https://github.com/Litee/moq.analyzers/pull/49
* Update Moq.Analyzers.csproj NuGet package metadata by @rjmurillo in
https://github.com/Litee/moq.analyzers/pull/50
## New Contributors
* @MattKotsenas made their first contribution in
https://github.com/Litee/moq.analyzers/pull/18
**Full Changelog**:
https://github.com/Litee/moq.analyzers/compare/v0.0.9...v0.1.0
Commits viewable in [compare
view](https://github.com/rjmurillo/moq.analyzers/compare/v0.0.9...v0.4.0).
</details>
Updated [Roslynator.Analyzers](https://github.com/dotnet/roslynator)
from 4.12.9 to 4.15.0.
<details>
<summary>Release notes</summary>
_Sourced from [Roslynator.Analyzers's
releases](https://github.com/dotnet/roslynator/releases)._
## 4.15.0
### Added
- Add option
`roslynator_null_conditional_operator.avoid_negative_boolean_comparison`
([PR](https://github.com/dotnet/roslynator/pull/1688))
- Do not suggest to use null-conditional operator when result would be
`... != true/false`
- Applicable for
[RCS1146](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1146)
### Fixed
- Fix analyzer
[RCS1172](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1172)
([PR](https://github.com/dotnet/roslynator/pull/1710))
- [CLI] Fix `loc` command
([PR](https://github.com/dotnet/roslynator/pull/1711))
- Exclude ref-field backed properties from
[RCS1085](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1085)
([PR](https://github.com/dotnet/roslynator/pull/1718) by @ovska)
- [CLI] Fix `rename-symbol` scope option not being applied correctly
([PR](https://github.com/dotnet/roslynator/pull/1720) by @andrtmschkw)
- [CLI] Fix `rename-symbol` support for top-level statement
([PR](https://github.com/dotnet/roslynator/pull/1721) by @andrtmschkw)
### Changed
- Migrate to .NET 10 (including command-line tool)
([PR](https://github.com/dotnet/roslynator/pull/1727))
## 4.14.1
### Added
- [CLI] Add support for `slnx` files
([PR](https://github.com/dotnet/roslynator/pull/1662) by @darthtrevino)
- Bump Roslyn to 4.14.0
- Drop support for .NET 7 SDK
### Fixed
- Fix analyzer
[RCS1246](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1246)
([PR](https://github.com/dotnet/roslynator/pull/1676))
- Fix analyzer
[RCS1248](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1248)
([PR](https://github.com/dotnet/roslynator/pull/1677))
- Fix analyzer
[RCS1203](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1203)
([PR](https://github.com/dotnet/roslynator/pull/1683))
- Fix analyzer
[RCS1043](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1043)
([PR](https://github.com/dotnet/roslynator/pull/1684))
- Fix analyzer
[RCS1213](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1213)
([PR](https://github.com/dotnet/roslynator/pull/1686))
- Add unity method `OnRectTransformDimensionsChange`
- Fix analyzer
[RCS1253](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1253)
([PR](https://github.com/dotnet/roslynator/pull/1687))
- Fix refactoring [Check expression for
null](https://josefpihrt.github.io/docs/roslynator/refactorings/RR0024)
([PR](https://github.com/dotnet/roslynator/pull/1682))
### Changed
- Change behavior of analyzer
[RCS1206](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1206)
([PR](https://github.com/dotnet/roslynator/pull/1685))
- The condition for option `omit_when_single_line` will be that the
braces/brackets are on the same line, not just the expression in the
braces/brackets
## 4.14.0
### Added
- [CLI] Add support for GitLab analyzer reports
([PR](https://github.com/dotnet/roslynator/pull/1633))
### Fixed
- Fix analyzer
[RCS1264](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1264)
([PR](https://github.com/dotnet/roslynator/pull/1666))
- Fix analyzer
[RCS1229](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1229)
([PR](https://github.com/dotnet/roslynator/pull/1667))
- Fix analyzer
[RCS1250](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1250)
([PR](https://github.com/dotnet/roslynator/pull/1652) by @aihnatiuk)
- Fix analyzer
[RCS1260](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1260)
([PR](https://github.com/dotnet/roslynator/pull/1668))
- Fix analyzer
[RCS1105](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1105)
([PR](https://github.com/dotnet/roslynator/pull/1669))
- Fix analyzer
[RCS1260](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1260)
([PR](https://github.com/dotnet/roslynator/pull/1672))
### Changed
- Disable analyzer
[RCS1036](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1036)
by default ([PR](https://github.com/dotnet/roslynator/pull/1671))
- Use analyzer
[RCS0063](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0063)
instead
### Removed
- Remove legacy config options
([PR](https://github.com/dotnet/roslynator/pull/1304))
## 4.13.1
### Added
- Support custom path of a test file
([PR](https://github.com/dotnet/roslynator/pull/1609))
- It's possible to specify a directory path and/or a file name of a test
file.
- Applies to testing library (Roslynator.Testing.*).
## 4.13.0
### Fixed
- Fix analyzer
[RCS1229](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1229)
([PR](https://github.com/dotnet/roslynator/pull/1618))
- Fix analyzer
[RCS1174](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1174)
([PR](https://github.com/dotnet/roslynator/pull/1619))
- Fix analyzer
[RCS0010](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0010)
([PR](https://github.com/dotnet/roslynator/pull/1620))
- Fix analyzer
[RCS0005](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0005)
([PR](https://github.com/dotnet/roslynator/pull/1621))
### Added
- Add analyzer "Put expression body on its own line"
[RCS0062](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0062)
([PR](https://github.com/dotnet/roslynator/pull/1593) by @cbersch)
- Affects analyzer
[RCS1016](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1016)
- Affects refactoring
[RR0169](https://josefpihrt.github.io/docs/roslynator/refactorings/RR0169)
### Changed
- Move analyzer
[RCS1036](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1036)
to Formatting.Analyzers as
[RCS0063](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0063)
([PR](https://github.com/dotnet/roslynator/pull/1600))
- Old analyzer still works but is marked as obsolete.
- Bump Roslyn to 4.12.0
([PR](https://github.com/dotnet/roslynator/pull/1623))
- Applies to CLI and testing library.
- Bump `Microsoft.Build.Locator` to 1.7.8
([PR](https://github.com/dotnet/roslynator/pull/1622))
## 4.12.11
### Added
- [CLI] Add support for .NET 9
([PR](https://github.com/dotnet/roslynator/pull/1605))
### Fixed
- Fix refactoring 'Change accessibility'
([RR0186](https://josefpihrt.github.io/docs/roslynator/refactorings/RR0186))
([PR](https://github.com/dotnet/roslynator/pull/1599))
- Fix analyzer
[RCS1264](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1264)
([PR](https://github.com/dotnet/roslynator/pull/1604))
### Changed
- Move `DiagnosticRules` and `DiagnosticIdentifiers` to
`Roslynator.Common`
([PR](https://github.com/dotnet/roslynator/pull/1597))
## 4.12.10
### Fixed
- Fix analyzer
[RCS1213](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1213)
([PR](https://github.com/dotnet/roslynator/pull/1586))
- Improve code fixe…
Change adds two related types and refactors the analyzers such that the string-based
WellKnownMockTypescan be deleted. These changes unlock additional refactoring, but I stopped to get feedback.The main changes are:
WellKnownTypeProvider
WellKnownTypeProvider comes from roslyn-analyzers. It caches
ISymbollookups for a givenCompilationto amortize costs across all the analyzers running for a given compilation. It also enforces some best practices when looking for "well known" symbols in the cases of name collisions.KnownSymbols
KnownSymbols comes from typeshape-csharp to simplify looking up types in the WellKnownTypeProvider. In this change only types are cached, the member lookups (methods, fields, etc.) are not. However, Roslyn internally caches, so it isn't clear that's needed.
Using the KnownSymbols pattern cleans up the code quite a bit. It does push us away from SyntaxNodes and towards Symbols, however I don't think that's a bad thing because we also want to migrate to the IOperation-based analysis, which already has the corresponding ISymbol available at the start of analysis.
The existing benchmarks show the new and old code (v0.1.0) to be within the margin of error.
Summary by CodeRabbit
New Features
BoundedCacheWithFactory.Bug Fixes
Documentation
Chores