Skip to content

Commit

Permalink
Add help link and add analyzers as unshipped
Browse files Browse the repository at this point in the history
I tried to put the base URL into a helper, but the analyzer is unable to
generate the documentation link if the value isn't a compile-time
constant.
  • Loading branch information
MattKotsenas committed Jun 12, 2024
1 parent 6b2d49f commit 403f5b0
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 16 deletions.
17 changes: 17 additions & 0 deletions Source/Moq.Analyzers/AnalyzerReleases.Unshipped.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
; Unshipped analyzer release
; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md

### Changed Rules

Documentation links added for every rule.

Rule ID | Category | Severity | Notes
--------|----------|----------|-------
Moq1000 | Moq | Warning | NoSealedClassMocksAnalyzer, [Documentation](https://github.com/rjmurillo/moq.analyzers/blob/main/docs/rules/Moq1000.md)
Moq1001 | Moq | Warning | NoConstructorArgumentsForInterfaceMockAnalyzer, [Documentation](https://github.com/rjmurillo/moq.analyzers/blob/main/docs/rules/Moq1001.md)
Moq1002 | Moq | Warning | ConstructorArgumentsShouldMatchAnalyzer, [Documentation](https://github.com/rjmurillo/moq.analyzers/blob/main/docs/rules/Moq1002.md)
Moq1100 | Moq | Warning | CallbackSignatureShouldMatchMockedMethodAnalyzer, [Documentation](https://github.com/rjmurillo/moq.analyzers/blob/main/docs/rules/Moq1100.md)
Moq1101 | Moq | Warning | NoMethodsInPropertySetupAnalyzer, [Documentation](https://github.com/rjmurillo/moq.analyzers/blob/main/docs/rules/Moq1101.md)
Moq1200 | Moq | Error | SetupShouldBeUsedOnlyForOverridableMembersAnalyzer, [Documentation](https://github.com/rjmurillo/moq.analyzers/blob/main/docs/rules/Moq1200.md)
Moq1201 | Moq | Error | SetupShouldNotIncludeAsyncResultAnalyzer, [Documentation](https://github.com/rjmurillo/moq.analyzers/blob/main/docs/rules/Moq1201.md)
Moq1300 | Moq | Error | AsShouldBeUsedOnlyForInterfaceAnalyzer, [Documentation](https://github.com/rjmurillo/moq.analyzers/blob/main/docs/rules/Moq1300.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 @@ namespace Moq.Analyzers;
[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
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ namespace Moq.Analyzers;
[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
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 @@ namespace Moq.Analyzers;
[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 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 @@ namespace Moq.Analyzers;
[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 @@ namespace Moq.Analyzers;
[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 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,

Check warning on line 9 in Source/Moq.Analyzers/SetupShouldBeUsedOnlyForOverridableMembersAnalyzer.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.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

0 comments on commit 403f5b0

Please sign in to comment.