Skip to content

Commit

Permalink
Merge pull request #2845 from mavasani/295_beta1
Browse files Browse the repository at this point in the history
Post release activities (2.9.5-beta1.final released)
  • Loading branch information
mavasani committed Sep 11, 2019
2 parents 924f9f5 + 267729b commit 9f12ebf
Show file tree
Hide file tree
Showing 69 changed files with 374 additions and 664 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Expand Up @@ -4,7 +4,7 @@ Example: [Microsoft.CodeAnalysis.FxCopAnalyzers](https://www.nuget.org/packages/

#### Package Version

Example: v2.9.4 (Latest)
Example: v2.9.5-beta1.final (Latest)

#### Diagnostic ID

Expand Down
1 change: 1 addition & 0 deletions VERSIONING.md
Expand Up @@ -40,3 +40,4 @@ Sr. No. | Release Version | Commit Tag | Commit SHA
20 | 2.9.3 | v2.9.3 | [7f096af](https://github.com/dotnet/roslyn-analyzers/commit/7f096aff22c1fd35652d55a9405e13d421dfe512) | Microsoft.CodeAnalysis.Analyzers, Microsoft.CodeAnalysis.FxCopAnalyzers, Microsoft.CodeAnalysis.Metrics, Microsoft.CodeAnalysis.VersionCheckAnalyzer, Microsoft.CodeQuality.Analyzers, Microsoft.NetCore.Analyzers, Microsoft.NetFramework.Analyzers, Roslyn.Diagnostics.Analyzers, Microsoft.CodeAnalysis.PublicApiAnalyzers, Microsoft.CodeAnalysis.BannedApiAnalyzers
21 | 2.9.4-beta1.final (pre-release) | v2.9.4-beta1.final | [3b22a6a](https://github.com/dotnet/roslyn-analyzers/commit/3b22a6a82d450350ab0cf27504adab8d1226b2a8) | Microsoft.CodeAnalysis.Analyzers, Microsoft.CodeAnalysis.FxCopAnalyzers, Microsoft.CodeAnalysis.Metrics, Microsoft.CodeAnalysis.VersionCheckAnalyzer, Microsoft.CodeQuality.Analyzers, Microsoft.NetCore.Analyzers, Microsoft.NetFramework.Analyzers, Roslyn.Diagnostics.Analyzers, Microsoft.CodeAnalysis.PublicApiAnalyzers, Microsoft.CodeAnalysis.BannedApiAnalyzers, Microsoft.CodeAnalysis.FlowAnalysis.Utilities
22 | 2.9.4 | v2.9.4 | [a1a198d](https://github.com/dotnet/roslyn-analyzers/commit/a1a198d1c5d2359e93dd4ab4b1c4f7421512724e) | Microsoft.CodeAnalysis.Analyzers, Microsoft.CodeAnalysis.FxCopAnalyzers, Microsoft.CodeAnalysis.Metrics, Microsoft.CodeAnalysis.VersionCheckAnalyzer, Microsoft.CodeQuality.Analyzers, Microsoft.NetCore.Analyzers, Microsoft.NetFramework.Analyzers, Roslyn.Diagnostics.Analyzers, Microsoft.CodeAnalysis.PublicApiAnalyzers, Microsoft.CodeAnalysis.BannedApiAnalyzers, Microsoft.CodeAnalysis.FlowAnalysis.Utilities
23 | 2.9.5-beta1.final (pre-release) | v2.9.5-beta1.final | [494de6f](https://github.com/dotnet/roslyn-analyzers/commit/494de6f80082746e41d69355535f8dc3bfef494a) | Microsoft.CodeAnalysis.Analyzers, Microsoft.CodeAnalysis.FxCopAnalyzers, Microsoft.CodeAnalysis.Metrics, Microsoft.CodeAnalysis.VersionCheckAnalyzer, Microsoft.CodeQuality.Analyzers, Microsoft.NetCore.Analyzers, Microsoft.NetFramework.Analyzers, Roslyn.Diagnostics.Analyzers, Microsoft.CodeAnalysis.PublicApiAnalyzers, Microsoft.CodeAnalysis.BannedApiAnalyzers
4 changes: 4 additions & 0 deletions eng/Analyzers_NonShippingRules.ruleset
Expand Up @@ -28,4 +28,8 @@
<!-- We restore IDE0005 to hidden severity for non-shipping test code as we have lot of autogenerated test files with helpful usings to help someone get started whenever they start authoring tests -->
<Rule Id="IDE0005" Action="Hidden" /> <!-- Remove unused imports/usings -->
</Rules>

<Rules AnalyzerId="xunit.analyzers" RuleNamespace="Xunit.Analyzers">
<Rule Id="xUnit1004" Action="None" /> <!-- allow skipped tests -->
</Rules>
</RuleSet>
8 changes: 4 additions & 4 deletions eng/Versions.props
Expand Up @@ -4,7 +4,7 @@

<VersionPrefix>2.9.5</VersionPrefix>
<FlowAnalysisUtilitiesVersionPrefix>2.9.6</FlowAnalysisUtilitiesVersionPrefix>
<PreReleaseVersionLabel>beta1</PreReleaseVersionLabel>
<PreReleaseVersionLabel>beta2</PreReleaseVersionLabel>

<!-- Opt-in repo features -->
<UsingToolVSSDK>true</UsingToolVSSDK>
Expand All @@ -20,10 +20,10 @@

<!-- Roslyn -->
<MicrosoftCodeAnalysisVersion>2.9.0</MicrosoftCodeAnalysisVersion>
<MicrosoftNetCompilersVersion>3.0.0</MicrosoftNetCompilersVersion>
<MicrosoftCodeAnalysisFXCopAnalyersVersion>2.9.4</MicrosoftCodeAnalysisFXCopAnalyersVersion>
<MicrosoftNetCompilersVersion>3.3.1-beta3-final</MicrosoftNetCompilersVersion>
<MicrosoftCodeAnalysisFXCopAnalyersVersion>2.9.5-beta1.final</MicrosoftCodeAnalysisFXCopAnalyersVersion>
<MicrosoftCodeAnalysisAnalyersVersion>3.0.0-beta2.19218.3+e96bad97</MicrosoftCodeAnalysisAnalyersVersion>
<CodeStyleAnalyersVersion>2.11.0-beta2-63603-03</CodeStyleAnalyersVersion>
<CodeStyleAnalyersVersion>3.3.0-beta2-19376-02</CodeStyleAnalyersVersion>
<MicrosoftCodeAnalysisTestResourcesProprietaryVersion>2.0.0-pre-20160714</MicrosoftCodeAnalysisTestResourcesProprietaryVersion>

<!-- Roslyn Testing -->
Expand Down
28 changes: 10 additions & 18 deletions src/GenerateAnalyzerRulesets/Program.cs
Expand Up @@ -277,32 +277,24 @@ bool shouldSkipRule(DiagnosticDescriptor rule)

string getRuleAction(DiagnosticDescriptor rule)
{
switch (rulesetKind)
return rulesetKind switch
{
case RulesetKind.CategoryDefault:
return getRuleActionCore(enable: categoryPass && rule.IsEnabledByDefault);
RulesetKind.CategoryDefault => getRuleActionCore(enable: categoryPass && rule.IsEnabledByDefault),

case RulesetKind.CategoryEnabled:
return getRuleActionCore(enable: categoryPass);
RulesetKind.CategoryEnabled => getRuleActionCore(enable: categoryPass),

case RulesetKind.CustomTagDefault:
return getRuleActionCore(enable: customTagPass && rule.IsEnabledByDefault);
RulesetKind.CustomTagDefault => getRuleActionCore(enable: customTagPass && rule.IsEnabledByDefault),

case RulesetKind.CustomTagEnabled:
return getRuleActionCore(enable: customTagPass);
RulesetKind.CustomTagEnabled => getRuleActionCore(enable: customTagPass),

case RulesetKind.AllDefault:
return getRuleActionCore(enable: rule.IsEnabledByDefault);
RulesetKind.AllDefault => getRuleActionCore(enable: rule.IsEnabledByDefault),

case RulesetKind.AllEnabled:
return getRuleActionCore(enable: true);
RulesetKind.AllEnabled => getRuleActionCore(enable: true),

case RulesetKind.AllDisabled:
return getRuleActionCore(enable: false);
RulesetKind.AllDisabled => getRuleActionCore(enable: false),

default:
throw new InvalidProgramException();
}
_ => throw new InvalidProgramException(),
};

string getRuleActionCore(bool enable)
{
Expand Down
Expand Up @@ -240,24 +240,16 @@ private static DiagnosticResult GetBasicExpectedDiagnostic(int line, int column,

private static DiagnosticResult GetExpectedDiagnostic(int line, int column, MissingKindArgument kind)
{
string message;
switch (kind)
var message = kind switch
{
case MissingKindArgument.SymbolKind:
message = CodeAnalysisDiagnosticsResources.MissingSymbolKindArgumentToRegisterActionMessage;
break;
MissingKindArgument.SymbolKind => CodeAnalysisDiagnosticsResources.MissingSymbolKindArgumentToRegisterActionMessage,

case MissingKindArgument.SyntaxKind:
message = CodeAnalysisDiagnosticsResources.MissingSyntaxKindArgumentToRegisterActionMessage;
break;
MissingKindArgument.SyntaxKind => CodeAnalysisDiagnosticsResources.MissingSyntaxKindArgumentToRegisterActionMessage,

case MissingKindArgument.OperationKind:
message = CodeAnalysisDiagnosticsResources.MissingOperationKindArgumentToRegisterActionMessage;
break;
MissingKindArgument.OperationKind => CodeAnalysisDiagnosticsResources.MissingOperationKindArgumentToRegisterActionMessage,

default:
throw new ArgumentException("Unsupported argument kind", nameof(kind));
}
_ => throw new ArgumentException("Unsupported argument kind", nameof(kind)),
};

return new DiagnosticResult(DiagnosticIds.MissingKindArgumentToRegisterActionRuleId, DiagnosticHelpers.DefaultDiagnosticSeverity)
.WithLocation(line, column)
Expand Down
Expand Up @@ -78,33 +78,17 @@ private void OnCompilationStart(CompilationStartAnalysisContext compilationConte
compilationContext.RegisterOperationAction(
context =>
{
ISymbol symbol;
switch (context.Operation)
var symbol = context.Operation switch
{
case IObjectCreationOperation objectCreation:
symbol = objectCreation.Constructor;
break;
case IInvocationOperation invocation:
symbol = invocation.TargetMethod;
break;
case IMemberReferenceOperation memberReference:
symbol = memberReference.Member;
break;
case IConversionOperation conversion:
symbol = conversion.OperatorMethod;
break;
case IUnaryOperation unary:
symbol = unary.OperatorMethod;
break;
case IBinaryOperation binary:
symbol = binary.OperatorMethod;
break;
case IIncrementOrDecrementOperation incrementOrDecrement:
symbol = incrementOrDecrement.OperatorMethod;
break;
default:
throw new NotImplementedException($"Unhandled OperationKind: {context.Operation.Kind}");
}
IObjectCreationOperation objectCreation => objectCreation.Constructor,
IInvocationOperation invocation => invocation.TargetMethod,
IMemberReferenceOperation memberReference => memberReference.Member,
IConversionOperation conversion => conversion.OperatorMethod,
IUnaryOperation unary => unary.OperatorMethod,
IBinaryOperation binary => binary.OperatorMethod,
IIncrementOrDecrementOperation incrementOrDecrement => incrementOrDecrement.OperatorMethod,
_ => throw new NotImplementedException($"Unhandled OperationKind: {context.Operation.Kind}"),
};
VerifySymbol(symbol, context.Operation.Syntax,
context.ReportDiagnostic, restrictedInternalsVisibleToMap, namespaceToIsBannedMap);
Expand Down
Expand Up @@ -62,16 +62,14 @@ private static bool IsEmptyBlockBody(BlockSyntax blockBody, SemanticModel semant

private static bool IsEmptyExpressionBody(ArrowExpressionClauseSyntax expressionBody, SemanticModel semanticModel)
{
switch (expressionBody.Expression.Kind())
return (expressionBody.Expression.Kind()) switch
{
case SyntaxKind.ThrowExpression:
return true;
SyntaxKind.ThrowExpression => true,

case SyntaxKind.InvocationExpression:
return IsConditionalInvocation((InvocationExpressionSyntax)expressionBody.Expression, semanticModel);
}
SyntaxKind.InvocationExpression => IsConditionalInvocation((InvocationExpressionSyntax)expressionBody.Expression, semanticModel),

return false;
_ => false,
};
}

private static bool IsConditionalInvocation(InvocationExpressionSyntax invocationExpr, SemanticModel semanticModel)
Expand Down
@@ -1,6 +1,5 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
Expand Down
Expand Up @@ -2,7 +2,6 @@

using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
Expand Down
Expand Up @@ -185,20 +185,16 @@ private static IEnumerable<ISymbol> GetExplicitImplementations(ISymbol symbol)
return null;
}

switch (symbol.Kind)
return symbol.Kind switch
{
case SymbolKind.Method:
return ((IMethodSymbol)symbol).ExplicitInterfaceImplementations;
SymbolKind.Method => ((IMethodSymbol)symbol).ExplicitInterfaceImplementations,

case SymbolKind.Event:
return ((IEventSymbol)symbol).ExplicitInterfaceImplementations;
SymbolKind.Event => ((IEventSymbol)symbol).ExplicitInterfaceImplementations,

case SymbolKind.Property:
return ((IPropertySymbol)symbol).ExplicitInterfaceImplementations;
SymbolKind.Property => ((IPropertySymbol)symbol).ExplicitInterfaceImplementations,

default:
return null;
}
_ => null,
};
}

private static async Task<Document> MakeContainingTypeSealed(Document document, IMethodSymbol methodSymbol, CancellationToken cancellationToken)
Expand Down
Expand Up @@ -106,17 +106,16 @@ public sealed override Task RegisterCodeFixesAsync(CodeFixContext context)

private static OperatorKind GetInvertedOperatorKind(IMethodSymbol containingOperator)
{
switch (containingOperator.Name)
return containingOperator.Name switch
{
case WellKnownMemberNames.EqualityOperatorName: return OperatorKind.Inequality;
case WellKnownMemberNames.InequalityOperatorName: return OperatorKind.Equality;
case WellKnownMemberNames.LessThanOperatorName: return OperatorKind.GreaterThan;
case WellKnownMemberNames.LessThanOrEqualOperatorName: return OperatorKind.GreaterThanOrEqual;
case WellKnownMemberNames.GreaterThanOperatorName: return OperatorKind.LessThan;
case WellKnownMemberNames.GreaterThanOrEqualOperatorName: return OperatorKind.LessThanOrEqual;
}

throw new InvalidOperationException();
WellKnownMemberNames.EqualityOperatorName => OperatorKind.Inequality,
WellKnownMemberNames.InequalityOperatorName => OperatorKind.Equality,
WellKnownMemberNames.LessThanOperatorName => OperatorKind.GreaterThan,
WellKnownMemberNames.LessThanOrEqualOperatorName => OperatorKind.GreaterThanOrEqual,
WellKnownMemberNames.GreaterThanOperatorName => OperatorKind.LessThan,
WellKnownMemberNames.GreaterThanOrEqualOperatorName => OperatorKind.LessThanOrEqual,
_ => throw new InvalidOperationException(),
};
}
}
}
Expand Up @@ -3,7 +3,6 @@
using System;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Analyzer.Utilities;
Expand Down
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Analyzer.Utilities;
Expand Down
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Analyzer.Utilities;
Expand Down
Expand Up @@ -3,7 +3,6 @@
using System;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Analyzer.Utilities;
Expand Down
Expand Up @@ -3,7 +3,6 @@
using System;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
Expand Down
Expand Up @@ -288,23 +288,18 @@ static bool isApplicableByDefault(string ruleId, SymbolKind symbolKind)
}
// Compat: we match the default threshold values for old FxCop implementation.
switch (ruleId)
return ruleId switch
{
case CA1501RuleId:
return 5;
CA1501RuleId => 5,
case CA1502RuleId:
return 25;
CA1502RuleId => 25,
case CA1505RuleId:
return 10;
CA1505RuleId => 10,
case CA1506RuleId:
return symbolKind == SymbolKind.NamedType ? 95 : (uint)40;
CA1506RuleId => symbolKind == SymbolKind.NamedType ? 95 : (uint)40,
default:
throw new NotImplementedException();
}
_ => throw new NotImplementedException(),
};
}
});
}
Expand Down
Expand Up @@ -3,7 +3,6 @@
using System;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Analyzer.Utilities;
Expand Down
Expand Up @@ -2,7 +2,6 @@

using System;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Analyzer.Utilities;
Expand Down

0 comments on commit 9f12ebf

Please sign in to comment.