Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review analyzer Description, Message, and Category #85

Open
3 tasks
MattKotsenas opened this issue Jun 12, 2024 · 0 comments
Open
3 tasks

Review analyzer Description, Message, and Category #85

MattKotsenas opened this issue Jun 12, 2024 · 0 comments
Labels
analyzers Change that impacts an analyzer behavior housekeeping .NET Pull requests that update .net code
Milestone

Comments

@MattKotsenas
Copy link
Collaborator

I'm not sure we're following best practices for the strings for analyzers.

  • Currently our Message doesn't accept any format strings, it probably belongs in Description instead
  • We should have a Message that includes the text of whatever's incorrect (via the {0} format strings)
  • All analyzers are currently in the "Moq" category; should these instead be in the "Usage" or another category?
MattKotsenas added a commit that referenced this issue Jun 13, 2024
…es (#86)

Fix RS1032 by removing the period from the end of the analyzer messages.
I also inlined the constants into the appropriate analyzer class instead
of in a shared constants class. This makes future refactoring of the
tests easier, as now the analyzer's ID is part of the analyzer itself.

I also filed #85 to track potential changes to our message and
categories.
@rjmurillo rjmurillo added housekeeping .NET Pull requests that update .net code analyzers Change that impacts an analyzer behavior labels Jun 18, 2024
@rjmurillo rjmurillo added this to the Future milestone Jun 24, 2024
rjmurillo added a commit that referenced this issue Jul 14, 2024
…ldMatchAnalyzer (#140)

The majority of this change is mechanical (moving code from one location
to another, replacing magic strings with constants, etc.). There is a
functional update that completely changes the
`ConstructorArgumentsShouldMatchAnalyzer`:

- consolidating two constructor analyzers now into a single shared
source
- improving the performance of the constructor analyzer
- adding support for checking delegate
- adding support for `Mock.Of<T>` and `MockRepository` features of `Moq`


![image](https://github.com/rjmurillo/moq.analyzers/assets/6811113/cf6e2e52-237c-4f5e-bdc8-dadb0026eeba)
_Baseline is an empty analyzer, control is the old interface constructor
parameter analyzer, treatment is the new combined analyzer._

Changes

Misc:
- Reduced severity of AV analyzer items (see #139)
- Move magic strings to constants
- Moved much of the common code into a `Common` folder and namespace

Documentation:
- Fixed links to documentation for shipped analyzers
- In analyzer rule help, link to commit id so documentation snaps to the
version of the analyzer

Analyzers:
- Moved rule ID to constants file
- Added extension factory methods to help create `Diagnostic`
- Consolidated two constructor parameter analyzers (Moq1001 and Moq1002)
into a single analyzer with 30% better performance
- `ConstructorArgumentsShouldMatchAnalyzer` now supports `Mock.Of<T>`
syntax and `MockRepository` patterns

Benchmarks:
- Add the ability to have a control and treatment as well as "baseline",
allowing A/B performance benchmarking of implementations
- Added benchmark for `ConstructorArgumentsShouldMatchAnalyzer`

Test:
- Added extension methods to include all Moq versions under test or just
the latest
- Organized the `ConstructorArgumentsShouldMatchAnalyzer` test
collateral (it's the highest volume) into partial files
- Added Live Unit Test configuration when running in Visual Studio
- Added code coverage filter for benchmark code if using ReSharper or
Rider

_Note: while code coverage is improved, it's still below 95%. This is
due to some guard cases that need coverage. For example, #141_

Resolves #122
For Moq1001 and Moq1002, #85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzers Change that impacts an analyzer behavior housekeeping .NET Pull requests that update .net code
Projects
None yet
Development

No branches or pull requests

2 participants