Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions eng/globalconfigs/Common.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dotnet_analyzer_diagnostic.category-CodeQuality.severity = warning
### Configuration for RSxxxx rules ###

# RS1024: Compare symbols correctly
# https://github.com/dotnet/roslyn-analyzers/issues/3389
# https://github.com/dotnet/roslyn-analyzers/issues/6381
dotnet_diagnostic.RS1024.severity = none

# Parts exported with MEFv2 must be marked with 'SharedAttribute', un-needed here
Expand All @@ -26,11 +26,6 @@ dotnet_diagnostic.RS0038.severity = none

### Configuration for IDE code style by diagnostic IDs ###

# IDE0078: Use pattern matching
# https://github.com/dotnet/roslyn/issues/51691
# https://github.com/dotnet/roslyn/issues/51693
dotnet_diagnostic.IDE0078.severity = silent

# IDE0066: Convert switch statement to expression
dotnet_diagnostic.IDE0066.severity = suggestion

Expand Down
4 changes: 2 additions & 2 deletions eng/globalconfigs/NonShipping.globalconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
is_global = true

### Configuration for RSxxxx rules ###

# Do not declare static members on generic types (we use generic static classes in test helpers)
dotnet_diagnostic.CA1000.severity = none

Expand All @@ -20,5 +18,7 @@ dotnet_diagnostic.CA1822.severity = none
# Do not directly await a Task (makes tests unnecessarily noisy)
dotnet_diagnostic.CA2007.severity = none

### Configuration for RSxxxx rules ###

# Do not call 'GetTestAccessor()'
dotnet_diagnostic.RS0043.severity = none
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public IdentifierGenerator(SemanticModel model, IBlockOperation block)

public string? NextIdentifier()
{
if (_nextIdentifier == null || _nextIdentifier == int.MaxValue)
if (_nextIdentifier is null or int.MaxValue)
{
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ public override TypeSyntax VisitNamedType(INamedTypeSymbol symbol)
return typeSyntax;

typeSyntax = CreateSimpleTypeSyntax(symbol);
if (!(typeSyntax is SimpleNameSyntax))
if (typeSyntax is not SimpleNameSyntax simpleNameSyntax)
return typeSyntax;

var simpleNameSyntax = (SimpleNameSyntax)typeSyntax;
if (symbol.ContainingType is not null)
{
if (symbol.ContainingType.TypeKind != TypeKind.Submission)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public override void Initialize(AnalysisContext context)

private static bool IsAnyProtectedVariant(ISymbol symbol)
{
return symbol.DeclaredAccessibility == Accessibility.Protected ||
symbol.DeclaredAccessibility == Accessibility.ProtectedOrInternal ||
symbol.DeclaredAccessibility == Accessibility.ProtectedAndInternal;
return symbol.DeclaredAccessibility is Accessibility.Protected or
Accessibility.ProtectedOrInternal or
Accessibility.ProtectedAndInternal;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ private static void OnCompilationStart(CompilationStartAnalysisContext context)
indexerArgument = elementReference.Indices[0];
containingType = elementReference.ArrayReference.Type;
}
else if (operationContext.Operation.Kind == OperationKind.None
|| operationContext.Operation.Kind == OperationKindEx.ImplicitIndexerReference)
else if (operationContext.Operation.Kind is OperationKind.None or OperationKindEx.ImplicitIndexerReference)
{
// The forward support via the "None" operation kind is only available for C#.
if (operationContext.Compilation.Language != LanguageNames.CSharp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ bool CheckArgumentArrayType(IArgumentOperation targetArgument, IPropertyReferenc
if (lengthPropertyArgument.Instance.GetReferencedMemberOrLocalOrParameter() == targetArgumentValue.Operand.GetReferencedMemberOrLocalOrParameter())
{
IArrayTypeSymbol countArgumentArrayTypeSymbol = (IArrayTypeSymbol)lengthPropertyArgument.Instance.Type;
if (countArgumentArrayTypeSymbol.ElementType.SpecialType != SpecialType.System_Byte &&
countArgumentArrayTypeSymbol.ElementType.SpecialType != SpecialType.System_SByte &&
countArgumentArrayTypeSymbol.ElementType.SpecialType != SpecialType.System_Boolean)
if (countArgumentArrayTypeSymbol.ElementType.SpecialType is not SpecialType.System_Byte and
not SpecialType.System_SByte and
not SpecialType.System_Boolean)
{
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ private void AnalyzeSymbol(SymbolAnalysisContext context,
{
ProcessTypeSymbolAttributes(context, typeSymbol, requiresPreviewFeaturesSymbols, previewFeatureAttributeSymbol);
}
else if (symbol is IMethodSymbol || symbol is IPropertySymbol)
else if (symbol is IMethodSymbol or IPropertySymbol)
{
ProcessPropertyOrMethodAttributes(context, symbol, requiresPreviewFeaturesSymbols, virtualStaticsInInterfaces, previewFeatureAttributeSymbol);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ protected override void InitializeWorker(CompilationStartAnalysisContext context

private static bool IsToLowerOrToUpper(string methodName)
{
return methodName == ToLowerMethodName || methodName == ToUpperMethodName;
// TODO: Compare symbols instead of method name.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File a tracking issue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got a PR for it already #6382

return methodName is ToLowerMethodName or ToUpperMethodName;
}
}
}
3 changes: 2 additions & 1 deletion src/Test.Utilities/Test.Utilities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<NonShipping>true</NonShipping>
<IsShipping>false</IsShipping>
Comment on lines 5 to +6

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are we using NonShipping? Can you please file a separate issue to tracking consolidating NonShipping and IsShipping to a single property?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
</PropertyGroup>
<ItemGroup>
Expand Down Expand Up @@ -32,4 +33,4 @@
</ItemGroup>
<Import Project="..\Utilities\Compiler\Analyzer.Utilities.projitems" Label="Shared" />
<Import Project="..\Utilities\Workspaces\Workspaces.Utilities.projitems" Label="Shared" />
</Project>
</Project>