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

Add analyzer release tracking #84

Merged
Merged
61 changes: 61 additions & 0 deletions Source/Moq.Analyzers/AnalyzerReleases.Shipped.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
; Shipped analyzer releases
; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md

## Release 0.0.1.22865

### New Rules

Rule ID | Category | Severity | Notes
--------|----------|----------|-------
Moq1101 | Moq | Warning | CallbackSignatureAnalyzer
Moq1002 | Moq | Warning | ShouldNotAllowParametersForMockedInterfaceAnalyzer
Moq1001 | Moq | Warning | ShouldNotMockSealedClassesAnalyzer

## Release 0.0.3.40797

### New Rules

Rule ID | Category | Severity | Notes
--------|----------|----------|-------
Moq1003 | Moq | Warning | MatchingConstructorParametersAnalyzer

## Release 0.0.4.43043

### New Rules

Rule ID | Category | Severity | Notes
--------|----------|----------|-------
Moq1100 | Moq | Warning | CallbackSignatureShouldMatchMockedMethodAnalyzer
Moq1000 | Moq | Warning | ConstructorArgumentsShouldMatchAnalyzer

## Release 0.0.6

### Removed Rules

Rule ID | Category | Severity | Notes
--------|----------|----------|-------
Moq1003 | Moq | Warning | ConstructorArgumentsShouldMatchAnalyzer

## Release 0.0.7

### New Rules

Rule ID | Category | Severity | Notes
--------|----------|----------|-------
Moq1200 | Moq | Error | SetupShouldBeUsedOnlyForOverridableMembersAnalyzer

## Release 0.0.8

### New Rules

Rule ID | Category | Severity | Notes
--------|----------|----------|-------
Moq1300 | Moq | Error | AsShouldBeUsedOnlyForInterfaceAnalyzer

## Release 0.0.9

### New Rules

Rule ID | Category | Severity | Notes
--------|----------|----------|-------
Moq1201 | Moq | Error | SetupShouldNotIncludeAsyncResultAnalyzer
MattKotsenas marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions Source/Moq.Analyzers/AnalyzerReleases.Unshipped.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
; Unshipped analyzer release
; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ public class AsShouldBeUsedOnlyForInterfaceAnalyzer : DiagnosticAnalyzer
{
private static readonly MoqMethodDescriptorBase MoqAsMethodDescriptor = new MoqAsMethodDescriptor();

private static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(
private static readonly DiagnosticDescriptor Rule = new(
Diagnostics.AsShouldBeUsedOnlyForInterfaceId,
Diagnostics.AsShouldBeUsedOnlyForInterfaceTitle,
Diagnostics.AsShouldBeUsedOnlyForInterfaceMessage,
Diagnostics.Category,
DiagnosticSeverity.Error,
isEnabledByDefault: true);
isEnabledByDefault: true,
helpLinkUri: $"https://github.com/rjmurillo/moq.analyzers/blob/main/docs/rules/{Diagnostics.AsShouldBeUsedOnlyForInterfaceId}.md");

public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Rule);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class CallbackSignatureShouldMatchMockedMethodAnalyzer : DiagnosticAnalyzer
{
private static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(
private static readonly DiagnosticDescriptor Rule = new(
Diagnostics.CallbackSignatureShouldMatchMockedMethodId,
Diagnostics.CallbackSignatureShouldMatchMockedMethodTitle,
Diagnostics.CallbackSignatureShouldMatchMockedMethodMessage,

Check warning on line 9 in Source/Moq.Analyzers/CallbackSignatureShouldMatchMockedMethodAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (windows-2022)

The diagnostic message should not contain any line return character nor any leading or trailing whitespaces and should either be a single sentence without a trailing period or a multi-sentences with a trailing period

Check warning on line 9 in Source/Moq.Analyzers/CallbackSignatureShouldMatchMockedMethodAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04)

The diagnostic message should not contain any line return character nor any leading or trailing whitespaces and should either be a single sentence without a trailing period or a multi-sentences with a trailing period
Diagnostics.Category,
DiagnosticSeverity.Warning,
isEnabledByDefault: true);
isEnabledByDefault: true,
helpLinkUri: $"https://github.com/rjmurillo/moq.analyzers/blob/main/docs/rules/{Diagnostics.CallbackSignatureShouldMatchMockedMethodId}.md");

