提交 e3ac7636 编写于 作者: J Jonathon Marolf

renaming the fxcop binaries and making them portable.

上级 ae718846
......@@ -8,15 +8,18 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}</ProjectGuid>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{D212BF08-95D5-4664-AD47-AF9BFE7C48D0}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<AnalyzerProject>true</AnalyzerProject>
<RootNamespace>Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers</RootNamespace>
<AssemblyName>Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers</AssemblyName>
<RootNamespace>Microsoft.AnalyzerPowerPack.CSharp</RootNamespace>
<AssemblyName>Microsoft.AnalyzerPowerPack.CSharp</AssemblyName>
<SolutionDir Condition="'$(SolutionDir)' == '' OR '$(SolutionDir)' == '*Undefined*'">..\..\..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
</PropertyGroup>
<ItemGroup Label="File References">
<Reference Include="..\..\..\..\packages\System.Collections.Immutable.$(SystemCollectionsImmutableVersion)\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll" />
......@@ -30,14 +33,13 @@
<Project>{B501A547-C911-4A05-AC6E-274A50DFF30E}</Project>
<Name>CSharpCodeAnalysis</Name>
</ProjectReference>
<ProjectReference Include="..\Core\FxCopRulesDiagnosticAnalyzers.csproj">
<Project>{36755424-5267-478C-9434-37A507E22711}</Project>
<Name>FxCopRulesDiagnosticAnalyzers</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\Core\Portable\Workspaces.csproj">
<Project>{5F8D2414-064A-4B3A-9B42-8E2A04246BE5}</Project>
<Name>Workspaces</Name>
</ProjectReference>
<ProjectReference Include="..\Core\AnalyzerPowerPack.Common.csproj">
<Name>AnalyzerPowerPack.Common</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
</PropertyGroup>
......@@ -68,8 +70,6 @@
<HintPath>..\..\..\..\packages\Microsoft.Composition.$(MicrosoftCompositionVersion)\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
......
// 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.Collections.Immutable;
using Microsoft.AnalyzerPowerPack.Design;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Design;
namespace Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers.Design
namespace Microsoft.AnalyzerPowerPack.CSharp.Design
{
/// <summary>
/// CA1024: Use properties where appropriate
......
// 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 Microsoft.AnalyzerPowerPack.Design;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Design;
using System.Linq;
namespace Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers.Design
namespace Microsoft.AnalyzerPowerPack.CSharp.Design
{
/// <summary>
/// CA1033: Interface methods should be callable by child types
......
// 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.Composition;
using System.Linq;
using Microsoft.AnalyzerPowerPack.Design;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Design;
namespace Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers.Design
namespace Microsoft.AnalyzerPowerPack.CSharp.Design
{
/// <summary>
/// CA1008: Enums should have zero value
......
......@@ -5,15 +5,14 @@
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.AnalyzerPowerPack.Design;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.FxCopAnalyzers;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Design;
using Microsoft.CodeAnalysis.Shared.Extensions;
namespace Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers.Design
namespace Microsoft.AnalyzerPowerPack.CSharp.Design
{
[ExportCodeFixProvider(LanguageNames.CSharp, Name = StaticTypeRulesDiagnosticAnalyzer.RuleNameForExportAttribute), Shared]
public class CA1052CSharpCodeFixProvider : CodeFixProvider
......@@ -35,11 +34,11 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
var cancellationToken = context.CancellationToken;
cancellationToken.ThrowIfCancellationRequested();
var root = await document.GetSyntaxRootAsync(cancellationToken);
var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
var classDeclaration = root.FindToken(span.Start).Parent?.FirstAncestorOrSelf<ClassDeclarationSyntax>();
if (classDeclaration != null)
{
var title = string.Format(FxCopRulesResources.StaticHolderTypeIsNotStatic, classDeclaration.Identifier.Text);
var title = string.Format(AnalyzerPowerPackRulesResources.StaticHolderTypeIsNotStatic, classDeclaration.Identifier.Text);
var codeAction = new MyCodeAction(title, ct => AddStaticKeyword(document, root, classDeclaration));
context.RegisterCodeFix(codeAction, context.Diagnostics);
}
......
// 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 Microsoft.AnalyzerPowerPack.Performance;
using Microsoft.AnalyzerPowerPack.Utilities;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Performance;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers.Performance
namespace Microsoft.AnalyzerPowerPack.CSharp .Performance
{
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class CSharpRemoveEmptyFinalizers : RemoveEmptyFinalizers<SyntaxKind>
......
// 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.Collections.Immutable;
using System.Threading;
using Microsoft.AnalyzerPowerPack.Usage;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Usage
namespace Microsoft.AnalyzerPowerPack.CSharp.Usage
{
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class CSharpCA2200DiagnosticAnalyzer : CA2200DiagnosticAnalyzer
......
// 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.Collections.Immutable;
using System.Threading;
using Microsoft.AnalyzerPowerPack.Usage;
using Microsoft.AnalyzerPowerPack.Utilities;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Usage;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers.Usage
namespace Microsoft.AnalyzerPowerPack.CSharp.Usage
{
/// <summary>
/// CA2214: Do not call overridable methods in constructors
......
// 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.Composition;
using Microsoft.AnalyzerPowerPack.Usage;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Usage;
using Microsoft.CodeAnalysis.CSharp;
namespace Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers.Usage
namespace Microsoft.AnalyzerPowerPack.CSharp.Usage
{
[ExportCodeFixProvider(LanguageNames.CSharp, Name = "CA2237 CodeFix provider"), Shared]
public class CSharpMarkAllNonSerializableFieldsFixer : MarkAllNonSerializableFieldsFixer
......
......@@ -3,9 +3,10 @@
using System;
using System.Collections.Immutable;
using System.Threading;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers
namespace Microsoft.AnalyzerPowerPack
{
public abstract class AbstractNamedTypeAnalyzer : DiagnosticAnalyzer
{
......
......@@ -9,7 +9,8 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{36755424-5267-478C-9434-37A507E22711}</ProjectGuid>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB}</ProjectGuid>
<OutputType>Library</OutputType>
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
<FileUpgradeFlags>
......@@ -18,11 +19,13 @@
</UpgradeBackupLocation>
<OldToolsVersion>4.0</OldToolsVersion>
<AnalyzerProject>true</AnalyzerProject>
<RootNamespace>Microsoft.CodeAnalysis.FxCopAnalyzers</RootNamespace>
<AssemblyName>Microsoft.CodeAnalysis.FxCopAnalyzers</AssemblyName>
<RootNamespace>Microsoft.AnalyzerPowerPack</RootNamespace>
<AssemblyName>Microsoft.AnalyzerPowerPack.Common</AssemblyName>
<SolutionDir Condition="'$(SolutionDir)' == '' OR '$(SolutionDir)' == '*Undefined*'">..\..\..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
</PropertyGroup>
<ItemGroup Label="File References">
<Reference Include="..\..\..\..\packages\System.Collections.Immutable.$(SystemCollectionsImmutableVersion)\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll" />
......@@ -114,15 +117,15 @@
<Compile Include="DiagnosticKind.cs" />
<Compile Include="DocumentChangeAction.cs" />
<Compile Include="FxCopDiagnosticCategory.cs" />
<Compile Include="FxCopFixersResources.Designer.cs">
<Compile Include="AnalyzerPowerPackFixersResources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>FxCopFixersResources.resx</DependentUpon>
<DependentUpon>AnalyzerPowerPackFixersResources.resx</DependentUpon>
</Compile>
<Compile Include="FxCopRulesResources.Designer.cs">
<Compile Include="AnalyzerPowerPackRulesResources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>FxCopRulesResources.resx</DependentUpon>
<DependentUpon>AnalyzerPowerPackRulesResources.resx</DependentUpon>
</Compile>
<Compile Include="MultipleCodeFixProviderBase.cs" />
<Compile Include="Naming\CA1708DiagnosticAnalyzer.cs" />
......@@ -150,15 +153,15 @@
<Compile Include="Usage\SerializationRulesDiagnosticAnalyzer.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="FxCopFixersResources.resx">
<EmbeddedResource Include="AnalyzerPowerPackFixersResources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<SubType>Designer</SubType>
<LastGenOutput>FxCopFixersResources.Designer.cs</LastGenOutput>
<LastGenOutput>AnalyzerPowerPackFixersResources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="FxCopRulesResources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<EmbeddedResource Include="AnalyzerPowerPackRulesResources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<SubType>Designer</SubType>
<LastGenOutput>FxCopRulesResources.Designer.cs</LastGenOutput>
<LastGenOutput>AnalyzerPowerPackRulesResources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
......
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.0
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.CodeAnalysis.FxCopAnalyzers {
namespace Microsoft.AnalyzerPowerPack {
using System;
using System.Reflection;
/// <summary>
......@@ -22,14 +23,14 @@ namespace Microsoft.CodeAnalysis.FxCopAnalyzers {
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class FxCopFixersResources {
internal class AnalyzerPowerPackFixersResources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal FxCopFixersResources() {
internal AnalyzerPowerPackFixersResources() {
}
/// <summary>
......@@ -39,7 +40,7 @@ internal class FxCopFixersResources {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.CodeAnalysis.FxCopAnalyzers.FxCopFixersResources", typeof(FxCopFixersResources).Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.AnalyzerPowerPack.AnalyzerPowerPackFixersResources", typeof(AnalyzerPowerPackFixersResources).GetTypeInfo().Assembly);
resourceMan = temp;
}
return resourceMan;
......
......@@ -3,10 +3,11 @@
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers
namespace Microsoft.AnalyzerPowerPack
{
public abstract class CodeFixProviderBase : CodeFixProvider
{
......
......@@ -6,10 +6,11 @@
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities;
using Microsoft.AnalyzerPowerPack.Utilities;
using Roslyn.Utilities;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Design
namespace Microsoft.AnalyzerPowerPack.Design
{
/// <summary>
/// CA1008: Enums should have zero value
......@@ -35,41 +36,41 @@ public sealed class CA1008DiagnosticAnalyzer : AbstractNamedTypeAnalyzer
Enum.ToString() returns incorrect results for members that are not zero.
*/
internal const string RuleId = "CA1008";
internal const string RuleRenameCustomTag = "RuleRename";
internal const string RuleMultipleZeroCustomTag = "RuleMultipleZero";
internal const string RuleNoZeroCustomTag = "RuleNoZero";
public const string RuleId = "CA1008";
public const string RuleRenameCustomTag = "RuleRename";
public const string RuleMultipleZeroCustomTag = "RuleMultipleZero";
public const string RuleNoZeroCustomTag = "RuleNoZero";
private static readonly LocalizableString s_localizableTitle = new LocalizableResourceString(nameof(FxCopRulesResources.EnumsShouldHaveZeroValue), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableDescription = new LocalizableResourceString(nameof(FxCopRulesResources.EnumsShouldHaveZeroValueDescription), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableTitle = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.EnumsShouldHaveZeroValue), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
private static readonly LocalizableString s_localizableDescription = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.EnumsShouldHaveZeroValueDescription), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
private static readonly LocalizableString s_localizableMessageRuleRename = new LocalizableResourceString(nameof(FxCopRulesResources.EnumsShouldZeroValueFlagsRename), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableMessageRuleRename = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsRename), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
internal static DiagnosticDescriptor RuleRename = new DiagnosticDescriptor(RuleId,
s_localizableTitle,
s_localizableMessageRuleRename,
FxCopDiagnosticCategory.Design,
AnalyzerPowerPackDiagnosticCategory.Design,
DiagnosticSeverity.Warning,
isEnabledByDefault: false,
description: s_localizableDescription,
helpLinkUri: "http://msdn.microsoft.com/library/ms182149.aspx",
customTags: DiagnosticCustomTags.Microsoft.Concat(RuleRenameCustomTag).ToArray());
private static readonly LocalizableString s_localizableMessageRuleMultipleZero = new LocalizableResourceString(nameof(FxCopRulesResources.EnumsShouldZeroValueFlagsMultipleZero), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableMessageRuleMultipleZero = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsMultipleZero), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
internal static DiagnosticDescriptor RuleMultipleZero = new DiagnosticDescriptor(RuleId,
s_localizableTitle,
s_localizableMessageRuleMultipleZero,
FxCopDiagnosticCategory.Design,
AnalyzerPowerPackDiagnosticCategory.Design,
DiagnosticSeverity.Warning,
isEnabledByDefault: false,
description: s_localizableDescription,
helpLinkUri: "http://msdn.microsoft.com/library/ms182149.aspx",
customTags: DiagnosticCustomTags.Microsoft.Concat(RuleMultipleZeroCustomTag).ToArray());
private static readonly LocalizableString s_localizableMessageRuleNoZero = new LocalizableResourceString(nameof(FxCopRulesResources.EnumsShouldZeroValueNotFlagsNoZeroValue), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableMessageRuleNoZero = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueNotFlagsNoZeroValue), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
internal static DiagnosticDescriptor RuleNoZero = new DiagnosticDescriptor(RuleId,
s_localizableTitle,
s_localizableMessageRuleNoZero,
FxCopDiagnosticCategory.Design,
AnalyzerPowerPackDiagnosticCategory.Design,
DiagnosticSeverity.Warning,
isEnabledByDefault: false,
description: s_localizableDescription,
......
......@@ -5,9 +5,10 @@
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities;
using Microsoft.AnalyzerPowerPack.Utilities;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Design
namespace Microsoft.AnalyzerPowerPack.Design
{
/// <summary>
/// CA1012: Abstract classes should not have public constructors
......@@ -16,13 +17,13 @@ namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Design
public sealed class CA1012DiagnosticAnalyzer : AbstractNamedTypeAnalyzer
{
internal const string RuleId = "CA1012";
private static readonly LocalizableString s_localizableTitle = new LocalizableResourceString(nameof(FxCopRulesResources.AbstractTypesShouldNotHavePublicConstructors), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableMessage = new LocalizableResourceString(nameof(FxCopRulesResources.TypeIsAbstractButHasPublicConstructors), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableTitle = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.AbstractTypesShouldNotHavePublicConstructors), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
private static readonly LocalizableString s_localizableMessage = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.TypeIsAbstractButHasPublicConstructors), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(RuleId,
s_localizableTitle,
s_localizableMessage,
FxCopDiagnosticCategory.Design,
AnalyzerPowerPackDiagnosticCategory.Design,
DiagnosticSeverity.Warning,
isEnabledByDefault: false,
helpLinkUri: "http://msdn.microsoft.com/library/ms182126.aspx",
......
......@@ -3,9 +3,10 @@
using System;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities;
using Microsoft.AnalyzerPowerPack.Utilities;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Design
namespace Microsoft.AnalyzerPowerPack.Design
{
/// <summary>
/// CA1024: Use properties where appropriate
......@@ -16,14 +17,14 @@ namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Design
public abstract class CA1024DiagnosticAnalyzer<TLanguageKindEnum> : DiagnosticAnalyzer where TLanguageKindEnum : struct
{
internal const string RuleId = "CA1024";
private static readonly LocalizableString s_localizableTitle = new LocalizableResourceString(nameof(FxCopRulesResources.UsePropertiesWhereAppropriate), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableMessage = new LocalizableResourceString(nameof(FxCopRulesResources.ChangeToAPropertyIfAppropriate), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableDescription = new LocalizableResourceString(nameof(FxCopRulesResources.UsePropertiesWhereAppropriateDescription), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableTitle = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.UsePropertiesWhereAppropriate), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
private static readonly LocalizableString s_localizableMessage = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.ChangeToAPropertyIfAppropriate), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
private static readonly LocalizableString s_localizableDescription = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.UsePropertiesWhereAppropriateDescription), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(RuleId,
s_localizableTitle,
s_localizableMessage,
FxCopDiagnosticCategory.Design,
AnalyzerPowerPackDiagnosticCategory.Design,
DiagnosticSeverity.Warning,
isEnabledByDefault: false,
description: s_localizableDescription,
......@@ -58,7 +59,7 @@ public override void Initialize(AnalysisContext analysisContext)
return;
}
// Fxcop has a few additional checks to reduce the noise for this diagnostic:
// A few additional checks to reduce the noise for this diagnostic:
// Ensure that the method is non-generic, non-virtual/override, has no overloads and doesn't have special names: 'GetHashCode' or 'GetEnumerator'.
// Also avoid generating this diagnostic if the method body has any invocation expressions.
if (methodSymbol.IsGenericMethod ||
......@@ -89,7 +90,7 @@ protected abstract class CA1024CodeBlockEndedAnalyzer
public void AnalyzeNode(SyntaxNodeAnalysisContext context)
{
// We are analyzing an invocation expression node. This method is suffiently complex to suppress the diagnostic.
// We are analyzing an invocation expression node. This method is sufficiently complex to suppress the diagnostic.
suppress = true;
}
......
......@@ -8,11 +8,12 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities;
using Microsoft.AnalyzerPowerPack.Utilities;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Design
namespace Microsoft.AnalyzerPowerPack.Design
{
/// <summary>
/// CA1008: Enums should have zero value
......@@ -31,13 +32,13 @@ protected sealed override string GetCodeFixDescription(Diagnostic diagnostic)
switch (customTag)
{
case CA1008DiagnosticAnalyzer.RuleRenameCustomTag:
return FxCopFixersResources.EnumsShouldZeroValueFlagsRenameCodeFix;
return AnalyzerPowerPackFixersResources.EnumsShouldZeroValueFlagsRenameCodeFix;
case CA1008DiagnosticAnalyzer.RuleMultipleZeroCustomTag:
return FxCopFixersResources.EnumsShouldZeroValueFlagsMultipleZeroCodeFix;
return AnalyzerPowerPackFixersResources.EnumsShouldZeroValueFlagsMultipleZeroCodeFix;
case CA1008DiagnosticAnalyzer.RuleNoZeroCustomTag:
return FxCopFixersResources.EnumsShouldZeroValueNotFlagsNoZeroValueCodeFix;
return AnalyzerPowerPackFixersResources.EnumsShouldZeroValueNotFlagsNoZeroValueCodeFix;
}
}
......@@ -62,7 +63,7 @@ private SyntaxNode GetExplicitlyAssignedField(IFieldSymbol originalField, Syntax
private async Task<Document> GetUpdatedDocumentForRuleNameRenameAsync(Document document, IFieldSymbol field, CancellationToken cancellationToken)
{
var newSolution = await Rename.Renamer.RenameSymbolAsync(document.Project.Solution, field, "None", null, cancellationToken).ConfigureAwait(false);
var newSolution = await CodeAnalysis.Rename.Renamer.RenameSymbolAsync(document.Project.Solution, field, "None", null, cancellationToken).ConfigureAwait(false);
return newSolution.GetDocument(document.Id);
}
......@@ -84,7 +85,7 @@ private async Task ApplyRuleNameMultipleZeroAsync(SymbolEditor editor, INamedTyp
{
if (makeNextFieldExplicit)
{
await editor.EditOneDeclarationAsync(field, (e, d) => e.ReplaceNode(d, GetExplicitlyAssignedField(field, d, e.Generator)), cancellationToken);
await editor.EditOneDeclarationAsync(field, (e, d) => e.ReplaceNode(d, GetExplicitlyAssignedField(field, d, e.Generator)), cancellationToken).ConfigureAwait(false);
makeNextFieldExplicit = false;
}
......@@ -95,14 +96,14 @@ private async Task ApplyRuleNameMultipleZeroAsync(SymbolEditor editor, INamedTyp
}
else
{
await editor.EditOneDeclarationAsync(field, (e, d) => e.RemoveNode(d), cancellationToken); // removes the field declaration
await editor.EditOneDeclarationAsync(field, (e, d) => e.RemoveNode(d), cancellationToken).ConfigureAwait(false); // removes the field declaration
makeNextFieldExplicit = true;
}
}
if (needsNewZeroValuedNoneField)
{
await editor.EditOneDeclarationAsync(enumType, (e, d) => e.InsertMembers(d, 0, new[] { e.Generator.EnumMember("None") }), cancellationToken);
await editor.EditOneDeclarationAsync(enumType, (e, d) => e.InsertMembers(d, 0, new[] { e.Generator.EnumMember("None") }), cancellationToken).ConfigureAwait(false);
}
}
......@@ -113,12 +114,12 @@ private async Task ApplyRuleNameNoZeroValueAsync(SymbolEditor editor, INamedType
{
if (CA1008DiagnosticAnalyzer.IsMemberNamedNone(field))
{
await editor.EditOneDeclarationAsync(field, (e, d) => e.RemoveNode(d), cancellationToken);
await editor.EditOneDeclarationAsync(field, (e, d) => e.RemoveNode(d), cancellationToken).ConfigureAwait(false);
}
}
// insert zero-valued member 'None' to top
await editor.EditOneDeclarationAsync(enumType, (e, d) => e.InsertMembers(d, 0, new[] { e.Generator.EnumMember("None") }), cancellationToken);
await editor.EditOneDeclarationAsync(enumType, (e, d) => e.InsertMembers(d, 0, new[] { e.Generator.EnumMember("None") }), cancellationToken).ConfigureAwait(false);
}
protected virtual SyntaxNode GetParentNodeOrSelfToFix(SyntaxNode nodeToFix)
......@@ -150,11 +151,11 @@ internal sealed override async Task<Document> GetUpdatedDocumentAsync(Document d
return await GetUpdatedDocumentForRuleNameRenameAsync(document, (IFieldSymbol)declaredSymbol, cancellationToken).ConfigureAwait(false);
case CA1008DiagnosticAnalyzer.RuleMultipleZeroCustomTag:
await ApplyRuleNameMultipleZeroAsync(editor, (INamedTypeSymbol)declaredSymbol, cancellationToken);
await ApplyRuleNameMultipleZeroAsync(editor, (INamedTypeSymbol)declaredSymbol, cancellationToken).ConfigureAwait(false);
return editor.GetChangedDocuments().First();
case CA1008DiagnosticAnalyzer.RuleNoZeroCustomTag:
await ApplyRuleNameNoZeroValueAsync(editor, (INamedTypeSymbol)declaredSymbol, cancellationToken);
await ApplyRuleNameNoZeroValueAsync(editor, (INamedTypeSymbol)declaredSymbol, cancellationToken).ConfigureAwait(false);
return editor.GetChangedDocuments().First();
}
}
......
......@@ -5,12 +5,13 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.Formatting;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Design
namespace Microsoft.AnalyzerPowerPack.Design
{
/// <summary>
/// CA1012: Abstract classes should not have public constructors
......@@ -25,7 +26,7 @@ public sealed override ImmutableArray<string> FixableDiagnosticIds
protected sealed override string GetCodeFixDescription(Diagnostic diagnostic)
{
return FxCopFixersResources.AbstractTypesShouldNotHavePublicConstructorsCodeFix;
return AnalyzerPowerPackFixersResources.AbstractTypesShouldNotHavePublicConstructorsCodeFix;
}
private static SyntaxNode GetDeclaration(ISymbol symbol)
......
......@@ -9,10 +9,11 @@
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Editing;
using Roslyn.Utilities;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities;
using Microsoft.AnalyzerPowerPack.Utilities;
using System.Collections.Generic;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Design
namespace Microsoft.AnalyzerPowerPack.Design
{
/// <summary>
/// CA1033: Interface methods should be callable by child types
......@@ -59,11 +60,11 @@ public async override Task RegisterCodeFixesAsync(CodeFixContext context)
var symbolToChange = candidateToIncreaseVisibility.IsAccessorMethod() ? candidateToIncreaseVisibility.AssociatedSymbol : candidateToIncreaseVisibility;
if (symbolToChange != null)
{
var title = string.Format(FxCopFixersResources.InterfaceMethodsShouldBeCallableByChildTypesFix1, symbolToChange.Name);
var title = string.Format(AnalyzerPowerPackFixersResources.InterfaceMethodsShouldBeCallableByChildTypesFix1, symbolToChange.Name);
context.RegisterCodeFix(new MyCodeAction(title,
async ct => await MakeProtected(context.Document, symbolToChange, ct).ConfigureAwait(false),
equivalenceKey: FxCopFixersResources.InterfaceMethodsShouldBeCallableByChildTypesFix1),
equivalenceKey: AnalyzerPowerPackFixersResources.InterfaceMethodsShouldBeCallableByChildTypesFix1),
context.Diagnostics);
}
}
......@@ -72,18 +73,18 @@ public async override Task RegisterCodeFixesAsync(CodeFixContext context)
var symbolToChange = methodSymbol.IsAccessorMethod() ? methodSymbol.AssociatedSymbol : methodSymbol;
if (symbolToChange != null)
{
var title = string.Format(FxCopFixersResources.InterfaceMethodsShouldBeCallableByChildTypesFix2, symbolToChange.Name);
var title = string.Format(AnalyzerPowerPackFixersResources.InterfaceMethodsShouldBeCallableByChildTypesFix2, symbolToChange.Name);
context.RegisterCodeFix(new MyCodeAction(title,
async ct => await ChangeToPublicInterfaceImplementation(context.Document, symbolToChange, ct).ConfigureAwait(false),
equivalenceKey: FxCopFixersResources.InterfaceMethodsShouldBeCallableByChildTypesFix2),
equivalenceKey: AnalyzerPowerPackFixersResources.InterfaceMethodsShouldBeCallableByChildTypesFix2),
context.Diagnostics);
}
}
context.RegisterCodeFix(new MyCodeAction(string.Format(FxCopFixersResources.InterfaceMethodsShouldBeCallableByChildTypesFix3, methodSymbol.ContainingType.Name),
context.RegisterCodeFix(new MyCodeAction(string.Format(AnalyzerPowerPackFixersResources.InterfaceMethodsShouldBeCallableByChildTypesFix3, methodSymbol.ContainingType.Name),
async ct => await MakeContainingTypeSealed(context.Document, methodSymbol, ct).ConfigureAwait(false),
equivalenceKey: FxCopFixersResources.InterfaceMethodsShouldBeCallableByChildTypesFix3),
equivalenceKey: AnalyzerPowerPackFixersResources.InterfaceMethodsShouldBeCallableByChildTypesFix3),
context.Diagnostics);
}
......@@ -111,7 +112,7 @@ private async Task<Document> MakeProtected(Document document, ISymbol symbolToCh
await editor.EditAllDeclarationsAsync(symbolToChange, (docEditor, declaration) =>
{
docEditor.SetAccessibility(declaration, Accessibility.Protected);
}, cancellationToken);
}, cancellationToken).ConfigureAwait(false);
return editor.GetChangedDocuments().First();
}
......@@ -136,7 +137,7 @@ private async Task<Document> ChangeToPublicInterfaceImplementation(Document docu
}
docEditor.ReplaceNode(declaration, newDeclaration);
}, cancellationToken);
}, cancellationToken).ConfigureAwait(false);
return editor.GetChangedDocuments().First();
}
......@@ -172,7 +173,7 @@ private async Task<Document> MakeContainingTypeSealed(Document document, IMethod
{
var modifiers = docEditor.Generator.GetModifiers(declaration);
docEditor.SetModifiers(declaration, modifiers + DeclarationModifiers.Sealed);
}, cancellationToken);
}, cancellationToken).ConfigureAwait(false);
return editor.GetChangedDocuments().First();
}
......
......@@ -2,10 +2,11 @@
using System.Linq;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities;
using Microsoft.AnalyzerPowerPack.Utilities;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Design
namespace Microsoft.AnalyzerPowerPack.Design
{
/// <summary>
/// CA1033: Interface methods should be callable by child types
......@@ -24,14 +25,14 @@ public abstract class InterfaceMethodsShouldBeCallableByChildTypesAnalyzer<TInvo
{
internal const string RuleId = "CA1033";
private static readonly LocalizableString s_localizableTitle = new LocalizableResourceString(nameof(FxCopRulesResources.InterfaceMethodsShouldBeCallableByChildTypesTitle), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableMessage = new LocalizableResourceString(nameof(FxCopRulesResources.InterfaceMethodsShouldBeCallableByChildTypesMessage), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableDescription = new LocalizableResourceString(nameof(FxCopRulesResources.InterfaceMethodsShouldBeCallableByChildTypesDescription), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableTitle = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.InterfaceMethodsShouldBeCallableByChildTypesTitle), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
private static readonly LocalizableString s_localizableMessage = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.InterfaceMethodsShouldBeCallableByChildTypesMessage), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
private static readonly LocalizableString s_localizableDescription = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.InterfaceMethodsShouldBeCallableByChildTypesDescription), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
internal static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(RuleId,
public static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(RuleId,
s_localizableTitle,
s_localizableMessage,
FxCopDiagnosticCategory.Design,
AnalyzerPowerPackDiagnosticCategory.Design,
DiagnosticSeverity.Warning,
isEnabledByDefault: false,
description: s_localizableDescription,
......@@ -54,7 +55,7 @@ private void AnalyzeCodeBlock(CodeBlockAnalysisContext context)
var method = (IMethodSymbol)context.OwningSymbol;
// We are only intereseted in private explicit interface implementations within a public non-sealed type.
// We are only interested in private explicit interface implementations within a public non-sealed type.
if (method.ExplicitInterfaceImplementations.Length == 0 ||
method.GetResultantVisibility() != SymbolVisibility.Private ||
method.ContainingType.IsSealed ||
......
......@@ -5,10 +5,11 @@
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities;
using Microsoft.AnalyzerPowerPack.Utilities;
using Roslyn.Utilities;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Design
namespace Microsoft.AnalyzerPowerPack.Design
{
/// <summary>
/// CA1025: Static holder types should be sealed
......@@ -16,27 +17,27 @@ namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Design
[DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)]
public sealed class StaticTypeRulesDiagnosticAnalyzer : AbstractNamedTypeAnalyzer
{
internal const string RuleNameForExportAttribute = "StaticHolderTypeRules";
internal const string CA1052RuleId = "CA1052";
internal const string CA1053RuleId = "CA1053";
public const string RuleNameForExportAttribute = "StaticHolderTypeRules";
public const string CA1052RuleId = "CA1052";
public const string CA1053RuleId = "CA1053";
private static readonly LocalizableString s_localizableTitleCA1052 = new LocalizableResourceString(nameof(FxCopRulesResources.StaticHolderTypesShouldBeStaticOrNotInheritable), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableMessageCA1052 = new LocalizableResourceString(nameof(FxCopRulesResources.StaticHolderTypeIsNotStatic), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableTitleCA1052 = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.StaticHolderTypesShouldBeStaticOrNotInheritable), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
private static readonly LocalizableString s_localizableMessageCA1052 = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.StaticHolderTypeIsNotStatic), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
internal static readonly DiagnosticDescriptor CA1052Rule = new DiagnosticDescriptor(CA1052RuleId,
s_localizableTitleCA1052,
s_localizableMessageCA1052,
FxCopDiagnosticCategory.Usage,
AnalyzerPowerPackDiagnosticCategory.Usage,
DiagnosticSeverity.Warning,
isEnabledByDefault: false,
helpLinkUri: "http://msdn.microsoft.com/library/ms182168.aspx",
customTags: DiagnosticCustomTags.Microsoft);
private static readonly LocalizableString s_localizableTitleCA1053 = new LocalizableResourceString(nameof(FxCopRulesResources.StaticHolderTypesShouldNotHaveConstructors), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableMessageCA1053 = new LocalizableResourceString(nameof(FxCopRulesResources.StaticHolderTypesShouldNotHaveConstructorsMessage), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableTitleCA1053 = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.StaticHolderTypesShouldNotHaveConstructors), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
private static readonly LocalizableString s_localizableMessageCA1053 = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.StaticHolderTypesShouldNotHaveConstructorsMessage), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
internal static readonly DiagnosticDescriptor CA1053Rule = new DiagnosticDescriptor(CA1053RuleId,
s_localizableTitleCA1053,
s_localizableMessageCA1053,
FxCopDiagnosticCategory.Usage,
AnalyzerPowerPackDiagnosticCategory.Usage,
DiagnosticSeverity.Warning,
isEnabledByDefault: false,
helpLinkUri: "http://msdn.microsoft.com/library/ms182169.aspx",
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.CodeAnalysis.FxCopAnalyzers
namespace Microsoft.AnalyzerPowerPack
{
public static class DiagnosticKind
{
......
......@@ -7,7 +7,7 @@
namespace Microsoft.CodeAnalysis
{
internal class DocumentChangeAction : CodeAction
public class DocumentChangeAction : CodeAction
{
private readonly string _title;
private readonly Func<CancellationToken, Task<Document>> _createChangedDocument;
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.CodeAnalysis.FxCopAnalyzers
namespace Microsoft.AnalyzerPowerPack
{
internal class FxCopDiagnosticCategory
internal class AnalyzerPowerPackDiagnosticCategory
{
public static readonly string Design = FxCopRulesResources.CategoryDesign;
public static readonly string Globalization = FxCopRulesResources.CategoryGlobalization;
public static readonly string Interoperability = FxCopRulesResources.CategoryInteroperability;
public static readonly string Performance = FxCopRulesResources.CategoryPerformance;
public static readonly string Reliability = FxCopRulesResources.CategoryReliability;
public static readonly string Usage = FxCopRulesResources.CategoryUsage;
public static readonly string Naming = FxCopRulesResources.CategoryNaming;
public static readonly string Design = AnalyzerPowerPackRulesResources.CategoryDesign;
public static readonly string Globalization = AnalyzerPowerPackRulesResources.CategoryGlobalization;
public static readonly string Interoperability = AnalyzerPowerPackRulesResources.CategoryInteroperability;
public static readonly string Performance = AnalyzerPowerPackRulesResources.CategoryPerformance;
public static readonly string Reliability = AnalyzerPowerPackRulesResources.CategoryReliability;
public static readonly string Usage = AnalyzerPowerPackRulesResources.CategoryUsage;
public static readonly string Naming = AnalyzerPowerPackRulesResources.CategoryNaming;
}
}
......@@ -3,10 +3,11 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers
namespace Microsoft.AnalyzerPowerPack
{
public abstract class MultipleCodeFixProviderBase : CodeFixProvider
{
......
......@@ -6,28 +6,29 @@
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities;
using Microsoft.AnalyzerPowerPack.Utilities;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Naming
namespace Microsoft.AnalyzerPowerPack.Naming
{
[DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)]
public sealed class CA1708DiagnosticAnalyzer : AbstractNamedTypeAnalyzer
{
internal const string RuleId = "CA1708";
internal const string Namespace = "Namespaces";
internal const string Type = "Types";
internal const string Member = "Members";
internal const string Parameter = "Parameters of";
public const string RuleId = "CA1708";
public const string Namespace = "Namespaces";
public const string Type = "Types";
public const string Member = "Members";
public const string Parameter = "Parameters of";
internal static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(RuleId,
new LocalizableResourceString(nameof(FxCopRulesResources.IdentifiersShouldDifferByMoreThanCase), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources)),
new LocalizableResourceString(nameof(FxCopRulesResources.IdentifierNamesShouldDifferMoreThanCase), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources)),
FxCopDiagnosticCategory.Naming,
new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.IdentifiersShouldDifferByMoreThanCase), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources)),
new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.IdentifierNamesShouldDifferMoreThanCase), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources)),
AnalyzerPowerPackDiagnosticCategory.Naming,
DiagnosticSeverity.Warning,
isEnabledByDefault: false,
description: new LocalizableResourceString(nameof(FxCopRulesResources.IdentifiersShouldDifferByMoreThanCaseDescription), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources)),
description: new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.IdentifiersShouldDifferByMoreThanCaseDescription), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources)),
helpLinkUri: "http://msdn.microsoft.com/library/ms182242.aspx",
customTags: DiagnosticCustomTags.Microsoft);
......@@ -99,7 +100,7 @@ private void CheckNamespaceMembers(IEnumerable<INamespaceSymbol> namespaces, Com
}
else
{
// If the namespace does not contain any externally visible types then exclude it from namecheck
// If the namespace does not contain any externally visible types then exclude it from name check
excludedNamespaces.Add(@namespace);
}
......@@ -124,7 +125,7 @@ private void CheckNamespaceMembers(IEnumerable<INamespaceSymbol> namespaces, Com
private static void CheckTypeMembers(IEnumerable<ISymbol> members, Action<Diagnostic> addDiagnostic)
{
// Remove constructors, indexers, operators and destructors for namecheck
// Remove constructors, indexers, operators and destructors for name check
var membersForNameCheck = members.Where(item => !item.IsConstructor() && !item.IsDestructor() && !item.IsIndexer() && !item.IsUserDefinedOperator());
if (membersForNameCheck.Any())
{
......@@ -168,7 +169,7 @@ private static void CheckParameterNames(IEnumerable<IParameterSymbol> parameters
return;
}
var parameterList = parameters.GroupBy((item) => item.Name, StringComparer.InvariantCultureIgnoreCase).Where((group) => group.Count() > 1);
var parameterList = parameters.GroupBy((item) => item.Name, StringComparer.OrdinalIgnoreCase).Where((group) => group.Count() > 1);
foreach (var group in parameterList)
{
......@@ -187,7 +188,7 @@ private static bool HasViolatingParameters(ISymbol symbol)
return false;
}
return parameters.GroupBy(item => item.Name, StringComparer.InvariantCultureIgnoreCase).Where((group) => group.Count() > 1).Any();
return parameters.GroupBy(item => item.Name, StringComparer.OrdinalIgnoreCase).Where((group) => group.Count() > 1).Any();
}
private static void CheckMemberNames(IEnumerable<ISymbol> members, Action<Diagnostic> addDiagnostic)
......@@ -199,7 +200,7 @@ private static void CheckMemberNames(IEnumerable<ISymbol> members, Action<Diagno
}
var overloadedMembers = members.Where((item) => !item.IsType()).GroupBy((item) => item.Name).Where((group) => group.Count() > 1).SelectMany((group) => group.Skip(1));
var memberList = members.Where((item) => !overloadedMembers.Contains(item)).GroupBy((item) => DiagnosticHelpers.GetMemberName(item), StringComparer.InvariantCultureIgnoreCase).Where((group) => group.Count() > 1);
var memberList = members.Where((item) => !overloadedMembers.Contains(item)).GroupBy((item) => DiagnosticHelpers.GetMemberName(item), StringComparer.OrdinalIgnoreCase).Where((group) => group.Count() > 1);
foreach (var group in memberList)
{
......@@ -216,7 +217,7 @@ private static void CheckTypeNames(IEnumerable<ITypeSymbol> types, Action<Diagno
return;
}
var typeList = types.GroupBy((item) => DiagnosticHelpers.GetMemberName(item), StringComparer.InvariantCultureIgnoreCase)
var typeList = types.GroupBy((item) => DiagnosticHelpers.GetMemberName(item), StringComparer.OrdinalIgnoreCase)
.Where((group) => group.Count() > 1);
foreach (var group in typeList)
......@@ -233,7 +234,7 @@ private static void CheckNamespaceNames(IEnumerable<INamespaceSymbol> namespaces
return;
}
var namespaceList = namespaces.GroupBy((item) => item.ToDisplayString(), StringComparer.InvariantCultureIgnoreCase).Where((group) => group.Count() > 1);
var namespaceList = namespaces.GroupBy((item) => item.ToDisplayString(), StringComparer.OrdinalIgnoreCase).Where((group) => group.Count() > 1);
foreach (var group in namespaceList)
{
......@@ -247,7 +248,7 @@ private static void CheckNamespaceNames(IEnumerable<INamespaceSymbol> namespaces
private static string GetSymbolDisplayString(IGrouping<string, ISymbol> group)
{
return string.Join(", ", group.Select(s => s.ToDisplayString()).OrderBy(k => k, StringComparer.InvariantCulture));
return string.Join(", ", group.Select(s => s.ToDisplayString()).OrderBy(k => k, StringComparer.Ordinal));
}
public static bool IsExternallyVisible(ISymbol symbol)
......
......@@ -3,30 +3,31 @@
using System;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities;
using Microsoft.AnalyzerPowerPack.Utilities;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Naming
namespace Microsoft.AnalyzerPowerPack.Naming
{
[DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)]
public sealed class CA1715DiagnosticAnalyzer : DiagnosticAnalyzer
{
internal const string RuleId = "CA1715";
public const string RuleId = "CA1715";
private static readonly LocalizableString s_localizableMessageAndTitleInterfaceRule = new LocalizableResourceString(nameof(FxCopRulesResources.InterfaceNamesShouldStartWithI), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
internal static readonly DiagnosticDescriptor InterfaceRule = new DiagnosticDescriptor(RuleId,
private static readonly LocalizableString s_localizableMessageAndTitleInterfaceRule = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.InterfaceNamesShouldStartWithI), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
public static readonly DiagnosticDescriptor InterfaceRule = new DiagnosticDescriptor(RuleId,
s_localizableMessageAndTitleInterfaceRule,
s_localizableMessageAndTitleInterfaceRule,
FxCopDiagnosticCategory.Naming,
AnalyzerPowerPackDiagnosticCategory.Naming,
DiagnosticSeverity.Warning,
isEnabledByDefault: true,
helpLinkUri: "http://msdn.microsoft.com/library/ms182243.aspx",
customTags: DiagnosticCustomTags.Microsoft);
private static readonly LocalizableString s_localizableMessageAndTitleTypeParameterRule = new LocalizableResourceString(nameof(FxCopRulesResources.TypeParameterNamesShouldStartWithT), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
internal static readonly DiagnosticDescriptor TypeParameterRule = new DiagnosticDescriptor(RuleId,
private static readonly LocalizableString s_localizableMessageAndTitleTypeParameterRule = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.TypeParameterNamesShouldStartWithT), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
public static readonly DiagnosticDescriptor TypeParameterRule = new DiagnosticDescriptor(RuleId,
s_localizableMessageAndTitleTypeParameterRule,
s_localizableMessageAndTitleTypeParameterRule,
FxCopDiagnosticCategory.Naming,
AnalyzerPowerPackDiagnosticCategory.Naming,
DiagnosticSeverity.Warning,
isEnabledByDefault: true,
helpLinkUri: "http://msdn.microsoft.com/library/ms182243.aspx",
......
......@@ -6,10 +6,11 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Editing;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Performance
namespace Microsoft.AnalyzerPowerPack.Performance
{
/// <summary>
/// CA1821: Remove empty finalizers
......@@ -33,7 +34,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
// We cannot have multiple overlapping diagnostics of this id.
var diagnostic = context.Diagnostics.Single();
context.RegisterCodeFix(new MyCodeAction(FxCopFixersResources.RemoveEmptyFinalizers,
context.RegisterCodeFix(new MyCodeAction(AnalyzerPowerPackFixersResources.RemoveEmptyFinalizers,
async ct => await RemoveFinalizer(context.Document, node, ct).ConfigureAwait(false)),
diagnostic);
return;
......
......@@ -2,20 +2,21 @@
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities;
using Microsoft.AnalyzerPowerPack.Utilities;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Performance
namespace Microsoft.AnalyzerPowerPack.Performance
{
public abstract class RemoveEmptyFinalizers<TLanguageKindEnum> : DiagnosticAnalyzer where TLanguageKindEnum : struct
{
public const string RuleId = "CA1821";
private static readonly LocalizableString s_localizableMessageAndTitle = new LocalizableResourceString(nameof(FxCopRulesResources.RemoveEmptyFinalizers), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableDescription = new LocalizableResourceString(nameof(FxCopRulesResources.RemoveEmptyFinalizersDescription), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableMessageAndTitle = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.RemoveEmptyFinalizers), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
private static readonly LocalizableString s_localizableDescription = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.RemoveEmptyFinalizersDescription), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(RuleId,
s_localizableMessageAndTitle,
s_localizableMessageAndTitle,
FxCopDiagnosticCategory.Performance,
AnalyzerPowerPackDiagnosticCategory.Performance,
DiagnosticSeverity.Warning,
isEnabledByDefault: true,
description: s_localizableDescription,
......
......@@ -2,4 +2,4 @@
using System.Resources;
[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.MainAssembly)]
\ No newline at end of file
[assembly: NeutralResourcesLanguage("en-US")]
\ No newline at end of file
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities
using Microsoft.CodeAnalysis;
namespace Microsoft.AnalyzerPowerPack.Utilities
{
internal static class CommonAccessibilityUtilities
{
......
......@@ -3,8 +3,9 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities
namespace Microsoft.AnalyzerPowerPack.Utilities
{
internal static class DiagnosticHelpers
{
......
......@@ -2,8 +2,9 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities
namespace Microsoft.AnalyzerPowerPack.Utilities
{
public static class DiagnosticExtensions
{
......
......@@ -5,7 +5,7 @@
using System.Collections.Immutable;
using System.Linq;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities
namespace Microsoft.AnalyzerPowerPack.Utilities
{
internal static class IEnumerableExtensions
{
......
// 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.Collections.Generic;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities
namespace Microsoft.AnalyzerPowerPack.Utilities
{
internal static class INamedTypeSymbolExtensions
{
......
// 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.Collections.Immutable;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities
namespace Microsoft.AnalyzerPowerPack.Utilities
{
public static class ISymbolExtensions
{
......
......@@ -2,8 +2,9 @@
using System;
using System.Collections.Generic;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities
namespace Microsoft.AnalyzerPowerPack.Utilities
{
public static class ITypeSymbolExtensions
{
......
......@@ -2,7 +2,7 @@
using System;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities
namespace Microsoft.AnalyzerPowerPack.Utilities
{
internal static class ObjectExtensions
{
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities
using Microsoft.CodeAnalysis;
namespace Microsoft.AnalyzerPowerPack.Utilities
{
internal static class WellKnownTypes
public static class WellKnownTypes
{
public static INamedTypeSymbol FlagsAttribute(Compilation compilation)
{
......
......@@ -5,7 +5,7 @@
using System.ComponentModel;
using System.Text;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities
namespace Microsoft.AnalyzerPowerPack.Utilities
{
/// <summary>
/// Provides <see langword="static"/> methods for parsing words from text.
......@@ -22,11 +22,11 @@ public class WordParser
// allocation of a Collection<String> if you manually construct WordParser
// and use the NextWord method instead of using the static Parse method.
//
// [char]: Represents any unicode character
// [A-Z]: Represents any unicode uppercase letter
// [a-z]: Represents any unicode lowercase letter
// [char]: Represents any Unicode character
// [A-Z]: Represents any Unicode uppercase letter
// [a-z]: Represents any Unicode lowercase letter
// [0-9]: Represents the numbers 0 to 9
// [letter]: Represents any unicode letter
// [letter]: Represents any Unicode letter
//
// <words> -> <prefix>(<word> | <notword>)+
//
......@@ -68,7 +68,7 @@ public class WordParser
/// <exception cref="ArgumentNullException">
/// <paramref name="text"/> is <see langword="null"/>.
/// </exception>
/// <exception cref="InvalidEnumArgumentException">
/// <exception cref="ArgumentException">
/// <paramref name="options"/> is not one or more of the <see cref="WordParserOptions"/> values.
/// </exception>
internal WordParser(string text, WordParserOptions options) : this(text, options, NullChar)
......@@ -91,7 +91,7 @@ internal WordParser(string text, WordParserOptions options) : this(text, options
/// <exception cref="ArgumentNullException">
/// <paramref name="text"/> is <see langword="null"/>.
/// </exception>
/// <exception cref="InvalidEnumArgumentException">
/// <exception cref="ArgumentException">
/// <paramref name="options"/> is not one or more of the <see cref="WordParserOptions"/> values.
/// </exception>
internal WordParser(string text, WordParserOptions options, char prefix)
......@@ -103,7 +103,7 @@ internal WordParser(string text, WordParserOptions options, char prefix)
if (options < WordParserOptions.None || options > (WordParserOptions.IgnoreMnemonicsIndicators | WordParserOptions.SplitCompoundWords))
{
throw new InvalidEnumArgumentException(nameof(options), (int)options, typeof(WordParserOptions));
throw new ArgumentException($"'{nameof(options)}' ({((int)options).ToString()}) is invalid for Enum type'{typeof(WordParserOptions).Name}'");
}
_text = text;
......@@ -145,7 +145,7 @@ private bool SplitCompoundWords
/// <exception cref="ArgumentNullException">
/// <paramref name="text"/> is <see langword="null"/>.
/// </exception>
/// <exception cref="InvalidEnumArgumentException">
/// <exception cref="ArgumentException">
/// <paramref name="options"/> is not one or more of the <see cref="WordParserOptions"/> values.
/// </exception>
internal static Collection<string> Parse(string text, WordParserOptions options)
......@@ -172,7 +172,7 @@ internal static Collection<string> Parse(string text, WordParserOptions options)
/// <exception cref="ArgumentNullException">
/// <paramref name="text"/> is <see langword="null"/>.
/// </exception>
/// <exception cref="InvalidEnumArgumentException">
/// <exception cref="ArgumentException">
/// <paramref name="options"/> is not one or more of the <see cref="WordParserOptions"/> values.
/// </exception>
internal static Collection<string> Parse(string text, WordParserOptions options, char prefix)
......@@ -190,7 +190,7 @@ internal static Collection<string> Parse(string text, WordParserOptions options,
}
/// <summary>
/// Returns a value indicating whether at least one of the specified words occurs, using a case-insensitive ordinal comparision, within the specified text.
/// Returns a value indicating whether at least one of the specified words occurs, using a case-insensitive ordinal comparison, within the specified text.
/// </summary>
/// <param name="text">
/// A <see cref="String"/> containing the text to check.
......@@ -211,7 +211,7 @@ internal static Collection<string> Parse(string text, WordParserOptions options,
/// </para>
/// <paramref name="words"/> is <see langword="null"/>.
/// </exception>
/// <exception cref="InvalidEnumArgumentException">
/// <exception cref="ArgumentException">
/// <paramref name="options"/> is not one or more of the <see cref="WordParserOptions"/> values.
/// </exception>
internal static bool ContainsWord(string text, WordParserOptions options, params string[] words)
......@@ -220,7 +220,7 @@ internal static bool ContainsWord(string text, WordParserOptions options, params
}
/// <summary>
/// Returns a value indicating whether at least one of the specified words occurs, using a case-insensitive ordinal comparision, within the specified text.
/// Returns a value indicating whether at least one of the specified words occurs, using a case-insensitive ordinal comparison, within the specified text.
/// </summary>
/// <param name="text">
/// A <see cref="String"/> containing the text to check.
......@@ -245,7 +245,7 @@ internal static bool ContainsWord(string text, WordParserOptions options, params
/// </para>
/// <paramref name="words"/> is <see langword="null"/>.
/// </exception>
/// <exception cref="InvalidEnumArgumentException">
/// <exception cref="ArgumentException">
/// <paramref name="options"/> is not one or more of the <see cref="WordParserOptions"/> values.
/// </exception>
internal static bool ContainsWord(string text, WordParserOptions options, char prefix, params string[] words)
......@@ -340,7 +340,7 @@ private bool ParseNext()
return true;
}
// Unrecogized character, ignore
// Unrecognized character, ignore
Skip();
continue;
}
......
......@@ -2,7 +2,7 @@
using System;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities
namespace Microsoft.AnalyzerPowerPack.Utilities
{
/// <summary>
/// Defines the word parsing and delimiting options for use with <see cref="WordParser.Parse(String,WordParserOptions)"/>.
......
......@@ -2,20 +2,21 @@
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities;
using Microsoft.AnalyzerPowerPack.Utilities;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Usage
namespace Microsoft.AnalyzerPowerPack.Usage
{
public abstract class CA2200DiagnosticAnalyzer : DiagnosticAnalyzer
{
internal const string RuleId = "CA2200";
private static readonly LocalizableString s_localizableTitle = new LocalizableResourceString(nameof(FxCopRulesResources.RethrowToPreserveStackDetails), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableMessage = new LocalizableResourceString(nameof(FxCopRulesResources.RethrowException), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableTitle = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.RethrowToPreserveStackDetails), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
private static readonly LocalizableString s_localizableMessage = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.RethrowException), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(RuleId,
s_localizableTitle,
s_localizableMessage,
FxCopDiagnosticCategory.Usage,
AnalyzerPowerPackDiagnosticCategory.Usage,
DiagnosticSeverity.Warning,
isEnabledByDefault: true,
helpLinkUri: "http://msdn.microsoft.com/library/ms182363.aspx",
......
......@@ -2,9 +2,10 @@
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities;
using Microsoft.AnalyzerPowerPack.Utilities;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Usage
namespace Microsoft.AnalyzerPowerPack.Usage
{
/// <summary>
/// CA2214: Do not call overridable methods in constructors
......@@ -18,13 +19,13 @@ namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Usage
public abstract class CA2214DiagnosticAnalyzer<TLanguageKindEnum> : DiagnosticAnalyzer where TLanguageKindEnum : struct
{
public const string RuleId = "CA2214";
private static readonly LocalizableString s_localizableMessageAndTitle = new LocalizableResourceString(nameof(FxCopRulesResources.DoNotCallOverridableMethodsInConstructors), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableDescription = new LocalizableResourceString(nameof(FxCopRulesResources.DoNotCallOverridableMethodsInConstructorsDescription), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableMessageAndTitle = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.DoNotCallOverridableMethodsInConstructors), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
private static readonly LocalizableString s_localizableDescription = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.DoNotCallOverridableMethodsInConstructorsDescription), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
public static DiagnosticDescriptor Rule = new DiagnosticDescriptor(RuleId,
s_localizableMessageAndTitle,
s_localizableMessageAndTitle,
FxCopDiagnosticCategory.Usage,
AnalyzerPowerPackDiagnosticCategory.Usage,
DiagnosticSeverity.Warning,
isEnabledByDefault: true,
description: s_localizableDescription,
......
......@@ -9,11 +9,12 @@
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities;
using Microsoft.AnalyzerPowerPack.Utilities;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Usage
namespace Microsoft.AnalyzerPowerPack.Usage
{
/// <summary>
/// CA2229: Implement serialization constructors.
......@@ -37,17 +38,17 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
var diagnostic = context.Diagnostics.Single();
// There was no constructor and so the diagnostic was on the type. Generate a serlialization ctor.
// There was no constructor and so the diagnostic was on the type. Generate a serialization ctor.
if (symbol.Kind == SymbolKind.NamedType)
{
context.RegisterCodeFix(new MyCodeAction(FxCopFixersResources.ImplementSerializationConstructor,
context.RegisterCodeFix(new MyCodeAction(AnalyzerPowerPackFixersResources.ImplementSerializationConstructor,
async ct => await GenerateConstructor(context.Document, node, symbol, ct).ConfigureAwait(false)),
diagnostic);
}
// There is a serialization constructor but with incorrect accessibility. Set that right.
else if (symbol.Kind == SymbolKind.Method)
{
context.RegisterCodeFix(new MyCodeAction(FxCopFixersResources.ImplementSerializationConstructor,
context.RegisterCodeFix(new MyCodeAction(AnalyzerPowerPackFixersResources.ImplementSerializationConstructor,
async ct => await SetAccessibility(context.Document, node, symbol, ct).ConfigureAwait(false)),
diagnostic);
}
......@@ -75,7 +76,7 @@ private async Task<Document> GenerateConstructor(Document document, SyntaxNode n
statements: new[] { throwStatement });
docEditor.AddMember(declaration, ctorDecl);
}, cancellationToken);
}, cancellationToken).ConfigureAwait(false);
return editor.GetChangedDocuments().First();
}
......@@ -91,7 +92,7 @@ private async Task<Document> SetAccessibility(Document document, SyntaxNode node
{
var newAccessibility = methodSymbol.ContainingType.IsSealed ? Accessibility.Private : Accessibility.Protected;
docEditor.SetAccessibility(declaration, newAccessibility);
}, cancellationToken);
}, cancellationToken).ConfigureAwait(false);
return editor.GetChangedDocuments().First();
}
......
......@@ -8,10 +8,11 @@
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities;
using Microsoft.AnalyzerPowerPack.Utilities;
using Roslyn.Utilities;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Usage
namespace Microsoft.AnalyzerPowerPack.Usage
{
/// <summary>
/// CA2235: Mark all non-serializable fields
......@@ -35,7 +36,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
var diagnostic = context.Diagnostics.Single();
// Fix 1: Add a NonSerialized attribute to the field
context.RegisterCodeFix(new MyCodeAction(FxCopFixersResources.AddNonSerializedAttribute,
context.RegisterCodeFix(new MyCodeAction(AnalyzerPowerPackFixersResources.AddNonSerializedAttribute,
async ct => await AddNonSerializedAttribute(context.Document, fieldNode, ct).ConfigureAwait(false)),
diagnostic);
......@@ -46,7 +47,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
var type = fieldSymbol?.Type;
if (type != null && type.Locations.Any(l => l.IsInSource))
{
context.RegisterCodeFix(new MyCodeAction(FxCopFixersResources.AddSerializableAttribute,
context.RegisterCodeFix(new MyCodeAction(AnalyzerPowerPackFixersResources.AddSerializableAttribute,
async ct => await AddSerializableAttributeToType(context.Document, type, ct).ConfigureAwait(false)),
diagnostic);
}
......@@ -67,7 +68,7 @@ private static async Task<Document> AddSerializableAttributeToType(Document docu
{
var serializableAttr = docEditor.Generator.Attribute(docEditor.Generator.TypeExpression(WellKnownTypes.SerializableAttribute(docEditor.SemanticModel.Compilation)));
docEditor.AddAttribute(declaration, serializableAttr);
}, cancellationToken);
}, cancellationToken).ConfigureAwait(false);
return editor.GetChangedDocuments().First();
}
......
......@@ -8,9 +8,10 @@
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities;
using Microsoft.AnalyzerPowerPack.Utilities;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Usage
namespace Microsoft.AnalyzerPowerPack.Usage
{
/// <summary>
/// CA2237: Mark ISerializable types with SerializableAttribute
......@@ -32,7 +33,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
}
var diagnostic = context.Diagnostics.Single();
context.RegisterCodeFix(new MyCodeAction(FxCopFixersResources.AddSerializableAttribute,
context.RegisterCodeFix(new MyCodeAction(AnalyzerPowerPackFixersResources.AddSerializableAttribute,
async ct => await AddSerializableAttribute(context.Document, node, ct).ConfigureAwait(false)),
diagnostic);
}
......
......@@ -2,23 +2,24 @@
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities;
using Microsoft.AnalyzerPowerPack.Utilities;
namespace Microsoft.CodeAnalysis.FxCopAnalyzers.Usage
namespace Microsoft.AnalyzerPowerPack.Usage
{
[DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)]
public sealed class SerializationRulesDiagnosticAnalyzer : DiagnosticAnalyzer
{
// Implement serialization constructors
internal const string RuleCA2229Id = "CA2229";
private static readonly LocalizableString s_localizableTitleCA2229 = new LocalizableResourceString(nameof(FxCopRulesResources.ImplementSerializationConstructor), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableDescriptionCA2229 = new LocalizableResourceString(nameof(FxCopRulesResources.ImplementSerializationConstructorDescription), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableTitleCA2229 = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.ImplementSerializationConstructor), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
private static readonly LocalizableString s_localizableDescriptionCA2229 = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.ImplementSerializationConstructorDescription), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
internal static DiagnosticDescriptor RuleCA2229 = new DiagnosticDescriptor(RuleCA2229Id,
s_localizableTitleCA2229,
"{0}",
FxCopDiagnosticCategory.Usage,
AnalyzerPowerPackDiagnosticCategory.Usage,
DiagnosticSeverity.Warning,
isEnabledByDefault: true,
description: s_localizableDescriptionCA2229,
......@@ -27,14 +28,14 @@ public sealed class SerializationRulesDiagnosticAnalyzer : DiagnosticAnalyzer
// Mark ISerializable types with SerializableAttribute
internal const string RuleCA2237Id = "CA2237";
private static readonly LocalizableString s_localizableTitleCA2237 = new LocalizableResourceString(nameof(FxCopRulesResources.MarkISerializableTypesWithAttribute), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableMessageCA2237 = new LocalizableResourceString(nameof(FxCopRulesResources.AddSerializableAttributeToType), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableDescriptionCA2237 = new LocalizableResourceString(nameof(FxCopRulesResources.MarkISerializableTypesWithAttributeDescription), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableTitleCA2237 = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.MarkISerializableTypesWithAttribute), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
private static readonly LocalizableString s_localizableMessageCA2237 = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.AddSerializableAttributeToType), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
private static readonly LocalizableString s_localizableDescriptionCA2237 = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.MarkISerializableTypesWithAttributeDescription), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
internal static DiagnosticDescriptor RuleCA2237 = new DiagnosticDescriptor(RuleCA2237Id,
s_localizableTitleCA2237,
s_localizableMessageCA2237,
FxCopDiagnosticCategory.Usage,
AnalyzerPowerPackDiagnosticCategory.Usage,
DiagnosticSeverity.Warning,
isEnabledByDefault: true,
description: s_localizableDescriptionCA2237,
......@@ -43,14 +44,14 @@ public sealed class SerializationRulesDiagnosticAnalyzer : DiagnosticAnalyzer
// Mark all non-serializable fields
internal const string RuleCA2235Id = "CA2235";
private static readonly LocalizableString s_localizableTitleCA2235 = new LocalizableResourceString(nameof(FxCopRulesResources.MarkAllNonSerializableFields), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableMessageCA2235 = new LocalizableResourceString(nameof(FxCopRulesResources.FieldIsOfNonSerializableType), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableDescriptionCA2235 = new LocalizableResourceString(nameof(FxCopRulesResources.MarkAllNonSerializableFieldsDescription), FxCopRulesResources.ResourceManager, typeof(FxCopRulesResources));
private static readonly LocalizableString s_localizableTitleCA2235 = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.MarkAllNonSerializableFields), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
private static readonly LocalizableString s_localizableMessageCA2235 = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.FieldIsOfNonSerializableType), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
private static readonly LocalizableString s_localizableDescriptionCA2235 = new LocalizableResourceString(nameof(AnalyzerPowerPackRulesResources.MarkAllNonSerializableFieldsDescription), AnalyzerPowerPackRulesResources.ResourceManager, typeof(AnalyzerPowerPackRulesResources));
internal static DiagnosticDescriptor RuleCA2235 = new DiagnosticDescriptor(RuleCA2235Id,
s_localizableTitleCA2235,
s_localizableMessageCA2235,
FxCopDiagnosticCategory.Usage,
AnalyzerPowerPackDiagnosticCategory.Usage,
DiagnosticSeverity.Warning,
isEnabledByDefault: true,
description: s_localizableDescriptionCA2235,
......@@ -146,20 +147,20 @@ public void AnalyzeSymbol(SymbolAnalysisContext context)
// There is no serialization ctor - issue a diagnostic.
if (serializationCtor == null)
{
context.ReportDiagnostic(namedTypeSymbol.CreateDiagnostic(RuleCA2229, string.Format(FxCopRulesResources.SerializableTypeDoesntHaveCtor, namedTypeSymbol.Name)));
context.ReportDiagnostic(namedTypeSymbol.CreateDiagnostic(RuleCA2229, string.Format(AnalyzerPowerPackRulesResources.SerializableTypeDoesntHaveCtor, namedTypeSymbol.Name)));
}
else
{
// Check the accessibility
// The serializationctor should be protected if the class is unsealed and private if the class is sealed.
// The serialization ctor should be protected if the class is unsealed and private if the class is sealed.
if (namedTypeSymbol.IsSealed && serializationCtor.DeclaredAccessibility != Accessibility.Private)
{
context.ReportDiagnostic(serializationCtor.CreateDiagnostic(RuleCA2229, string.Format(FxCopRulesResources.SerializationCtorAccessibilityForSealedType, namedTypeSymbol.Name)));
context.ReportDiagnostic(serializationCtor.CreateDiagnostic(RuleCA2229, string.Format(AnalyzerPowerPackRulesResources.SerializationCtorAccessibilityForSealedType, namedTypeSymbol.Name)));
}
if (!namedTypeSymbol.IsSealed && serializationCtor.DeclaredAccessibility != Accessibility.Protected)
{
context.ReportDiagnostic(serializationCtor.CreateDiagnostic(RuleCA2229, string.Format(FxCopRulesResources.SerializationCtorAccessibilityForUnSealedType, namedTypeSymbol.Name)));
context.ReportDiagnostic(serializationCtor.CreateDiagnostic(RuleCA2229, string.Format(AnalyzerPowerPackRulesResources.SerializationCtorAccessibilityForUnSealedType, namedTypeSymbol.Name)));
}
}
}
......
......@@ -10,7 +10,7 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{A5844BB9-7B62-475B-AC61-298E5A23EFFE}</ProjectGuid>
<ProjectGuid>{FFCA21B9-C7CB-4F0F-851B-947EE25C416C}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>FxCopRulesSetup</RootNamespace>
<AssemblyName>FxCopRulesSetup</AssemblyName>
......@@ -25,29 +25,6 @@
<RestorePackages>true</RestorePackages>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\CSharp\CSharpFxCopRulesDiagnosticAnalyzers.csproj">
<Project>{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}</Project>
<Name>CSharpFxCopRulesDiagnosticAnalyzers</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIXLocalOnly>DebugSymbolsProjectOutputGroup</IncludeOutputGroupsInVSIXLocalOnly>
</ProjectReference>
<ProjectReference Include="..\VisualBasic\BasicFxCopRulesDiagnosticAnalyzers.vbproj">
<Project>{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}</Project>
<Name>BasicFxCopRulesDiagnosticAnalyzers</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIXLocalOnly>DebugSymbolsProjectOutputGroup</IncludeOutputGroupsInVSIXLocalOnly>
</ProjectReference>
<ProjectReference Include="..\Core\FxCopRulesDiagnosticAnalyzers.csproj">
<Project>{36755424-5267-478C-9434-37A507E22711}</Project>
<Name>FxCopRulesDiagnosticAnalyzers</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIXLocalOnly>DebugSymbolsProjectOutputGroup</IncludeOutputGroupsInVSIXLocalOnly>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
......@@ -83,9 +60,28 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Core\AnalyzerPowerPack.Common.csproj">
<Name>AnalyzerPowerPack.Common</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIXLocalOnly>DebugSymbolsProjectOutputGroup</IncludeOutputGroupsInVSIXLocalOnly>
</ProjectReference>
<ProjectReference Include="..\CSharp\AnalyzerPowerPack.CSharp.csproj">
<Name>AnalyzerPowerPack.CSharp</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIXLocalOnly>DebugSymbolsProjectOutputGroup</IncludeOutputGroupsInVSIXLocalOnly>
</ProjectReference>
<ProjectReference Include="..\VisualBasic\AnalyzerPowerPack.VisualBasic.vbproj">
<Name>AnalyzerPowerPack.VisualBasic</Name>
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup%3bBuiltProjectOutputGroup%3bBuiltProjectOutputGroupDependencies%3bGetCopyToOutputDirectoryItems%3bSatelliteDllsProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIXLocalOnly>DebugSymbolsProjectOutputGroup</IncludeOutputGroupsInVSIXLocalOnly>
</ProjectReference>
</ItemGroup>
<ImportGroup Label="Targets">
<Import Project="..\..\..\Tools\Microsoft.CodeAnalysis.Toolset.Open\Targets\VSL.Imports.targets" />
<Import Project="..\..\..\..\build\VSL.Imports.Closed.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</ImportGroup>
</Project>
</Project>
\ No newline at end of file
......@@ -7,13 +7,13 @@
<Description xml:space="preserve">Setup project for ported FxCop Diagnostics.</Description>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[12.0,]" />
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[14.0,]" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.Analyzer" Path="Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers.dll" />
<Asset Type="Microsoft.VisualStudio.Analyzer" Path="Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.dll" />
<Asset Type="Microsoft.VisualStudio.Analyzer" Path="Microsoft.AnalyzerPowerPack.CSharp.dll" />
<Asset Type="Microsoft.VisualStudio.Analyzer" Path="Microsoft.AnalyzerPowerPack.VisualBasic.dll" />
</Assets>
</PackageManifest>
......@@ -38,8 +38,8 @@
<Name>Workspaces</Name>
</ProjectReference>
<ProjectReference Include="..\Core\SystemRuntimeAnalyzers.csproj">
<Project>{d8762a0a-3832-47be-bcf6-8b1060be6b28}</Project>
<Name>CodeAnalysisDiagnosticAnalyzers</Name>
<Project>{baa0fee4-93c8-46f0-bb36-53a6053776c8}</Project>
<Name>SystemRuntimeAnalyzers</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
......
......@@ -8,10 +8,10 @@
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
<ProjectGuid>{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17}</ProjectGuid>
<ProjectGuid>{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.UnitTests</RootNamespace>
<AssemblyName>Roslyn.Diagnostics.Analyzers.FxCop.UnitTests</AssemblyName>
<RootNamespace>Microsoft.AnalyzerPowerPack.UnitTests</RootNamespace>
<AssemblyName>Microsoft.AnalyzerPowerPack.UnitTests</AssemblyName>
<Nonshipping>true</Nonshipping>
<SolutionDir Condition="'$(SolutionDir)' == '' OR '$(SolutionDir)' == '*Undefined*'">..\..\..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
......@@ -46,18 +46,6 @@
<Project>{5F8D2414-064A-4B3A-9B42-8E2A04246BE5}</Project>
<Name>Workspaces</Name>
</ProjectReference>
<ProjectReference Include="..\Core\FxCopRulesDiagnosticAnalyzers.csproj">
<Project>{36755424-5267-478C-9434-37A507E22711}</Project>
<Name>FxCopRulesDiagnosticAnalyzers</Name>
</ProjectReference>
<ProjectReference Include="..\CSharp\CSharpFxCopRulesDiagnosticAnalyzers.csproj">
<Project>{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}</Project>
<Name>CSharpFxCopRulesDiagnosticAnalyzers</Name>
</ProjectReference>
<ProjectReference Include="..\VisualBasic\BasicFxCopRulesDiagnosticAnalyzers.vbproj">
<Project>{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}</Project>
<Name>BasicFxCopRulesDiagnosticAnalyzers</Name>
</ProjectReference>
<ProjectReference Include="..\..\Test\Utilities\DiagnosticsTestUtilities.csproj">
<Project>{0A0621F2-D1DC-47FF-B643-C6646557505E}</Project>
<Name>DiagnosticsTestUtilities</Name>
......@@ -67,6 +55,15 @@
<Name>CompilerTestResources</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\Core\AnalyzerPowerPack.Common.csproj">
<Name>AnalyzerPowerPack.Common</Name>
</ProjectReference>
<ProjectReference Include="..\CSharp\AnalyzerPowerPack.CSharp.csproj">
<Name>AnalyzerPowerPack.CSharp</Name>
</ProjectReference>
<ProjectReference Include="..\VisualBasic\AnalyzerPowerPack.VisualBasic.vbproj">
<Name>AnalyzerPowerPack.VisualBasic</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
</PropertyGroup>
......@@ -125,4 +122,4 @@
<Import Project="..\..\..\..\build\Roslyn.Toolsets.Xunit.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</ImportGroup>
</Project>
</Project>
\ No newline at end of file
// 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 Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Design;
using Microsoft.AnalyzerPowerPack;
using Microsoft.AnalyzerPowerPack.Design;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
using Microsoft.CodeAnalysis.UnitTests;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public class CA1008Tests : DiagnosticAnalyzerTestBase
{
......@@ -26,10 +27,10 @@ protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
public void CSharp_EnumsShouldZeroValueFlagsRename()
{
// In enum '{0}', change the name of '{1}' to 'None'.
var expectedMessage1 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsRename, "E", "A");
var expectedMessage2 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsRename, "E2", "A2");
var expectedMessage3 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsRename, "E3", "A3");
var expectedMessage4 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsRename, "E4", "A4");
var expectedMessage1 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsRename, "E", "A");
var expectedMessage2 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsRename, "E2", "A2");
var expectedMessage3 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsRename, "E3", "A3");
var expectedMessage4 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsRename, "E4", "A4");
var code = @"
[System.Flags]
......@@ -77,8 +78,8 @@ public enum NoZeroValuedField
public void CSharp_EnumsShouldZeroValueFlagsMultipleZero()
{
// Remove all members that have the value zero from {0} except for one member that is named 'None'.
var expectedMessage1 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsMultipleZero, "E");
var expectedMessage2 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsMultipleZero, "E2");
var expectedMessage1 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsMultipleZero, "E");
var expectedMessage2 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsMultipleZero, "E2");
var code = @"// Some comment
[System.Flags]
......@@ -103,8 +104,8 @@ internal enum E2
public void CSharp_EnumsShouldZeroValueFlagsMultipleZeroWithScope()
{
// Remove all members that have the value zero from {0} except for one member that is named 'None'.
var expectedMessage1 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsMultipleZero, "E");
var expectedMessage2 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsMultipleZero, "E2");
var expectedMessage1 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsMultipleZero, "E");
var expectedMessage2 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsMultipleZero, "E2");
var code = @"// Some comment
[System.Flags]
......@@ -128,8 +129,8 @@ internal enum E2
public void CSharp_EnumsShouldZeroValueNotFlagsNoZeroValue()
{
// Add a member to {0} that has a value of zero with a suggested name of 'None'.
var expectedMessage1 = string.Format(FxCopRulesResources.EnumsShouldZeroValueNotFlagsNoZeroValue, "E");
var expectedMessage2 = string.Format(FxCopRulesResources.EnumsShouldZeroValueNotFlagsNoZeroValue, "E2");
var expectedMessage1 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueNotFlagsNoZeroValue, "E");
var expectedMessage2 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueNotFlagsNoZeroValue, "E2");
var code = @"
private enum E
......@@ -164,8 +165,8 @@ internal enum E4
public void CSharp_EnumsShouldZeroValueNotFlagsNoZeroValueWithScope()
{
// Add a member to {0} that has a value of zero with a suggested name of 'None'.
var expectedMessage1 = string.Format(FxCopRulesResources.EnumsShouldZeroValueNotFlagsNoZeroValue, "E");
var expectedMessage2 = string.Format(FxCopRulesResources.EnumsShouldZeroValueNotFlagsNoZeroValue, "E2");
var expectedMessage1 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueNotFlagsNoZeroValue, "E");
var expectedMessage2 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueNotFlagsNoZeroValue, "E2");
var code = @"
class C
......@@ -202,10 +203,10 @@ internal enum E4
public void VisualBasic_EnumsShouldZeroValueFlagsRename()
{
// In enum '{0}', change the name of '{1}' to 'None'.
var expectedMessage1 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsRename, "E", "A");
var expectedMessage2 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsRename, "E2", "A2");
var expectedMessage3 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsRename, "E3", "A3");
var expectedMessage4 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsRename, "E4", "A4");
var expectedMessage1 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsRename, "E", "A");
var expectedMessage2 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsRename, "E2", "A2");
var expectedMessage3 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsRename, "E3", "A3");
var expectedMessage4 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsRename, "E4", "A4");
var code = @"
<System.Flags>
......@@ -242,10 +243,10 @@ End Enum
public void VisualBasic_EnumsShouldZeroValueFlagsRenameScope()
{
// In enum '{0}', change the name of '{1}' to 'None'.
var expectedMessage1 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsRename, "E", "A");
var expectedMessage2 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsRename, "E2", "A2");
var expectedMessage3 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsRename, "E3", "A3");
var expectedMessage4 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsRename, "E4", "A4");
var expectedMessage1 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsRename, "E", "A");
var expectedMessage2 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsRename, "E2", "A2");
var expectedMessage3 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsRename, "E3", "A3");
var expectedMessage4 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsRename, "E4", "A4");
var code = @"
<System.Flags>
......@@ -282,10 +283,10 @@ End Enum
public void VisualBasic_EnumsShouldZeroValueFlagsRename_AttributeListHasTrivia()
{
// In enum '{0}', change the name of '{1}' to 'None'.
var expectedMessage1 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsRename, "E", "A");
var expectedMessage2 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsRename, "E2", "A2");
var expectedMessage3 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsRename, "E3", "A3");
var expectedMessage4 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsRename, "E4", "A4");
var expectedMessage1 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsRename, "E", "A");
var expectedMessage2 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsRename, "E2", "A2");
var expectedMessage3 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsRename, "E3", "A3");
var expectedMessage4 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsRename, "E4", "A4");
var code = @"
<System.Flags> _
......@@ -322,9 +323,9 @@ End Enum
public void VisualBasic_EnumsShouldZeroValueFlagsMultipleZero()
{
// Remove all members that have the value zero from {0} except for one member that is named 'None'.
var expectedMessage1 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsMultipleZero, "E");
var expectedMessage2 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsMultipleZero, "E2");
var expectedMessage3 = string.Format(FxCopRulesResources.EnumsShouldZeroValueFlagsMultipleZero, "E3");
var expectedMessage1 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsMultipleZero, "E");
var expectedMessage2 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsMultipleZero, "E2");
var expectedMessage3 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueFlagsMultipleZero, "E3");
var code = @"
<System.Flags>
......@@ -355,8 +356,8 @@ End Enum
public void VisualBasic_EnumsShouldZeroValueNotFlagsNoZeroValue()
{
// Add a member to {0} that has a value of zero with a suggested name of 'None'.
var expectedMessage1 = string.Format(FxCopRulesResources.EnumsShouldZeroValueNotFlagsNoZeroValue, "E");
var expectedMessage2 = string.Format(FxCopRulesResources.EnumsShouldZeroValueNotFlagsNoZeroValue, "E2");
var expectedMessage1 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueNotFlagsNoZeroValue, "E");
var expectedMessage2 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueNotFlagsNoZeroValue, "E2");
var code = @"
Private Enum E
......@@ -388,8 +389,8 @@ End Enum
public void VisualBasic_EnumsShouldZeroValueNotFlagsNoZeroValueWithScope()
{
// Add a member to {0} that has a value of zero with a suggested name of 'None'.
var expectedMessage1 = string.Format(FxCopRulesResources.EnumsShouldZeroValueNotFlagsNoZeroValue, "E");
var expectedMessage2 = string.Format(FxCopRulesResources.EnumsShouldZeroValueNotFlagsNoZeroValue, "E2");
var expectedMessage1 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueNotFlagsNoZeroValue, "E");
var expectedMessage2 = string.Format(AnalyzerPowerPackRulesResources.EnumsShouldZeroValueNotFlagsNoZeroValue, "E2");
var code = @"
Private Enum E
......
// 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 Microsoft.AnalyzerPowerPack;
using Microsoft.AnalyzerPowerPack.Design;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Design;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.UnitTests;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public partial class CA1012Tests : DiagnosticAnalyzerTestBase
{
......@@ -226,7 +227,7 @@ End Class
}
internal static string CA1012Name = "CA1012";
internal static string CA1012Message = FxCopRulesResources.TypeIsAbstractButHasPublicConstructors;
internal static string CA1012Message = AnalyzerPowerPackRulesResources.TypeIsAbstractButHasPublicConstructors;
private static DiagnosticResult GetCA1012CSharpResultAt(int line, int column, string objectName)
{
......
// 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 Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers.Design;
using Microsoft.AnalyzerPowerPack;
using Microsoft.AnalyzerPowerPack.CSharp.Design;
using Microsoft.AnalyzerPowerPack.VisualBasic.Design;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Design;
using Roslyn.Test.Utilities;
using Microsoft.CodeAnalysis.UnitTests;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public partial class CA1024Tests : DiagnosticAnalyzerTestBase
{
......@@ -379,12 +379,12 @@ End Class
private static DiagnosticResult GetCA1024CSharpResultAt(int line, int column, string methodName)
{
return GetCSharpResultAt(line, column, CA1024Name, string.Format(FxCopRulesResources.ChangeToAPropertyIfAppropriate, methodName));
return GetCSharpResultAt(line, column, CA1024Name, string.Format(AnalyzerPowerPackRulesResources.ChangeToAPropertyIfAppropriate, methodName));
}
private static DiagnosticResult GetCA1024BasicResultAt(int line, int column, string methodName)
{
return GetBasicResultAt(line, column, CA1024Name, string.Format(FxCopRulesResources.ChangeToAPropertyIfAppropriate, methodName));
return GetBasicResultAt(line, column, CA1024Name, string.Format(AnalyzerPowerPackRulesResources.ChangeToAPropertyIfAppropriate, methodName));
}
}
}
// 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 Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers.Design;
using Microsoft.AnalyzerPowerPack.CSharp.Design;
using Microsoft.AnalyzerPowerPack.VisualBasic.Design;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Design;
using Microsoft.CodeAnalysis.UnitTests;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public class CA1033Tests : DiagnosticAnalyzerTestBase
{
......
// 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 Microsoft.AnalyzerPowerPack;
using Microsoft.AnalyzerPowerPack.Design;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Design;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.UnitTests;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public class CA1052Tests : DiagnosticAnalyzerTestBase
{
......@@ -24,12 +25,12 @@ protected override DiagnosticAnalyzer GetBasicDiagnosticAnalyzer()
private static DiagnosticResult CSharpResult(int line, int column, string objectName)
{
return GetCSharpResultAt(line, column, StaticTypeRulesDiagnosticAnalyzer.CA1052RuleId, string.Format(FxCopRulesResources.StaticHolderTypeIsNotStatic, objectName));
return GetCSharpResultAt(line, column, StaticTypeRulesDiagnosticAnalyzer.CA1052RuleId, string.Format(AnalyzerPowerPackRulesResources.StaticHolderTypeIsNotStatic, objectName));
}
private static DiagnosticResult BasicResult(int line, int column, string objectName)
{
return GetBasicResultAt(line, column, StaticTypeRulesDiagnosticAnalyzer.CA1052RuleId, string.Format(FxCopRulesResources.StaticHolderTypeIsNotStatic, objectName));
return GetBasicResultAt(line, column, StaticTypeRulesDiagnosticAnalyzer.CA1052RuleId, string.Format(AnalyzerPowerPackRulesResources.StaticHolderTypeIsNotStatic, objectName));
}
#endregion
......
// 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 Microsoft.AnalyzerPowerPack;
using Microsoft.AnalyzerPowerPack.Design;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Design;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.UnitTests;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
// Some of the CA1052Tests tests hold true here as CA1052 and CA1053 are mutually exclusive
public class CA1053Tests : DiagnosticAnalyzerTestBase
......@@ -28,12 +29,12 @@ protected override DiagnosticAnalyzer GetBasicDiagnosticAnalyzer()
private static DiagnosticResult CSharpResult(int line, int column, string objectName)
{
return GetCSharpResultAt(line, column, StaticTypeRulesDiagnosticAnalyzer.CA1053RuleId, string.Format(FxCopRulesResources.StaticHolderTypesShouldNotHaveConstructorsMessage, objectName));
return GetCSharpResultAt(line, column, StaticTypeRulesDiagnosticAnalyzer.CA1053RuleId, string.Format(AnalyzerPowerPackRulesResources.StaticHolderTypesShouldNotHaveConstructorsMessage, objectName));
}
private static DiagnosticResult BasicResult(int line, int column, string objectName)
{
return GetBasicResultAt(line, column, StaticTypeRulesDiagnosticAnalyzer.CA1053RuleId, string.Format(FxCopRulesResources.StaticHolderTypesShouldNotHaveConstructorsMessage, objectName));
return GetBasicResultAt(line, column, StaticTypeRulesDiagnosticAnalyzer.CA1053RuleId, string.Format(AnalyzerPowerPackRulesResources.StaticHolderTypesShouldNotHaveConstructorsMessage, objectName));
}
#endregion
......
// 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 Microsoft.AnalyzerPowerPack.CSharp.Design;
using Microsoft.AnalyzerPowerPack.Design;
using Microsoft.AnalyzerPowerPack.VisualBasic.Design;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers.Design;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Design;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Design;
using Microsoft.CodeAnalysis.UnitTests;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public class CA1008FixerTests : CodeFixTestBase
{
......
// 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 Microsoft.AnalyzerPowerPack.Design;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Design;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.UnitTests;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public partial class CA1012FixerTests : CodeFixTestBase
{
......
// 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 Microsoft.AnalyzerPowerPack.CSharp.Design;
using Microsoft.AnalyzerPowerPack.Design;
using Microsoft.AnalyzerPowerPack.VisualBasic.Design;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers.Design;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Design;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Design;
using Microsoft.CodeAnalysis.UnitTests;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public class CA1033FixerTests : CodeFixTestBase
{
......
......@@ -3,15 +3,15 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading;
using Microsoft.AnalyzerPowerPack.Naming;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Naming;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.UnitTests;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests.HardeningAnalyzer
namespace Microsoft.AnalyzerPowerPack.UnitTests.HardeningAnalyzer
{
public class HardeningAnalyzerTests : DiagnosticAnalyzerTestBase
{
......@@ -42,13 +42,13 @@ public class Class6<TTypeParameter>
{
}
";
var diagnosticsBag = DiagnosticBag.GetInstance();
var diagnostics = new List<Diagnostic>();
var documentsAndSpan = GetDocumentsAndSpans(new[] { source }, LanguageNames.CSharp);
AnalyzeDocumentCore(GetCSharpDiagnosticAnalyzer(), documentsAndSpan.Item1[0], diagnosticsBag.Add, null, logAnalyzerExceptionAsDiagnostics: true);
var diagnostics = diagnosticsBag.ToReadOnlyAndFree();
Assert.True(diagnostics.Length > 0);
Assert.Equal(string.Format("info AD0001: " + AnalyzerDriverResources.AnalyzerThrows, GetCSharpDiagnosticAnalyzer().GetType(), "System.NotImplementedException", "The method or operation is not implemented."),
DiagnosticFormatter.Instance.Format(diagnostics[0], EnsureEnglishUICulture.PreferredOrNull));
AnalyzeDocumentCore(GetCSharpDiagnosticAnalyzer(), documentsAndSpan.Item1[0], diagnostics.Add, null, logAnalyzerExceptionAsDiagnostics: true);
Assert.True(diagnostics.Count > 0);
Assert.Equal(
$"info AD0001: The Compiler Analyzer '{GetCSharpDiagnosticAnalyzer().GetType()}' threw an exception of type 'System.NotImplementedException' with message 'The method or operation is not implemented.'.",
(new DiagnosticFormatter()).Format(diagnostics[0], EnsureEnglishUICulture.PreferredOrNull));
}
#region "Test_Class"
......
// 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 Microsoft.AnalyzerPowerPack;
using Microsoft.AnalyzerPowerPack.Naming;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Naming;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.UnitTests;
using Roslyn.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public class CA1708Tests : DiagnosticAnalyzerTestBase
{
......@@ -315,7 +317,7 @@ public int CAsE1
}
}
",
GetCA1708CSharpResultAt(Member, GetSymbolDisplayString("NI.CASE1.Case1", "NI.CASE1.CAse1(int)", "NI.CASE1.CaSe1<T>(T)", "NI.CASE1.CASe1", "NI.CASE1.CasE1", "NI.CASE1.caSE1", "NI.CASE1.CAsE1"), 4, 18));
GetCA1708CSharpResultAt(Member, GetSymbolDisplayStringNoSorting("NI.CASE1.CASe1", "NI.CASE1.CAsE1", "NI.CASE1.CAse1(int)", "NI.CASE1.CaSe1<T>(T)", "NI.CASE1.CasE1", "NI.CASE1.Case1", "NI.CASE1.caSE1"), 4, 18));
}
[Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)]
......@@ -380,7 +382,7 @@ public partial class D
#region Helper Methods
private const string RuleName = CA1708DiagnosticAnalyzer.RuleId;
private static readonly string s_message = FxCopRulesResources.IdentifierNamesShouldDifferMoreThanCase;
private static readonly string s_message = AnalyzerPowerPackRulesResources.IdentifierNamesShouldDifferMoreThanCase;
private const string Namespace = CA1708DiagnosticAnalyzer.Namespace;
private const string Type = CA1708DiagnosticAnalyzer.Type;
......@@ -389,7 +391,12 @@ public partial class D
private static string GetSymbolDisplayString(params string[] objectName)
{
return string.Join(", ", objectName.OrderBy(StringComparer.InvariantCulture));
return string.Join(", ", objectName.OrderByDescending(x => x, StringComparer.InvariantCulture));
}
private static string GetSymbolDisplayStringNoSorting(params string[] objectName)
{
return string.Join(", ", objectName);
}
private static DiagnosticResult GetCA1708CSharpResult(string typeName, string objectName)
......
// 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 Microsoft.AnalyzerPowerPack;
using Microsoft.AnalyzerPowerPack.Naming;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Naming;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.UnitTests;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public class CA1715Test : DiagnosticAnalyzerTestBase
{
......@@ -291,8 +292,8 @@ End Class
GetCA1715BasicResultAt(46, 30, CA1715TypeParameterMessage));
}
internal static string CA1715InterfaceMessage = FxCopRulesResources.InterfaceNamesShouldStartWithI;
internal static string CA1715TypeParameterMessage = FxCopRulesResources.TypeParameterNamesShouldStartWithT;
internal static string CA1715InterfaceMessage = AnalyzerPowerPackRulesResources.InterfaceNamesShouldStartWithI;
internal static string CA1715TypeParameterMessage = AnalyzerPowerPackRulesResources.TypeParameterNamesShouldStartWithT;
private static DiagnosticResult GetCA1715CSharpResultAt(int line, int column, string message)
{
......
// 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 Microsoft.AnalyzerPowerPack.CSharp.Performance;
using Microsoft.AnalyzerPowerPack.Performance;
using Microsoft.AnalyzerPowerPack.VisualBasic.Performance;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers.Performance;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Performance;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Performance;
using Microsoft.CodeAnalysis.UnitTests;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public partial class RemoveEmptyFinalizersFixerTests : CodeFixTestBase
{
......
// 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 Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers.Performance;
using Microsoft.AnalyzerPowerPack.CSharp.Performance;
using Microsoft.AnalyzerPowerPack.VisualBasic.Performance;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Performance;
using Microsoft.CodeAnalysis.UnitTests;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public partial class RemoveEmptyFinalizersTests : DiagnosticAnalyzerTestBase
{
......
// 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 Microsoft.AnalyzerPowerPack;
using Microsoft.AnalyzerPowerPack.CSharp.Usage;
using Microsoft.AnalyzerPowerPack.VisualBasic.Usage;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Usage;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Usage;
using Roslyn.Test.Utilities;
using Microsoft.CodeAnalysis.UnitTests;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public partial class CA2200Tests : DiagnosticAnalyzerTestBase
{
......@@ -367,7 +367,7 @@ End Sub
}
internal static string CA2200Name = "CA2200";
internal static string CA2200Message = FxCopRulesResources.RethrowException;
internal static string CA2200Message = AnalyzerPowerPackRulesResources.RethrowException;
private static DiagnosticResult GetCA2200BasicResultAt(int line, int column)
{
......
// 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 Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers.Usage;
using Microsoft.AnalyzerPowerPack.CSharp.Usage;
using Microsoft.AnalyzerPowerPack.VisualBasic.Usage;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Usage;
using Roslyn.Test.Utilities;
using Microsoft.CodeAnalysis.UnitTests;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public partial class CA2214Tests : DiagnosticAnalyzerTestBase
{
......
// 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 Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Usage;
using Microsoft.AnalyzerPowerPack;
using Microsoft.AnalyzerPowerPack.Usage;
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;
using Microsoft.CodeAnalysis.UnitTests;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public partial class CA2229Tests : DiagnosticAnalyzerTestBase
{
......@@ -410,9 +411,9 @@ End Sub
}
internal static string CA2229Name = "CA2229";
internal static string CA2229Message = FxCopRulesResources.SerializableTypeDoesntHaveCtor;
internal static string CA2229MessageSealed = FxCopRulesResources.SerializationCtorAccessibilityForSealedType;
internal static string CA2229MessageUnsealed = FxCopRulesResources.SerializationCtorAccessibilityForUnSealedType;
internal static string CA2229Message = AnalyzerPowerPackRulesResources.SerializableTypeDoesntHaveCtor;
internal static string CA2229MessageSealed = AnalyzerPowerPackRulesResources.SerializationCtorAccessibilityForSealedType;
internal static string CA2229MessageUnsealed = AnalyzerPowerPackRulesResources.SerializationCtorAccessibilityForUnSealedType;
private static DiagnosticResult GetCA2229CSharpResultAt(int line, int column, string objectName, string message)
{
......
// 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 Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Usage;
using Microsoft.AnalyzerPowerPack;
using Microsoft.AnalyzerPowerPack.Usage;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
using Microsoft.CodeAnalysis.UnitTests;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public partial class CA2235Tests : DiagnosticAnalyzerTestBase
{
......@@ -219,7 +220,7 @@ End Class
}
internal static string CA2235Name = "CA2235";
internal static string CA2235Message = FxCopRulesResources.FieldIsOfNonSerializableType;
internal static string CA2235Message = AnalyzerPowerPackRulesResources.FieldIsOfNonSerializableType;
private static DiagnosticResult GetCA2235CSharpResultAt(int line, int column, string fieldName, string containerName, string typeName)
{
......
// 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 Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Usage;
using Microsoft.AnalyzerPowerPack;
using Microsoft.AnalyzerPowerPack.Usage;
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;
using Microsoft.CodeAnalysis.UnitTests;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public partial class CA2237Tests : DiagnosticAnalyzerTestBase
{
......@@ -202,7 +203,7 @@ End Class
}
internal static string CA2237Name = "CA2237";
internal static string CA2237Message = FxCopRulesResources.AddSerializableAttributeToType;
internal static string CA2237Message = AnalyzerPowerPackRulesResources.AddSerializableAttributeToType;
private static DiagnosticResult GetCA2237CSharpResultAt(int line, int column, string objectName)
{
......
......@@ -2,12 +2,13 @@
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Usage;
using Microsoft.AnalyzerPowerPack.Usage;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
using Microsoft.CodeAnalysis.UnitTests;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public partial class CA2229FixerTests : CodeFixTestBase
{
......
// 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 Microsoft.AnalyzerPowerPack.CSharp.Usage;
using Microsoft.AnalyzerPowerPack.Usage;
using Microsoft.AnalyzerPowerPack.VisualBasic.Usage;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers.Usage;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Usage;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Usage;
using Microsoft.CodeAnalysis.UnitTests;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public partial class CA2235FixerTests : CodeFixTestBase
{
......
// 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 Microsoft.AnalyzerPowerPack.Usage;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.FxCopAnalyzers.Usage;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.UnitTests;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
namespace Microsoft.AnalyzerPowerPack.UnitTests
{
public partial class CA2237FixerTests : CodeFixTestBase
{
......
......@@ -8,14 +8,17 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}</ProjectGuid>
<ProjectTypeGuids>{14182A97-F7F0-4C62-8B27-98AA8AE2109A};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
<ProjectGuid>{45854FF7-A6D5-4B28-87A1-0B75390125C0}</ProjectGuid>
<OutputType>Library</OutputType>
<AnalyzerProject>true</AnalyzerProject>
<AssemblyName>Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers</AssemblyName>
<AssemblyName>Microsoft.AnalyzerPowerPack.VisualBasic</AssemblyName>
<DocumentationFile>Microsoft.CodeAnalysis.VisualBasic.FxCopRules.DiagnosticAnalyzers.xml</DocumentationFile>
<SolutionDir Condition="'$(SolutionDir)' == '' OR '$(SolutionDir)' == '*Undefined*'">..\..\..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
</PropertyGroup>
<ItemGroup Label="File References">
<Reference Include="..\..\..\..\packages\System.Collections.Immutable.$(SystemCollectionsImmutableVersion)\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll" />
......@@ -29,20 +32,19 @@
<Project>{2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}</Project>
<Name>BasicCodeAnalysis</Name>
</ProjectReference>
<ProjectReference Include="..\Core\FxCopRulesDiagnosticAnalyzers.csproj">
<Project>{36755424-5267-478C-9434-37A507E22711}</Project>
<Name>FxCopRulesDiagnosticAnalyzers</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\Core\Portable\Workspaces.csproj">
<Project>{5F8D2414-064A-4B3A-9B42-8E2A04246BE5}</Project>
<Name>Workspaces</Name>
</ProjectReference>
<ProjectReference Include="..\Core\AnalyzerPowerPack.Common.csproj">
<Name>AnalyzerPowerPack.Common</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DocumentationFile>Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.xml</DocumentationFile>
<DocumentationFile>Microsoft.AnalyzerPowerPack.VisualBasic.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DocumentationFile>Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.xml</DocumentationFile>
<DocumentationFile>Microsoft.AnalyzerPowerPack.VisualBasic.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
......@@ -56,6 +58,9 @@
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<RootNamespace>Microsoft.AnalyzerPowerPack.VisualBasic</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Composition.AttributedModel">
......@@ -79,8 +84,6 @@
<HintPath>..\..\..\..\packages\Microsoft.Composition.$(MicrosoftCompositionVersion)\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
......@@ -89,7 +92,6 @@
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Threading.Tasks" />
......
......@@ -2,11 +2,13 @@
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.FxCopAnalyzers.Design
Imports Microsoft.AnalyzerPowerPack.Design
Imports System.Collections.Immutable
Imports System.Threading
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.VisualBasic
Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Design
Namespace Design
<DiagnosticAnalyzer(LanguageNames.VisualBasic)>
Public Class BasicCA1024DiagnosticAnalyzer
Inherits CA1024DiagnosticAnalyzer(Of SyntaxKind)
......
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.FxCopAnalyzers.Design
Imports Microsoft.AnalyzerPowerPack.Design
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis
Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Design
Namespace Design
''' <summary>
''' CA1033: Interface methods should be callable by child types
......
......@@ -2,10 +2,12 @@
Imports System.Composition
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.FxCopAnalyzers.Design
Imports Microsoft.AnalyzerPowerPack.Design
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.VisualBasic
Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Design
Namespace Design
' <summary>
' CA1008: Enums should have zero value
' </summary>
......
......@@ -6,12 +6,14 @@ Imports System.Threading
Imports Microsoft.CodeAnalysis.CodeActions
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.Formatting
Imports Microsoft.CodeAnalysis.FxCopAnalyzers
Imports Microsoft.CodeAnalysis.FxCopAnalyzers.Design
Imports Microsoft.AnalyzerPowerPack
Imports Microsoft.AnalyzerPowerPack.Design
Imports Microsoft.CodeAnalysis.Shared.Extensions
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.VisualBasic
Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Design
Namespace Design
<ExportCodeFixProvider(LanguageNames.VisualBasic, Name:=StaticTypeRulesDiagnosticAnalyzer.RuleNameForExportAttribute), [Shared]>
Public Class CA1052BasicCodeFixProvider
......@@ -33,10 +35,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Design
Dim cancellationToken = context.CancellationToken
cancellationToken.ThrowIfCancellationRequested()
Dim root = Await document.GetSyntaxRootAsync(cancellationToken)
Dim root = Await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False)
Dim classStatement = root.FindToken(span.Start).Parent?.FirstAncestorOrSelf(Of ClassStatementSyntax)
If classStatement IsNot Nothing Then
Dim title As String = String.Format(FxCopRulesResources.StaticHolderTypeIsNotStatic, classStatement.Identifier.Text)
Dim title As String = String.Format(AnalyzerPowerPackRulesResources.StaticHolderTypeIsNotStatic, classStatement.Identifier.Text)
Dim fix = New MyCodeAction(title, Function(ct) AddNotInheritableKeyword(document, root, classStatement))
context.RegisterCodeFix(fix, context.Diagnostics)
End If
......
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.FxCopAnalyzers.Performance
Imports Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities
Imports Microsoft.AnalyzerPowerPack.Performance
Imports Microsoft.AnalyzerPowerPack.Utilities
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.VisualBasic
Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Performance
Namespace Performance
<DiagnosticAnalyzer(LanguageNames.VisualBasic)>
Public Class BasicRemoveEmptyFinalizers
Inherits RemoveEmptyFinalizers(Of SyntaxKind)
......
......@@ -3,10 +3,12 @@
Imports System.Collections.Immutable
Imports System.Threading
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.FxCopAnalyzers.Usage
Imports Microsoft.AnalyzerPowerPack.Usage
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.VisualBasic
Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Usage
Namespace Usage
<DiagnosticAnalyzer(LanguageNames.VisualBasic)>
Public Class BasicCA2200DiagnosticAnalyzer
Inherits CA2200DiagnosticAnalyzer
......
......@@ -3,11 +3,13 @@
Imports System.Collections.Immutable
Imports System.Threading
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.FxCopAnalyzers.Usage
Imports Microsoft.CodeAnalysis.FxCopAnalyzers.Utilities
Imports Microsoft.AnalyzerPowerPack.Usage
Imports Microsoft.AnalyzerPowerPack.Utilities
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.VisualBasic
Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Usage
Namespace Usage
<DiagnosticAnalyzer(LanguageNames.VisualBasic)>
Public Class BasicCA2214DiagnosticAnalyzer
Inherits CA2214DiagnosticAnalyzer(Of SyntaxKind)
......
......@@ -2,20 +2,22 @@
Imports System.Composition
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.FxCopAnalyzers.Usage
Imports Microsoft.AnalyzerPowerPack.Usage
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.VisualBasic
Namespace Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers.Usage
Namespace Usage
<ExportCodeFixProvider(LanguageNames.VisualBasic, Name:="CA2229 CodeFix provider"), [Shared]>
Public Class BasicMarkAllNonSerializableFieldsFixer
Inherits MarkAllNonSerializableFieldsFixer
Protected Overrides Function GetFieldDeclarationNode(node As SyntaxNode) As SyntaxNode
Dim fieldNode = node
While fieldNode IsNot Nothing AndAlso fieldNode.Kind() <> VisualBasic.SyntaxKind.FieldDeclaration
While fieldNode IsNot Nothing AndAlso fieldNode.Kind() <> SyntaxKind.FieldDeclaration
fieldNode = fieldNode.Parent
End While
Return If(fieldNode?.Kind() = VisualBasic.SyntaxKind.FieldDeclaration, fieldNode, Nothing)
Return If(fieldNode?.Kind() = SyntaxKind.FieldDeclaration, fieldNode, Nothing)
End Function
End Class
End Namespace

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.22725.0
VisualStudioVersion = 14.0.22905.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeAnalysisTest", "Compilers\Core\CodeAnalysisTest\CodeAnalysisTest.csproj", "{A4C99B85-765C-4C65-9C2A-BB609AAB09E6}"
EndProject
......@@ -91,16 +91,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Roslyn", "Roslyn", "{4A9CCE
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FxCop", "FxCop", "{24E8CBFA-38D2-486F-B772-C10AB2DC7F01}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FxCopRulesDiagnosticAnalyzers", "Diagnostics\FxCop\Core\FxCopRulesDiagnosticAnalyzers.csproj", "{36755424-5267-478C-9434-37A507E22711}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpFxCopRulesDiagnosticAnalyzers", "Diagnostics\FxCop\CSharp\CSharpFxCopRulesDiagnosticAnalyzers.csproj", "{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FxCopRulesSetup", "Diagnostics\FxCop\Setup\FxCopRulesSetup.csproj", "{A5844BB9-7B62-475B-AC61-298E5A23EFFE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FxCopRulesDiagnosticAnalyzersTest", "Diagnostics\FxCop\Test\FxCopRulesDiagnosticAnalyzersTest.csproj", "{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "BasicFxCopRulesDiagnosticAnalyzers", "Diagnostics\FxCop\VisualBasic\BasicFxCopRulesDiagnosticAnalyzers.vbproj", "{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RoslynDiagnosticAnalyzers", "Diagnostics\Roslyn\Core\RoslynDiagnosticAnalyzers.csproj", "{DCC1F13B-F51C-445B-BDAE-92135BD58364}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpRoslynDiagnosticAnalyzers", "Diagnostics\Roslyn\CSharp\CSharpRoslynDiagnosticAnalyzers.csproj", "{B82F1C54-2D3E-497B-8C31-4AB16D6508FA}"
......@@ -331,6 +321,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpSystemRuntimeInteropS
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "BasicSystemRuntimeInteropServicesAnalyzers", "Diagnostics\FxCop\System.Runtime.InteropServices.Analyzers\VisualBasic\BasicSystemRuntimeInteropServicesAnalyzers.vbproj", "{EDE9E796-E0A4-42E9-8B82-97B664B9343E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnalyzerPowerPack.Common", "Diagnostics\FxCop\Core\AnalyzerPowerPack.Common.csproj", "{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnalyzerPowerPack.CSharp", "Diagnostics\FxCop\CSharp\AnalyzerPowerPack.CSharp.csproj", "{D212BF08-95D5-4664-AD47-AF9BFE7C48D0}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "AnalyzerPowerPack.VisualBasic", "Diagnostics\FxCop\VisualBasic\AnalyzerPowerPack.VisualBasic.vbproj", "{45854FF7-A6D5-4B28-87A1-0B75390125C0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnalyzerPowerPack.Setup", "Diagnostics\FxCop\Setup\AnalyzerPowerPack.Setup.csproj", "{FFCA21B9-C7CB-4F0F-851B-947EE25C416C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnalyzerPowerPack.Test", "Diagnostics\FxCop\Test\AnalyzerPowerPack.Test.csproj", "{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{edc68a0e-c68d-4a74-91b7-bf38ec909888}*SharedItemsImports = 4
......@@ -846,86 +846,6 @@ Global
{6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Release|x64.ActiveCfg = Release|Any CPU
{6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Release|x64.Build.0 = Release|Any CPU
{36755424-5267-478C-9434-37A507E22711}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{36755424-5267-478C-9434-37A507E22711}.Debug|Any CPU.Build.0 = Debug|Any CPU
{36755424-5267-478C-9434-37A507E22711}.Debug|ARM.ActiveCfg = Debug|Any CPU
{36755424-5267-478C-9434-37A507E22711}.Debug|ARM.Build.0 = Debug|Any CPU
{36755424-5267-478C-9434-37A507E22711}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{36755424-5267-478C-9434-37A507E22711}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{36755424-5267-478C-9434-37A507E22711}.Debug|x64.ActiveCfg = Debug|Any CPU
{36755424-5267-478C-9434-37A507E22711}.Debug|x64.Build.0 = Debug|Any CPU
{36755424-5267-478C-9434-37A507E22711}.Release|Any CPU.ActiveCfg = Release|Any CPU
{36755424-5267-478C-9434-37A507E22711}.Release|Any CPU.Build.0 = Release|Any CPU
{36755424-5267-478C-9434-37A507E22711}.Release|ARM.ActiveCfg = Release|Any CPU
{36755424-5267-478C-9434-37A507E22711}.Release|ARM.Build.0 = Release|Any CPU
{36755424-5267-478C-9434-37A507E22711}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{36755424-5267-478C-9434-37A507E22711}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{36755424-5267-478C-9434-37A507E22711}.Release|x64.ActiveCfg = Release|Any CPU
{36755424-5267-478C-9434-37A507E22711}.Release|x64.Build.0 = Release|Any CPU
{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}.Debug|ARM.ActiveCfg = Debug|Any CPU
{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}.Debug|ARM.Build.0 = Debug|Any CPU
{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}.Debug|x64.ActiveCfg = Debug|Any CPU
{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}.Debug|x64.Build.0 = Debug|Any CPU
{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}.Release|Any CPU.Build.0 = Release|Any CPU
{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}.Release|ARM.ActiveCfg = Release|Any CPU
{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}.Release|ARM.Build.0 = Release|Any CPU
{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}.Release|x64.ActiveCfg = Release|Any CPU
{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}.Release|x64.Build.0 = Release|Any CPU
{A5844BB9-7B62-475B-AC61-298E5A23EFFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A5844BB9-7B62-475B-AC61-298E5A23EFFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5844BB9-7B62-475B-AC61-298E5A23EFFE}.Debug|ARM.ActiveCfg = Debug|Any CPU
{A5844BB9-7B62-475B-AC61-298E5A23EFFE}.Debug|ARM.Build.0 = Debug|Any CPU
{A5844BB9-7B62-475B-AC61-298E5A23EFFE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{A5844BB9-7B62-475B-AC61-298E5A23EFFE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{A5844BB9-7B62-475B-AC61-298E5A23EFFE}.Debug|x64.ActiveCfg = Debug|Any CPU
{A5844BB9-7B62-475B-AC61-298E5A23EFFE}.Debug|x64.Build.0 = Debug|Any CPU
{A5844BB9-7B62-475B-AC61-298E5A23EFFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5844BB9-7B62-475B-AC61-298E5A23EFFE}.Release|Any CPU.Build.0 = Release|Any CPU
{A5844BB9-7B62-475B-AC61-298E5A23EFFE}.Release|ARM.ActiveCfg = Release|Any CPU
{A5844BB9-7B62-475B-AC61-298E5A23EFFE}.Release|ARM.Build.0 = Release|Any CPU
{A5844BB9-7B62-475B-AC61-298E5A23EFFE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{A5844BB9-7B62-475B-AC61-298E5A23EFFE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{A5844BB9-7B62-475B-AC61-298E5A23EFFE}.Release|x64.ActiveCfg = Release|Any CPU
{A5844BB9-7B62-475B-AC61-298E5A23EFFE}.Release|x64.Build.0 = Release|Any CPU
{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17}.Debug|ARM.ActiveCfg = Debug|Any CPU
{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17}.Debug|ARM.Build.0 = Debug|Any CPU
{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17}.Debug|x64.ActiveCfg = Debug|Any CPU
{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17}.Debug|x64.Build.0 = Debug|Any CPU
{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17}.Release|Any CPU.Build.0 = Release|Any CPU
{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17}.Release|ARM.ActiveCfg = Release|Any CPU
{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17}.Release|ARM.Build.0 = Release|Any CPU
{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17}.Release|x64.ActiveCfg = Release|Any CPU
{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17}.Release|x64.Build.0 = Release|Any CPU
{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}.Debug|ARM.ActiveCfg = Debug|Any CPU
{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}.Debug|ARM.Build.0 = Debug|Any CPU
{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}.Debug|x64.ActiveCfg = Debug|Any CPU
{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}.Debug|x64.Build.0 = Debug|Any CPU
{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}.Release|Any CPU.Build.0 = Release|Any CPU
{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}.Release|ARM.ActiveCfg = Release|Any CPU
{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}.Release|ARM.Build.0 = Release|Any CPU
{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}.Release|x64.ActiveCfg = Release|Any CPU
{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}.Release|x64.Build.0 = Release|Any CPU
{DCC1F13B-F51C-445B-BDAE-92135BD58364}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DCC1F13B-F51C-445B-BDAE-92135BD58364}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DCC1F13B-F51C-445B-BDAE-92135BD58364}.Debug|ARM.ActiveCfg = Debug|Any CPU
......@@ -2412,6 +2332,86 @@ Global
{EDE9E796-E0A4-42E9-8B82-97B664B9343E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{EDE9E796-E0A4-42E9-8B82-97B664B9343E}.Release|x64.ActiveCfg = Release|Any CPU
{EDE9E796-E0A4-42E9-8B82-97B664B9343E}.Release|x64.Build.0 = Release|Any CPU
{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB}.Debug|ARM.ActiveCfg = Debug|Any CPU
{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB}.Debug|ARM.Build.0 = Debug|Any CPU
{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB}.Debug|x64.ActiveCfg = Debug|Any CPU
{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB}.Debug|x64.Build.0 = Debug|Any CPU
{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB}.Release|Any CPU.Build.0 = Release|Any CPU
{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB}.Release|ARM.ActiveCfg = Release|Any CPU
{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB}.Release|ARM.Build.0 = Release|Any CPU
{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB}.Release|x64.ActiveCfg = Release|Any CPU
{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB}.Release|x64.Build.0 = Release|Any CPU
{D212BF08-95D5-4664-AD47-AF9BFE7C48D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D212BF08-95D5-4664-AD47-AF9BFE7C48D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D212BF08-95D5-4664-AD47-AF9BFE7C48D0}.Debug|ARM.ActiveCfg = Debug|Any CPU
{D212BF08-95D5-4664-AD47-AF9BFE7C48D0}.Debug|ARM.Build.0 = Debug|Any CPU
{D212BF08-95D5-4664-AD47-AF9BFE7C48D0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D212BF08-95D5-4664-AD47-AF9BFE7C48D0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D212BF08-95D5-4664-AD47-AF9BFE7C48D0}.Debug|x64.ActiveCfg = Debug|Any CPU
{D212BF08-95D5-4664-AD47-AF9BFE7C48D0}.Debug|x64.Build.0 = Debug|Any CPU
{D212BF08-95D5-4664-AD47-AF9BFE7C48D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D212BF08-95D5-4664-AD47-AF9BFE7C48D0}.Release|Any CPU.Build.0 = Release|Any CPU
{D212BF08-95D5-4664-AD47-AF9BFE7C48D0}.Release|ARM.ActiveCfg = Release|Any CPU
{D212BF08-95D5-4664-AD47-AF9BFE7C48D0}.Release|ARM.Build.0 = Release|Any CPU
{D212BF08-95D5-4664-AD47-AF9BFE7C48D0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D212BF08-95D5-4664-AD47-AF9BFE7C48D0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D212BF08-95D5-4664-AD47-AF9BFE7C48D0}.Release|x64.ActiveCfg = Release|Any CPU
{D212BF08-95D5-4664-AD47-AF9BFE7C48D0}.Release|x64.Build.0 = Release|Any CPU
{45854FF7-A6D5-4B28-87A1-0B75390125C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{45854FF7-A6D5-4B28-87A1-0B75390125C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45854FF7-A6D5-4B28-87A1-0B75390125C0}.Debug|ARM.ActiveCfg = Debug|Any CPU
{45854FF7-A6D5-4B28-87A1-0B75390125C0}.Debug|ARM.Build.0 = Debug|Any CPU
{45854FF7-A6D5-4B28-87A1-0B75390125C0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{45854FF7-A6D5-4B28-87A1-0B75390125C0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{45854FF7-A6D5-4B28-87A1-0B75390125C0}.Debug|x64.ActiveCfg = Debug|Any CPU
{45854FF7-A6D5-4B28-87A1-0B75390125C0}.Debug|x64.Build.0 = Debug|Any CPU
{45854FF7-A6D5-4B28-87A1-0B75390125C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{45854FF7-A6D5-4B28-87A1-0B75390125C0}.Release|Any CPU.Build.0 = Release|Any CPU
{45854FF7-A6D5-4B28-87A1-0B75390125C0}.Release|ARM.ActiveCfg = Release|Any CPU
{45854FF7-A6D5-4B28-87A1-0B75390125C0}.Release|ARM.Build.0 = Release|Any CPU
{45854FF7-A6D5-4B28-87A1-0B75390125C0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{45854FF7-A6D5-4B28-87A1-0B75390125C0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{45854FF7-A6D5-4B28-87A1-0B75390125C0}.Release|x64.ActiveCfg = Release|Any CPU
{45854FF7-A6D5-4B28-87A1-0B75390125C0}.Release|x64.Build.0 = Release|Any CPU
{FFCA21B9-C7CB-4F0F-851B-947EE25C416C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FFCA21B9-C7CB-4F0F-851B-947EE25C416C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FFCA21B9-C7CB-4F0F-851B-947EE25C416C}.Debug|ARM.ActiveCfg = Debug|Any CPU
{FFCA21B9-C7CB-4F0F-851B-947EE25C416C}.Debug|ARM.Build.0 = Debug|Any CPU
{FFCA21B9-C7CB-4F0F-851B-947EE25C416C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{FFCA21B9-C7CB-4F0F-851B-947EE25C416C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{FFCA21B9-C7CB-4F0F-851B-947EE25C416C}.Debug|x64.ActiveCfg = Debug|Any CPU
{FFCA21B9-C7CB-4F0F-851B-947EE25C416C}.Debug|x64.Build.0 = Debug|Any CPU
{FFCA21B9-C7CB-4F0F-851B-947EE25C416C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FFCA21B9-C7CB-4F0F-851B-947EE25C416C}.Release|Any CPU.Build.0 = Release|Any CPU
{FFCA21B9-C7CB-4F0F-851B-947EE25C416C}.Release|ARM.ActiveCfg = Release|Any CPU
{FFCA21B9-C7CB-4F0F-851B-947EE25C416C}.Release|ARM.Build.0 = Release|Any CPU
{FFCA21B9-C7CB-4F0F-851B-947EE25C416C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{FFCA21B9-C7CB-4F0F-851B-947EE25C416C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{FFCA21B9-C7CB-4F0F-851B-947EE25C416C}.Release|x64.ActiveCfg = Release|Any CPU
{FFCA21B9-C7CB-4F0F-851B-947EE25C416C}.Release|x64.Build.0 = Release|Any CPU
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Debug|ARM.ActiveCfg = Debug|Any CPU
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Debug|ARM.Build.0 = Debug|Any CPU
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Debug|x64.ActiveCfg = Debug|Any CPU
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Debug|x64.Build.0 = Debug|Any CPU
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Release|Any CPU.Build.0 = Release|Any CPU
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Release|ARM.ActiveCfg = Release|Any CPU
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Release|ARM.Build.0 = Release|Any CPU
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Release|x64.ActiveCfg = Release|Any CPU
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -2453,11 +2453,6 @@ Global
{6AA96934-D6B7-4CC8-990D-DB6B9DD56E34} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC}
{4A9CCE88-E499-4FFB-9BB8-60E782CD5ACA} = {5F5DD61A-746D-40AE-A89C-EF82B39C036E}
{24E8CBFA-38D2-486F-B772-C10AB2DC7F01} = {5F5DD61A-746D-40AE-A89C-EF82B39C036E}
{36755424-5267-478C-9434-37A507E22711} = {24E8CBFA-38D2-486F-B772-C10AB2DC7F01}
{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0} = {24E8CBFA-38D2-486F-B772-C10AB2DC7F01}
{A5844BB9-7B62-475B-AC61-298E5A23EFFE} = {24E8CBFA-38D2-486F-B772-C10AB2DC7F01}
{B0F9E8F5-0411-47E3-8019-23CD3F1E5A17} = {24E8CBFA-38D2-486F-B772-C10AB2DC7F01}
{2FCCB9BE-DD4E-48F2-B678-80E6FB196948} = {24E8CBFA-38D2-486F-B772-C10AB2DC7F01}
{DCC1F13B-F51C-445B-BDAE-92135BD58364} = {4A9CCE88-E499-4FFB-9BB8-60E782CD5ACA}
{B82F1C54-2D3E-497B-8C31-4AB16D6508FA} = {4A9CCE88-E499-4FFB-9BB8-60E782CD5ACA}
{BBDC84C8-AE58-4D0F-B5A4-384CDCB9069E} = {4A9CCE88-E499-4FFB-9BB8-60E782CD5ACA}
......@@ -2566,5 +2561,10 @@ Global
{94A18486-A90F-4E7A-AD1C-EFF26B5CE115} = {32BCFD38-B44B-4E4F-AFC6-90ABAF32C465}
{A634B792-8504-4A2D-9149-4C9E4959F11C} = {32BCFD38-B44B-4E4F-AFC6-90ABAF32C465}
{EDE9E796-E0A4-42E9-8B82-97B664B9343E} = {32BCFD38-B44B-4E4F-AFC6-90ABAF32C465}
{CBCD620C-FF07-4BA4-ABC9-2F23C73760DB} = {24E8CBFA-38D2-486F-B772-C10AB2DC7F01}
{D212BF08-95D5-4664-AD47-AF9BFE7C48D0} = {24E8CBFA-38D2-486F-B772-C10AB2DC7F01}
{45854FF7-A6D5-4B28-87A1-0B75390125C0} = {24E8CBFA-38D2-486F-B772-C10AB2DC7F01}
{FFCA21B9-C7CB-4F0F-851B-947EE25C416C} = {24E8CBFA-38D2-486F-B772-C10AB2DC7F01}
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F} = {24E8CBFA-38D2-486F-B772-C10AB2DC7F01}
EndGlobalSection
EndGlobal
此差异已折叠。
......@@ -122,21 +122,21 @@
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup%3bBuiltProjectOutputGroupDependencies%3bGetCopyToOutputDirectoryItems%3bSatelliteDllsProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIXLocalOnly>DebugSymbolsProjectOutputGroup%3b</IncludeOutputGroupsInVSIXLocalOnly>
</ProjectReference>
<ProjectReference Include="..\..\..\Diagnostics\FxCop\Core\FxCopRulesDiagnosticAnalyzers.csproj">
<Project>{36755424-5267-478C-9434-37A507E22711}</Project>
<Name>FxCopRulesDiagnosticAnalyzers</Name>
<ProjectReference Include="..\..\..\Diagnostics\FxCop\Core\AnalyzerPowerPack.Common.csproj">
<Project>{cbcd620c-ff07-4ba4-abc9-2f23c73760db}</Project>
<Name>AnalyzerPowerPack.Common</Name>
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup%3bBuiltProjectOutputGroupDependencies%3bGetCopyToOutputDirectoryItems%3bSatelliteDllsProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIXLocalOnly>DebugSymbolsProjectOutputGroup%3b</IncludeOutputGroupsInVSIXLocalOnly>
</ProjectReference>
<ProjectReference Include="..\..\..\Diagnostics\FxCop\CSharp\CSharpFxCopRulesDiagnosticAnalyzers.csproj">
<Project>{3BA13187-2A3B-4B08-9199-C11FDA1D5AD0}</Project>
<Name>CSharpFxCopRulesDiagnosticAnalyzers</Name>
<ProjectReference Include="..\..\..\Diagnostics\FxCop\CSharp\AnalyzerPowerPack.CSharp.csproj">
<Project>{d212bf08-95d5-4664-ad47-af9bfe7c48d0}</Project>
<Name>AnalyzerPowerPack.CSharp</Name>
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup%3bBuiltProjectOutputGroupDependencies%3bGetCopyToOutputDirectoryItems%3bSatelliteDllsProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIXLocalOnly>DebugSymbolsProjectOutputGroup%3b</IncludeOutputGroupsInVSIXLocalOnly>
</ProjectReference>
<ProjectReference Include="..\..\..\Diagnostics\FxCop\VisualBasic\BasicFxCopRulesDiagnosticAnalyzers.vbproj">
<Project>{2FCCB9BE-DD4E-48F2-B678-80E6FB196948}</Project>
<Name>BasicFxCopRulesDiagnosticAnalyzers</Name>
<ProjectReference Include="..\..\..\Diagnostics\FxCop\VisualBasic\AnalyzerPowerPack.VisualBasic.vbproj">
<Project>{45854ff7-a6d5-4b28-87a1-0b75390125c0}</Project>
<Name>AnalyzerPowerPack.VisualBasic</Name>
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup%3bBuiltProjectOutputGroupDependencies%3bGetCopyToOutputDirectoryItems%3bSatelliteDllsProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIXLocalOnly>DebugSymbolsProjectOutputGroup%3b</IncludeOutputGroupsInVSIXLocalOnly>
</ProjectReference>
......@@ -186,4 +186,4 @@
<Import Project="..\..\..\..\build\VSL.Imports.Closed.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</ImportGroup>
</Project>
</Project>
\ No newline at end of file
......@@ -18,12 +18,12 @@
<Asset Type="Microsoft.VisualStudio.VsPackage" Path="enableopensource.pkgdef" d:Source="File" />
<Asset Type="Microsoft.VisualStudio.VsPackage" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" d:Source="Project" d:ProjectName="%CurrentProject%" />
<Asset Type="Microsoft.VisualStudio.Assembly" Path="|CSharpCodeAnalysis|" AssemblyName="Microsoft.CodeAnalysis.CSharp, Version=0.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" d:Source="Project" d:ProjectName="CSharpCodeAnalysis" />
<Asset Type="Microsoft.VisualStudio.Assembly" Path="|CSharpFxCopRulesDiagnosticAnalyzers|" AssemblyName="Microsoft.CodeAnalysis.CSharp.FxCopAnalyzers, Version=0.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" d:Source="Project" d:ProjectName="CSharpFxCopRulesDiagnosticAnalyzers" />
<Asset Type="Microsoft.VisualStudio.Assembly" Path="|AnalyzerPowerPack.CSharp|" AssemblyName="Microsoft.AnalyzerPowerPack.CSharp, Version=0.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" d:Source="Project" d:ProjectName="AnalyzerPowerPack.CSharp" />
<Asset Type="Microsoft.VisualStudio.Assembly" Path="|CSharpWorkspace|" AssemblyName="Microsoft.CodeAnalysis.CSharp.Workspaces, Version=0.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" d:Source="Project" d:ProjectName="CSharpWorkspace" />
<Asset Type="Microsoft.VisualStudio.Assembly" Path="|CodeAnalysis|" AssemblyName="Microsoft.CodeAnalysis, Version=0.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" d:Source="Project" d:ProjectName="CodeAnalysis" />
<Asset Type="Microsoft.VisualStudio.Assembly" Path="|FxCopRulesDiagnosticAnalyzers|" AssemblyName="Microsoft.CodeAnalysis.FxCopAnalyzers, Version=0.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" d:Source="Project" d:ProjectName="FxCopRulesDiagnosticAnalyzers" />
<Asset Type="Microsoft.VisualStudio.Assembly" Path="|AnalyzerPowerPack.Common|" AssemblyName="Microsoft.AnalyzerPowerPack.Common, Version=0.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" d:Source="Project" d:ProjectName="AnalyzerPowerPack.Common" />
<Asset Type="Microsoft.VisualStudio.Assembly" Path="|BasicCodeAnalysis|" AssemblyName="Microsoft.CodeAnalysis.VisualBasic, Version=0.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" d:Source="Project" d:ProjectName="BasicCodeAnalysis" />
<Asset Type="Microsoft.VisualStudio.Assembly" Path="|BasicFxCopRulesDiagnosticAnalyzers|" AssemblyName="Microsoft.CodeAnalysis.VisualBasic.FxCopAnalyzers, Version=0.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" d:Source="Project" d:ProjectName="BasicFxCopRulesDiagnosticAnalyzers" />
<Asset Type="Microsoft.VisualStudio.Assembly" Path="|AnalyzerPowerPack.VisualBasic|" AssemblyName="Microsoft.AnalyzerPowerPack.VisualBasic, Version=0.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" d:Source="Project" d:ProjectName="AnalyzerPowerPack.VisualBasic" />
<Asset Type="Microsoft.VisualStudio.Assembly" Path="|BasicWorkspace|" AssemblyName="Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=0.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" d:Source="Project" d:ProjectName="BasicWorkspace" />
<Asset Type="Microsoft.VisualStudio.Assembly" Path="|Workspaces|" AssemblyName="Microsoft.CodeAnalysis.Workspaces, Version=0.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" d:Source="Project" d:ProjectName="Workspaces" />
<Asset Type="Microsoft.VisualStudio.Assembly" Path="|SyntaxVisualizerDgmlHelper|" AssemblyName="Roslyn.SyntaxVisualizer.DgmlHelper, Version=0.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" d:Source="Project" d:ProjectName="SyntaxVisualizerDgmlHelper" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册