Skip to content

Commit

Permalink
Place Descriptor after strings
Browse files Browse the repository at this point in the history
  • Loading branch information
nxtn committed Sep 20, 2019
1 parent 667bcb3 commit 324295e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 30 deletions.
Expand Up @@ -62,12 +62,6 @@ internal class SA1503BracesMustNotBeOmitted : DiagnosticAnalyzer
/// </summary>
public const string DiagnosticId = "SA1503";

/// <summary>
/// The diagnostic descriptor for the <see cref="SA1503BracesMustNotBeOmitted"/> analyzer.
/// </summary>
public static readonly DiagnosticDescriptor Descriptor =
new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, AnalyzerCategory.LayoutRules, DiagnosticSeverity.Warning, AnalyzerConstants.EnabledByDefault, Description, HelpLink);

private const string HelpLink = "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1503.md";
private static readonly LocalizableString Title = new LocalizableResourceString(nameof(LayoutResources.SA1503Title), LayoutResources.ResourceManager, typeof(LayoutResources));
private static readonly LocalizableString MessageFormat = new LocalizableResourceString(nameof(LayoutResources.SA1503MessageFormat), LayoutResources.ResourceManager, typeof(LayoutResources));
Expand All @@ -76,6 +70,9 @@ internal class SA1503BracesMustNotBeOmitted : DiagnosticAnalyzer
private static readonly Action<SyntaxNodeAnalysisContext> IfStatementAction = HandleIfStatement;
private static readonly Action<SyntaxNodeAnalysisContext, StyleCopSettings> UsingStatementAction = HandleUsingStatement;

public static DiagnosticDescriptor Descriptor { get; } =
new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, AnalyzerCategory.LayoutRules, DiagnosticSeverity.Warning, AnalyzerConstants.EnabledByDefault, Description, HelpLink);

/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } =
ImmutableArray.Create(Descriptor);
Expand Down
Expand Up @@ -47,19 +47,16 @@ internal class SA1507CodeMustNotContainMultipleBlankLinesInARow : DiagnosticAnal
/// </summary>
public const string DiagnosticId = "SA1507";

/// <summary>
/// The diagnostic descriptor for the <see cref="SA1507CodeMustNotContainMultipleBlankLinesInARow"/> analyzer.
/// </summary>
public static readonly DiagnosticDescriptor Descriptor =
new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, AnalyzerCategory.LayoutRules, DiagnosticSeverity.Warning, AnalyzerConstants.EnabledByDefault, Description, HelpLink);

private const string HelpLink = "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1507.md";
private static readonly LocalizableString Title = new LocalizableResourceString(nameof(LayoutResources.SA1507Title), LayoutResources.ResourceManager, typeof(LayoutResources));
private static readonly LocalizableString MessageFormat = new LocalizableResourceString(nameof(LayoutResources.SA1507MessageFormat), LayoutResources.ResourceManager, typeof(LayoutResources));
private static readonly LocalizableString Description = new LocalizableResourceString(nameof(LayoutResources.SA1507Description), LayoutResources.ResourceManager, typeof(LayoutResources));

private static readonly Action<SyntaxTreeAnalysisContext> SyntaxTreeAction = HandleSyntaxTree;

public static DiagnosticDescriptor Descriptor { get; } =
new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, AnalyzerCategory.LayoutRules, DiagnosticSeverity.Warning, AnalyzerConstants.EnabledByDefault, Description, HelpLink);

/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } =
ImmutableArray.Create(Descriptor);
Expand Down
Expand Up @@ -37,12 +37,6 @@ internal class SA1519BracesMustNotBeOmittedFromMultiLineChildStatement : Diagnos
/// </summary>
public const string DiagnosticId = "SA1519";

/// <summary>
/// The diagnostic descriptor for the <see cref="SA1519BracesMustNotBeOmittedFromMultiLineChildStatement"/> analyzer.
/// </summary>
public static readonly DiagnosticDescriptor Descriptor =
new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, AnalyzerCategory.LayoutRules, DiagnosticSeverity.Warning, AnalyzerConstants.EnabledByDefault, Description, HelpLink);

