mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-01-09 20:29:11 +00:00
Make dotnet format happy again (except for RYU0001)
This commit is contained in:
parent
cb6ab72a48
commit
3a7ff61029
3 changed files with 22 additions and 22 deletions
|
@ -9,29 +9,29 @@ namespace Ryujinx.Analyzers
|
||||||
[DiagnosticAnalyzer(LanguageNames.CSharp)]
|
[DiagnosticAnalyzer(LanguageNames.CSharp)]
|
||||||
public class CatchClauseAnalyzer : DiagnosticAnalyzer
|
public class CatchClauseAnalyzer : DiagnosticAnalyzer
|
||||||
{
|
{
|
||||||
public const string LoggerIdentifier = "Logger";
|
private const string LoggerIdentifier = "Logger";
|
||||||
public const string LogClassIdentifier = "LogClass";
|
private const string LogClassIdentifier = "LogClass";
|
||||||
|
|
||||||
public const string DiagnosticId = "RYU0001";
|
public const string DiagnosticId = "RYU0001";
|
||||||
|
|
||||||
private static readonly LocalizableString Title = new LocalizableResourceString(nameof(Resources.RYU0001Title),
|
private static readonly LocalizableString _title = new LocalizableResourceString(nameof(Resources.RYU0001Title),
|
||||||
Resources.ResourceManager, typeof(Resources));
|
Resources.ResourceManager, typeof(Resources));
|
||||||
|
|
||||||
private static readonly LocalizableString MessageFormat =
|
private static readonly LocalizableString _messageFormat =
|
||||||
new LocalizableResourceString(nameof(Resources.RYU0001MessageFormat), Resources.ResourceManager,
|
new LocalizableResourceString(nameof(Resources.RYU0001MessageFormat), Resources.ResourceManager,
|
||||||
typeof(Resources));
|
typeof(Resources));
|
||||||
|
|
||||||
private static readonly LocalizableString Description =
|
private static readonly LocalizableString _description =
|
||||||
new LocalizableResourceString(nameof(Resources.RYU0001Description), Resources.ResourceManager,
|
new LocalizableResourceString(nameof(Resources.RYU0001Description), Resources.ResourceManager,
|
||||||
typeof(Resources));
|
typeof(Resources));
|
||||||
|
|
||||||
private const string Category = "Maintainability";
|
private const string Category = "Maintainability";
|
||||||
|
|
||||||
private static readonly DiagnosticDescriptor Rule = new(DiagnosticId, Title, MessageFormat, Category,
|
private static readonly DiagnosticDescriptor _rule = new(DiagnosticId, _title, _messageFormat, Category,
|
||||||
DiagnosticSeverity.Warning, isEnabledByDefault: true, description: Description);
|
DiagnosticSeverity.Warning, isEnabledByDefault: true, description: _description);
|
||||||
|
|
||||||
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } =
|
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } =
|
||||||
ImmutableArray.Create(Rule);
|
ImmutableArray.Create(_rule);
|
||||||
|
|
||||||
public override void Initialize(AnalysisContext context)
|
public override void Initialize(AnalysisContext context)
|
||||||
{
|
{
|
||||||
|
@ -171,7 +171,7 @@ namespace Ryujinx.Analyzers
|
||||||
// Find catch clauses without declaration.
|
// Find catch clauses without declaration.
|
||||||
if (catchDeclaration == null)
|
if (catchDeclaration == null)
|
||||||
{
|
{
|
||||||
var diagnostic = Diagnostic.Create(Rule,
|
var diagnostic = Diagnostic.Create(_rule,
|
||||||
// The highlighted area in the analyzed source code. Keep it as specific as possible.
|
// The highlighted area in the analyzed source code. Keep it as specific as possible.
|
||||||
catchClauseSyntax.GetLocation(),
|
catchClauseSyntax.GetLocation(),
|
||||||
// The value is passed to 'MessageFormat' argument of your 'Rule'.
|
// The value is passed to 'MessageFormat' argument of your 'Rule'.
|
||||||
|
@ -182,7 +182,7 @@ namespace Ryujinx.Analyzers
|
||||||
// Find catch declarations without an identifier
|
// Find catch declarations without an identifier
|
||||||
else if (string.IsNullOrWhiteSpace(catchDeclaration.Identifier.Text))
|
else if (string.IsNullOrWhiteSpace(catchDeclaration.Identifier.Text))
|
||||||
{
|
{
|
||||||
var diagnostic = Diagnostic.Create(Rule,
|
var diagnostic = Diagnostic.Create(_rule,
|
||||||
// The highlighted area in the analyzed source code. Keep it as specific as possible.
|
// The highlighted area in the analyzed source code. Keep it as specific as possible.
|
||||||
catchClauseSyntax.GetLocation(),
|
catchClauseSyntax.GetLocation(),
|
||||||
// The value is passed to 'MessageFormat' argument of your 'Rule'.
|
// The value is passed to 'MessageFormat' argument of your 'Rule'.
|
||||||
|
@ -214,11 +214,11 @@ namespace Ryujinx.Analyzers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a diagnostic report if the exception was not logged
|
// Create a diagnostic report if the exception was not logged
|
||||||
if (!exceptionLogged)
|
if (!exceptionLogged)
|
||||||
{
|
{
|
||||||
var diagnostic = Diagnostic.Create(Rule,
|
var diagnostic = Diagnostic.Create(_rule,
|
||||||
// The highlighted area in the analyzed source code. Keep it as specific as possible.
|
// The highlighted area in the analyzed source code. Keep it as specific as possible.
|
||||||
catchClauseSyntax.GetLocation(),
|
catchClauseSyntax.GetLocation(),
|
||||||
// The value is passed to 'MessageFormat' argument of your 'Rule'.
|
// The value is passed to 'MessageFormat' argument of your 'Rule'.
|
||||||
|
|
|
@ -78,12 +78,12 @@ namespace Ryujinx.Analyzers
|
||||||
if (catchClauseSyntax.Declaration == null)
|
if (catchClauseSyntax.Declaration == null)
|
||||||
{
|
{
|
||||||
// System.Exception exception
|
// System.Exception exception
|
||||||
catchDeclaration =
|
catchDeclaration =
|
||||||
SyntaxFactory.CatchDeclaration(
|
SyntaxFactory.CatchDeclaration(
|
||||||
SyntaxFactory.QualifiedName(
|
SyntaxFactory.QualifiedName(
|
||||||
SyntaxFactory.IdentifierName("System"), SyntaxFactory.IdentifierName("Exception")),
|
SyntaxFactory.IdentifierName("System"), SyntaxFactory.IdentifierName("Exception")),
|
||||||
SyntaxFactory.Identifier("exception")
|
SyntaxFactory.Identifier("exception")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace Ryujinx.Tests.Analyzers
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task CatchWithoutDeclaration_WarningDiagnostic()
|
public async Task CatchWithoutDeclaration_WarningDiagnostic()
|
||||||
{
|
{
|
||||||
const string text = @"
|
const string Text = @"
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
public class MyClass
|
public class MyClass
|
||||||
|
@ -41,13 +41,13 @@ public class MyClass
|
||||||
var expected = Verifier.Diagnostic()
|
var expected = Verifier.Diagnostic()
|
||||||
.WithSpan(12, 9, 15, 10)
|
.WithSpan(12, 9, 15, 10)
|
||||||
.WithArguments("Exception");
|
.WithArguments("Exception");
|
||||||
await Verifier.VerifyAnalyzerAsync(text, expected).ConfigureAwait(false);
|
await Verifier.VerifyAnalyzerAsync(Text, expected).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task CatchWithoutIdentifier_WarningDiagnostic()
|
public async Task CatchWithoutIdentifier_WarningDiagnostic()
|
||||||
{
|
{
|
||||||
const string text = @"
|
const string Text = @"
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
public class MyClass
|
public class MyClass
|
||||||
|
@ -69,7 +69,7 @@ public class MyClass
|
||||||
var expected = Verifier.Diagnostic()
|
var expected = Verifier.Diagnostic()
|
||||||
.WithSpan(12, 9, 15, 10)
|
.WithSpan(12, 9, 15, 10)
|
||||||
.WithArguments("NullReferenceException");
|
.WithArguments("NullReferenceException");
|
||||||
await Verifier.VerifyAnalyzerAsync(text, expected).ConfigureAwait(false);
|
await Verifier.VerifyAnalyzerAsync(Text, expected).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
Loading…
Reference in a new issue