Fix all new code style warnings

このコミットが含まれているのは:
Sergio Pedri committed 2024-03-05 10:44:30 -08:00
1 親 10ef020591
コミット a5aff06390
37ファイル変更
+55 -52

検索条件に一致するファイルはありません

+3 -3
ファイルの表示
@@ -112,7 +112,7 @@ partial class D2DPixelShaderSourceGenerator
win32Error.HResult,
win32Error.Message);
return ImmutableArray.Create(diagnostic);
return [diagnostic];
}
else if (info is HlslBytecodeInfo.CompilerError fxcError)
{
@@ -123,10 +123,10 @@ partial class D2DPixelShaderSourceGenerator
methodSymbol.ContainingType,
fxcError.Message);
return ImmutableArray.Create(diagnostic);
return [diagnostic];
}
return ImmutableArray<DiagnosticInfo>.Empty;
return [];
}
/// <summary>
@@ -13,7 +13,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class D2DEnableRuntimeCompilationOnAssemblyAnalyzer : DiagnosticAnalyzer
{
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(D2DRuntimeCompilationOnAssemblyNotNecessary);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = [D2DRuntimeCompilationOnAssemblyNotNecessary];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -14,10 +14,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class D2DEnableRuntimeCompilationOnTypeAnalyzer : DiagnosticAnalyzer
{
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(
D2DRuntimeCompilationDisabled,
D2DRuntimeCompilationAlreadyEnabled,
D2DRuntimeCompilationOnTypeNotNecessary);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = [D2DRuntimeCompilationDisabled, D2DRuntimeCompilationAlreadyEnabled, D2DRuntimeCompilationOnTypeNotNecessary];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -15,7 +15,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class ExceededPixelShaderDispatchDataSizeAnalyzer : DiagnosticAnalyzer
{
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(ExceededDispatchDataSize);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = [ExceededDispatchDataSize];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -13,7 +13,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class InvalidAssemblyLevelCompileOptionsAnalyzer : DiagnosticAnalyzer
{
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(InvalidPackMatrixColumnMajorOption);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = [InvalidPackMatrixColumnMajorOption];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -13,7 +13,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class InvalidD2D1CompileOptionsEnableLinkingOnShaderTypeAnalyzer : DiagnosticAnalyzer
{
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(InvalidD2D1CompileOptionsEnableLinkingOnShaderType);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = [InvalidD2D1CompileOptionsEnableLinkingOnShaderType];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -13,7 +13,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class InvalidD2DGeneratedPixelShaderDescriptorAttributeTargetAnalyzer : DiagnosticAnalyzer
{
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(InvalidD2DGeneratedPixelShaderDescriptorAttributeTarget);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = [InvalidD2DGeneratedPixelShaderDescriptorAttributeTarget];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -16,9 +16,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class InvalidD2DInputDescriptionAttributeUseAnalyzer : DiagnosticAnalyzer
{
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(
OutOfRangeInputDescriptionIndex,
RepeatedD2DInputDescriptionIndices);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = [OutOfRangeInputDescriptionIndex, RepeatedD2DInputDescriptionIndices];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -14,7 +14,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class InvalidD2DPixelShaderSourceAttributeUseAnalyzer : DiagnosticAnalyzer
{
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(InvalidD2DPixelShaderSource);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = [InvalidD2DPixelShaderSource];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -14,7 +14,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class InvalidD2DPixelShaderSourceMethodReturnTypeAnalyzer : DiagnosticAnalyzer
{
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(InvalidD2DPixelShaderSourceMethodReturnType);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = [InvalidD2DPixelShaderSourceMethodReturnType];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -13,7 +13,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class InvalidD2DRequiresDoublePrecisionSupportAnalyzer : DiagnosticAnalyzer
{
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(InvalidD2DRequiresDoublePrecisionSupportAttribute);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = [InvalidD2DRequiresDoublePrecisionSupportAttribute];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -14,7 +14,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class InvalidD2DResourceTextureIndexAttributeLocationAnalyzer : DiagnosticAnalyzer
{
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(InvalidD2DResourceTextureIndexAttributeLocation);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = [InvalidD2DResourceTextureIndexAttributeLocation];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -16,11 +16,13 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class InvalidD2DResourceTextureIndexAttributeUseAnalyzer : DiagnosticAnalyzer
{
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } =
[
MissingD2DResourceTextureIndexAttribute,
ResourceTextureIndexOverlappingWithInputIndex,
OutOfRangeResourceTextureIndex,
RepeatedD2DResourceTextureIndices);
RepeatedD2DResourceTextureIndices,
];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -14,7 +14,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class InvalidEffectIdValueAnalyzer : DiagnosticAnalyzer
{
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(InvalidD2DEffectIdAttributeValue);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = [InvalidD2DEffectIdAttributeValue];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -17,11 +17,13 @@ public sealed class InvalidEffectMetadataValueAnalyzer : DiagnosticAnalyzer
/// <summary>
/// The set of type names for all metadata attributes.
/// </summary>
private static readonly ImmutableArray<string> MetadataAttributeTypeNames = ImmutableArray.Create(
private static readonly ImmutableArray<string> MetadataAttributeTypeNames =
[
"ComputeSharp.D2D1.D2DEffectDisplayNameAttribute",
"ComputeSharp.D2D1.D2DEffectDescriptionAttribute",
"ComputeSharp.D2D1.D2DEffectCategoryAttribute",
"ComputeSharp.D2D1.D2DEffectAuthorAttribute");
"ComputeSharp.D2D1.D2DEffectAuthorAttribute",
];
/// <summary>
/// The mapping of diagnostics to their attribute type names.
@@ -35,11 +37,13 @@ public sealed class InvalidEffectMetadataValueAnalyzer : DiagnosticAnalyzer
]);
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } =
[
InvalidD2DEffectDisplayNameAttributeValue,
InvalidD2DEffectDescriptionAttributeValue,
InvalidD2DEffectCategoryAttributeValue,
InvalidD2DEffectAuthorAttributeValue);
InvalidD2DEffectAuthorAttributeValue,
];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -13,7 +13,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class InvalidShaderTypeCompileOptionsAnalyzer : DiagnosticAnalyzer
{
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(InvalidPackMatrixColumnMajorOption);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = [InvalidPackMatrixColumnMajorOption];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -16,13 +16,15 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class InvalidShaderTypeInputsAnalyzer : DiagnosticAnalyzer
{
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } =
[
MissingD2DInputCountAttribute,
InvalidD2DInputCount,
OutOfRangeInputIndex,
RepeatedD2DInputSimpleIndices,
RepeatedD2DInputComplexIndices,
InvalidSimpleAndComplexIndicesCombination);
InvalidSimpleAndComplexIndicesCombination,
];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -14,7 +14,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class MissingD2DCompileOptionsOnD2DPixelShaderSourceMethodAnalyzer : DiagnosticAnalyzer
{
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(MissingCompileOptionsForD2DPixelShaderSource);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = [MissingCompileOptionsForD2DPixelShaderSource];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -14,7 +14,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class MissingD2DShaderProfileOnD2DPixelShaderSourceMethodAnalyzer : DiagnosticAnalyzer
{
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(MissingShaderProfileForD2DPixelShaderSource);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = [MissingShaderProfileForD2DPixelShaderSource];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -14,7 +14,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class MissingPixelShaderDescriptorOnPixelShaderAnalyzer : DiagnosticAnalyzer
{
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(MissingPixelShaderDescriptorOnPixelShaderType);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = [MissingPixelShaderDescriptorOnPixelShaderType];
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
@@ -1,4 +1,3 @@
using System.Collections.Immutable;
using ComputeSharp.SourceGeneration.Diagnostics;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
@@ -14,7 +13,7 @@ public sealed class NotReadOnlyPixelShaderTypeWithFieldsAnalyzer : NotReadOnlySh
/// Creates a new <see cref="NotReadOnlyPixelShaderTypeWithFieldsAnalyzer"/> instance.
/// </summary>
public NotReadOnlyPixelShaderTypeWithFieldsAnalyzer()
: base(NotReadOnlyShaderType, ImmutableArray.Create("ComputeSharp.D2D1.ID2D1PixelShader"))
: base(NotReadOnlyShaderType, ["ComputeSharp.D2D1.ID2D1PixelShader"])
{
}
}
@@ -31,7 +31,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
public sealed class D2D1ResourceTextureUninitializedFieldDiagnosticSuppressor : DiagnosticSuppressor
{
/// <inheritdoc/>
public override ImmutableArray<SuppressionDescriptor> SupportedSuppressions => ImmutableArray.Create(UninitializedD2D1ResourceTextureField);
public override ImmutableArray<SuppressionDescriptor> SupportedSuppressions => [UninitializedD2D1ResourceTextureField];
/// <inheritdoc/>
public override void ReportSuppressions(SuppressionAnalysisContext context)