public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
{
Expand Down Expand Up @@ -59,7 +60,7 @@
for (int i = 0; i < mockedMethodArguments.Count; i++)
{
TypeInfo mockedMethodArgumentType = context.SemanticModel.GetTypeInfo(mockedMethodArguments[i].Expression, context.CancellationToken);
TypeInfo lambdaParameterType = context.SemanticModel.GetTypeInfo(lambdaParameters[i].Type, context.CancellationToken);

Check warning on line 63 in Source/Moq.Analyzers/CallbackSignatureShouldMatchMockedMethodAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (windows-2022)

Possible null reference argument for parameter 'expression' in 'TypeInfo CSharpExtensions.GetTypeInfo(SemanticModel? semanticModel, ExpressionSyntax expression, CancellationToken cancellationToken = default(CancellationToken))'.

Check warning on line 63 in Source/Moq.Analyzers/CallbackSignatureShouldMatchMockedMethodAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04)

Possible null reference argument for parameter 'expression' in 'TypeInfo CSharpExtensions.GetTypeInfo(SemanticModel? semanticModel, ExpressionSyntax expression, CancellationToken cancellationToken = default(CancellationToken))'.
string? mockedMethodTypeName = mockedMethodArgumentType.ConvertedType?.ToString();
string? lambdaParameterTypeName = lambdaParameterType.ConvertedType?.ToString();
if (!string.Equals(mockedMethodTypeName, lambdaParameterTypeName, StringComparison.Ordinal))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class ConstructorArgumentsShouldMatchAnalyzer : DiagnosticAnalyzer
{
private static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(
private static readonly DiagnosticDescriptor Rule = new(
Diagnostics.ConstructorArgumentsShouldMatchId,
Diagnostics.ConstructorArgumentsShouldMatchTitle,
Diagnostics.ConstructorArgumentsShouldMatchMessage,

Check warning on line 11 in Source/Moq.Analyzers/ConstructorArgumentsShouldMatchAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (windows-2022)

The diagnostic message should not contain any line return character nor any leading or trailing whitespaces and should either be a single sentence without a trailing period or a multi-sentences with a trailing period

Check warning on line 11 in Source/Moq.Analyzers/ConstructorArgumentsShouldMatchAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04)

The diagnostic message should not contain any line return character nor any leading or trailing whitespaces and should either be a single sentence without a trailing period or a multi-sentences with a trailing period
Diagnostics.Category,
DiagnosticSeverity.Warning,
isEnabledByDefault: true);
isEnabledByDefault: true,
helpLinkUri: $"https://github.com/rjmurillo/moq.analyzers/blob/main/docs/rules/{Diagnostics.ConstructorArgumentsShouldMatchId}.md");

public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class NoConstructorArgumentsForInterfaceMockAnalyzer : DiagnosticAnalyzer
{
private static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(
private static readonly DiagnosticDescriptor Rule = new(
Diagnostics.NoConstructorArgumentsForInterfaceMockId,
Diagnostics.NoConstructorArgumentsForInterfaceMockTitle,
Diagnostics.NoConstructorArgumentsForInterfaceMockMessage,

Check warning on line 11 in Source/Moq.Analyzers/NoConstructorArgumentsForInterfaceMockAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (windows-2022)

The diagnostic message should not contain any line return character nor any leading or trailing whitespaces and should either be a single sentence without a trailing period or a multi-sentences with a trailing period

Check warning on line 11 in Source/Moq.Analyzers/NoConstructorArgumentsForInterfaceMockAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04)

The diagnostic message should not contain any line return character nor any leading or trailing whitespaces and should either be a single sentence without a trailing period or a multi-sentences with a trailing period
Diagnostics.Category,
DiagnosticSeverity.Warning,
isEnabledByDefault: true);
isEnabledByDefault: true,
helpLinkUri: $"https://github.com/rjmurillo/moq.analyzers/blob/main/docs/rules/{Diagnostics.NoConstructorArgumentsForInterfaceMockId}.md");

public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
{
Expand All @@ -29,7 +30,7 @@
{
ObjectCreationExpressionSyntax? objectCreation = (ObjectCreationExpressionSyntax)context.Node;

// TODO Think how to make this piece more elegant while fast

Check warning on line 33 in Source/Moq.Analyzers/NoConstructorArgumentsForInterfaceMockAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (windows-2022)

TODO Think how to make this piece more elegant while fast (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 33 in Source/Moq.Analyzers/NoConstructorArgumentsForInterfaceMockAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04)

TODO Think how to make this piece more elegant while fast (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)
GenericNameSyntax? genericName = objectCreation.Type as GenericNameSyntax;
if (objectCreation.Type is QualifiedNameSyntax qualifiedName)
{
Expand Down
5 changes: 3 additions & 2 deletions Source/Moq.Analyzers/NoMethodsInPropertySetupAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class NoMethodsInPropertySetupAnalyzer : DiagnosticAnalyzer
{
private static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(
private static readonly DiagnosticDescriptor Rule = new(
Diagnostics.NoMethodsInPropertySetupId,
Diagnostics.NoMethodsInPropertySetupTitle,
Diagnostics.NoMethodsInPropertySetupMessage,

Check warning on line 9 in Source/Moq.Analyzers/NoMethodsInPropertySetupAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (windows-2022)

The diagnostic message should not contain any line return character nor any leading or trailing whitespaces and should either be a single sentence without a trailing period or a multi-sentences with a trailing period

Check warning on line 9 in Source/Moq.Analyzers/NoMethodsInPropertySetupAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04)

The diagnostic message should not contain any line return character nor any leading or trailing whitespaces and should either be a single sentence without a trailing period or a multi-sentences with a trailing period
Diagnostics.Category,
DiagnosticSeverity.Warning,
isEnabledByDefault: true);
isEnabledByDefault: true,
helpLinkUri: $"https://github.com/rjmurillo/moq.analyzers/blob/main/docs/rules/{Diagnostics.NoMethodsInPropertySetupId}.md");

public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
{
Expand Down
5 changes: 3 additions & 2 deletions Source/Moq.Analyzers/NoSealedClassMocksAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class NoSealedClassMocksAnalyzer : DiagnosticAnalyzer
{
private static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(
private static readonly DiagnosticDescriptor Rule = new(
Diagnostics.NoSealedClassMocksId,
Diagnostics.NoSealedClassMocksTitle,
Diagnostics.NoSealedClassMocksMessage,

Check warning on line 9 in Source/Moq.Analyzers/NoSealedClassMocksAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (windows-2022)

The diagnostic message should not contain any line return character nor any leading or trailing whitespaces and should either be a single sentence without a trailing period or a multi-sentences with a trailing period

Check warning on line 9 in Source/Moq.Analyzers/NoSealedClassMocksAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04)

The diagnostic message should not contain any line return character nor any leading or trailing whitespaces and should either be a single sentence without a trailing period or a multi-sentences with a trailing period
Diagnostics.Category,
DiagnosticSeverity.Warning,
isEnabledByDefault: true);
isEnabledByDefault: true,
helpLinkUri: $"https://github.com/rjmurillo/moq.analyzers/blob/main/docs/rules/{Diagnostics.NoSealedClassMocksId}.md");

public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
{
Expand All @@ -27,7 +28,7 @@
{
ObjectCreationExpressionSyntax? objectCreation = (ObjectCreationExpressionSyntax)context.Node;

// TODO Think how to make this piece more elegant while fast

Check warning on line 31 in Source/Moq.Analyzers/NoSealedClassMocksAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (windows-2022)

TODO Think how to make this piece more elegant while fast (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 31 in Source/Moq.Analyzers/NoSealedClassMocksAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04)

TODO Think how to make this piece more elegant while fast (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)
GenericNameSyntax? genericName = objectCreation.Type as GenericNameSyntax;
if (objectCreation.Type is QualifiedNameSyntax qualifiedName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ namespace Moq.Analyzers;
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class SetupShouldBeUsedOnlyForOverridableMembersAnalyzer : DiagnosticAnalyzer
{
private static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(
private static readonly DiagnosticDescriptor Rule = new(
Diagnostics.SetupShouldBeUsedOnlyForOverridableMembersId,
Diagnostics.SetupShouldBeUsedOnlyForOverridableMembersTitle,
Diagnostics.SetupShouldBeUsedOnlyForOverridableMembersMessage,
Diagnostics.Category,
DiagnosticSeverity.Error,
isEnabledByDefault: true);
isEnabledByDefault: true,
helpLinkUri: $"https://github.com/rjmurillo/moq.analyzers/blob/main/docs/rules/{Diagnostics.SetupShouldBeUsedOnlyForOverridableMembersId}.md");

public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Rule);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class SetupShouldNotIncludeAsyncResultAnalyzer : DiagnosticAnalyzer
{
private static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(
private static readonly DiagnosticDescriptor Rule = new(
Diagnostics.SetupShouldNotIncludeAsyncResultId,
Diagnostics.SetupShouldNotIncludeAsyncResultTitle,
Diagnostics.SetupShouldNotIncludeAsyncResultMessage,
Diagnostics.Category,
DiagnosticSeverity.Error,
isEnabledByDefault: true);
isEnabledByDefault: true,
helpLinkUri: $"https://github.com/rjmurillo/moq.analyzers/blob/main/docs/rules/{Diagnostics.SetupShouldNotIncludeAsyncResultId}.md");

public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Rule);

Expand Down
Loading