private const string HelpLink = "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1519.md";
private static readonly LocalizableString Title = new LocalizableResourceString(nameof(LayoutResources.SA1519Title), LayoutResources.ResourceManager, typeof(LayoutResources));
private static readonly LocalizableString MessageFormat = new LocalizableResourceString(nameof(LayoutResources.SA1519MessageFormat), LayoutResources.ResourceManager, typeof(LayoutResources));
Expand All @@ -55,6 +49,9 @@ internal class SA1519BracesMustNotBeOmittedFromMultiLineChildStatement : Diagnos
private static readonly Action<SyntaxNodeAnalysisContext> ForEachStatementAction = HandleForEachStatement;
private static readonly Action<SyntaxNodeAnalysisContext, StyleCopSettings> UsingStatementAction = HandleUsingStatement;

public static DiagnosticDescriptor Descriptor { get; } =
new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, AnalyzerCategory.LayoutRules, DiagnosticSeverity.Warning, AnalyzerConstants.EnabledByDefault, Description, HelpLink);

/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } =
ImmutableArray.Create(Descriptor);
Expand Down
Expand Up @@ -43,19 +43,16 @@ internal class SA1520UseBracesConsistently : DiagnosticAnalyzer
/// </summary>
public const string DiagnosticId = "SA1520";

/// <summary>
/// The diagnostic descriptor for the <see cref="SA1520UseBracesConsistently"/> analyzer.
/// </summary>
public static readonly DiagnosticDescriptor Descriptor =
new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, AnalyzerCategory.LayoutRules, DiagnosticSeverity.Warning, AnalyzerConstants.EnabledByDefault, Description, HelpLink);

private const string HelpLink = "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1520.md";
private static readonly LocalizableString Title = new LocalizableResourceString(nameof(LayoutResources.SA1520Title), LayoutResources.ResourceManager, typeof(LayoutResources));
private static readonly LocalizableString MessageFormat = new LocalizableResourceString(nameof(LayoutResources.SA1520MessageFormat), LayoutResources.ResourceManager, typeof(LayoutResources));
private static readonly LocalizableString Description = new LocalizableResourceString(nameof(LayoutResources.SA1520Description), LayoutResources.ResourceManager, typeof(LayoutResources));

private static readonly Action<SyntaxNodeAnalysisContext> IfStatementAction = HandleIfStatement;

public static DiagnosticDescriptor Descriptor { get; } =
new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, AnalyzerCategory.LayoutRules, DiagnosticSeverity.Warning, AnalyzerConstants.EnabledByDefault, Description, HelpLink);

/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } =
ImmutableArray.Create(Descriptor);
Expand Down
Expand Up @@ -157,12 +157,6 @@ internal class SA1200UsingDirectivesMustBePlacedCorrectly : DiagnosticAnalyzer
/// </summary>
public const string DiagnosticId = "SA1200";

internal static readonly DiagnosticDescriptor DescriptorInside =
new DiagnosticDescriptor(DiagnosticId, Title, MessageFormatInside, AnalyzerCategory.OrderingRules, DiagnosticSeverity.Warning, AnalyzerConstants.EnabledByDefault, DescriptionInside, HelpLink);

internal static readonly DiagnosticDescriptor DescriptorOutside =
new DiagnosticDescriptor(DiagnosticId, Title, MessageFormatOutside, AnalyzerCategory.OrderingRules, DiagnosticSeverity.Warning, AnalyzerConstants.EnabledByDefault, DescriptionOutside, HelpLink);

private const string MessageFormatInside = "Using directive should appear within a namespace declaration";
private const string DescriptionInside = "A C# using directive is placed outside of a namespace element.";

Expand All @@ -176,6 +170,12 @@ internal class SA1200UsingDirectivesMustBePlacedCorrectly : DiagnosticAnalyzer
private static readonly Action<SyntaxNodeAnalysisContext, StyleCopSettings> CompilationUnitAction = HandleCompilationUnit;
private static readonly Action<SyntaxNodeAnalysisContext, StyleCopSettings> NamespaceDeclarationAction = HandleNamespaceDeclaration;

public static DiagnosticDescriptor DescriptorInside { get; } =
new DiagnosticDescriptor(DiagnosticId, Title, MessageFormatInside, AnalyzerCategory.OrderingRules, DiagnosticSeverity.Warning, AnalyzerConstants.EnabledByDefault, DescriptionInside, HelpLink);

public static DiagnosticDescriptor DescriptorOutside { get; } =
new DiagnosticDescriptor(DiagnosticId, Title, MessageFormatOutside, AnalyzerCategory.OrderingRules, DiagnosticSeverity.Warning, AnalyzerConstants.EnabledByDefault, DescriptionOutside, HelpLink);

/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } =
ImmutableArray.Create(DescriptorInside);
Expand Down

0 comments on commit 324295e

Please sign in to comment.