Skip to content
This repository has been archived by the owner. It is now read-only.

Fix build warnings #358

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace RefactoringEssentials.CSharp.CodeRefactorings
{
/// <summary>
/// Introduce format item. Works on strings that contain selections.
/// "this is <some> string" => string.Format ("this is {0} string", <some>)
/// "this is &lt;some> string" => string.Format ("this is {0} string", &lt;some>)
/// </summary>

[ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = "Introduce format item")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

namespace RefactoringEssentials.CSharp.CodeRefactorings
{
[ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = "Add a Contract to specify the return value must not be null")]
/// <summary>
/// Creates a 'Contract.Ensures(return != null);' contract for a method return value.
/// </summary>
[ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = "Add a Contract to specify the return value must not be null")]
public class ContractEnsuresNotNullReturnCodeRefactoringProvider : CodeContractsCodeRefactoringProvider
{
#region ICodeActionProvider implementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

namespace RefactoringEssentials.CSharp.CodeRefactorings
{
[ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = "Add a Contract to specify the parameter must not be null")]
/// <summary>
/// Creates a 'Contract.Requires(param != null);' contract for a parameter.
/// </summary>
[ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = "Add a Contract to specify the parameter must not be null")]
public class ContractRequiresNotNullCodeRefactoringProvider : CodeContractsCodeRefactoringProvider
{
#region ICodeActionProvider implementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

namespace RefactoringEssentials.CSharp.CodeRefactorings
{
[ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = "Convert '==' to 'object.Equals()'")]
/// <summary>
/// Convert do...while to while. For instance, { do x++; while (Foo(x)); } becomes { while(Foo(x)) x++; }.
/// Note that this action will often change the semantics of the code.
/// </summary>
[ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = "Convert '==' to 'object.Equals()'")]
public class ConvertEqualityOperatorToEqualsCodeRefactoringProvider : CodeRefactoringProvider
{
public override async Task ComputeRefactoringsAsync(CodeRefactoringContext context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

namespace RefactoringEssentials.CSharp.CodeRefactorings
{
[ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = "Change access level")]
/// <summary>
/// Changes the access level of an entity declaration
/// </summary>
[ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = "Change access level")]
public class ChangeAccessModifierAction : CodeRefactoringProvider
{
public override async Task ComputeRefactoringsAsync(CodeRefactoringContext context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public IEnumerable<CodeAction> GetActions(Document document, SemanticModel model
if (lambdaSymbol == null)
yield break;

bool noReturn = false;
BlockSyntax body;
if (lambdaExpression.Body is BlockSyntax)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
namespace RefactoringEssentials.CSharp.Diagnostics.Custom
{
[DiagnosticAnalyzer(LanguageNames.CSharp)]
/// <summary>
///
/// </summary>
public class AvoidAsyncVoidAnalyzer : DiagnosticAnalyzer
{
static readonly DiagnosticDescriptor descriptor = new DiagnosticDescriptor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

namespace RefactoringEssentials.CSharp.Diagnostics
{
[DiagnosticAnalyzer(LanguageNames.CSharp)]
/// <summary>
/// Finds redundant internal modifiers.
/// </summary>
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class RedundantInternalAnalyzer : DiagnosticAnalyzer
{
static readonly DiagnosticDescriptor descriptor = new DiagnosticDescriptor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

namespace RefactoringEssentials.CSharp.Diagnostics
{
[DiagnosticAnalyzer(LanguageNames.CSharp)]
/// <summary>
/// Finds redundant internal modifiers.
/// </summary>
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class RedundantPrivateAnalyzer : DiagnosticAnalyzer
{
static readonly DiagnosticDescriptor descriptor = new DiagnosticDescriptor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ namespace RefactoringEssentials.CSharp
{
// Disabled for now to avoid exceptions in compiler-only case, because this analyzer requires types from Roslyn's Workspaces layer.
//[DiagnosticAnalyzer(LanguageNames.CSharp)]
#pragma warning disable RS1001 // missing DiagnosticAnalyzerAttribute
public class RoslynUsageAnalyzer : DiagnosticAnalyzer
#pragma warning restore RS1001
{
static readonly DiagnosticDescriptor descriptor = new DiagnosticDescriptor(
CSharpDiagnosticIDs.RoslynReflectionUsageAnalyzerID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class NamingRule : IEquatable<NamingRule>

/// <summary>
/// If set, identifiers cannot be suffixed by with any of these values.
/// </summary
/// </summary>
public string[] ForbiddenSuffixes { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
namespace RefactoringEssentials.CSharp.Diagnostics
{
/// <summary>
/// Checks for "a != null ? a : other"<expr>
/// Converts to: "a ?? other"<expr>
/// Checks for "a != null ? a : other"&lt;expr>
/// Converts to: "a ?? other"&lt;expr>
/// </summary>
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class ConvertConditionalTernaryToNullCoalescingAnalyzer : DiagnosticAnalyzer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ static ShouldReplaceResult ShouldReplace(SyntaxNodeAnalysisContext nodeContext,
/// <summary>
/// Determine whether a binary expression with a string expression is suitable for replacement.
/// </summary>
/// <param name="nodeContext">Context for the expressions.</param>
/// <param name="left">A node representing a string expression.</param>
/// <param name="right">A node to be tested.</param>
/// <param name="operatorToken">The operator separating the nodes.</param>
Expand Down Expand Up @@ -334,8 +335,8 @@ static bool IsNullSyntax(SyntaxNodeAnalysisContext nodeContext, ExpressionSyntax
/// <summary>
/// Does the expression look like a test for empty string ("" or string.Empty)?
/// </summary>
/// <param name="nodeContext">Context for the expressions.</param>
/// <param name="node"></param>
/// <returns></returns>
static bool IsEmptySyntax(SyntaxNodeAnalysisContext nodeContext, ExpressionSyntax node)
{
if (!IsStringType(nodeContext, node))
Expand Down
1 change: 1 addition & 0 deletions RefactoringEssentials/RefactoringEssentials.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<FileVersion>5.6.0.0</FileVersion>
<Version>5.6.0</Version>
<PackageId>RefactoringEssentials</PackageId>
<DefaultItemExcludes>$(DefaultItemExcludes);Samples\**\*</DefaultItemExcludes>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;DEBUG;NETSTANDARD1_3;NETSTANDARD1_3</DefineConstants>
Expand Down
5 changes: 3 additions & 2 deletions RefactoringEssentials/Util/ExpressionSyntaxExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Microsoft.CodeAnalysis;
using System.Reflection;
using System.Runtime.ExceptionServices;
using Microsoft.CodeAnalysis.CodeStyle;

namespace RefactoringEssentials
{
Expand Down Expand Up @@ -762,14 +763,14 @@ private static bool PreferPredefinedTypeKeywordInDeclarations(NameSyntax name, O
{
return (name.Parent != null) && !(name.Parent is MemberAccessExpressionSyntax) &&
!InsideCrefReference(name) && !InsideNameOfExpression(name, semanticModel) &&
optionSet.GetOption(SimplificationOptions.PreferIntrinsicPredefinedTypeKeywordInDeclaration, LanguageNames.CSharp);
optionSet.GetOption(CodeStyleOptions.PreferIntrinsicPredefinedTypeKeywordInDeclaration, LanguageNames.CSharp).Value;
}

private static bool PreferPredefinedTypeKeywordInMemberAccess(ExpressionSyntax memberAccess, OptionSet optionSet, SemanticModel semanticModel)
{
return (((memberAccess.Parent != null) && (memberAccess.Parent is MemberAccessExpressionSyntax)) || InsideCrefReference(memberAccess)) &&
!InsideNameOfExpression(memberAccess, semanticModel) &&
optionSet.GetOption(SimplificationOptions.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, LanguageNames.CSharp);
optionSet.GetOption(CodeStyleOptions.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, LanguageNames.CSharp).Value;
}

public static bool IsAliasReplaceableExpression(this ExpressionSyntax expression)
Expand Down
2 changes: 1 addition & 1 deletion RefactoringEssentials/Util/SyntaxTokenExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ public static bool TryParseGenericName(this SyntaxToken genericIdentifier, Cance
/// <param name="genericIdentifier">The "name" of the generic identifier, last token before
/// the "&amp;"</param>
/// <returns>The last token in the name</returns>
/// <remarks>This is related to the code in <see cref="SyntaxTreeExtensions.IsInPartiallyWrittenGeneric(SyntaxTree, int, CancellationToken)"/></remarks>
/// <remarks>This is related to the code in SyntaxTreeExtensions.IsInPartiallyWrittenGeneric(SyntaxTree, int, CancellationToken)</remarks>
public static SyntaxToken FindLastTokenOfPartialGenericName(this SyntaxToken genericIdentifier)
{
//Contract.ThrowIfFalse(genericIdentifier.Kind() == SyntaxKind.IdentifierToken);
Expand Down
2 changes: 2 additions & 0 deletions RefactoringEssentials/Util/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public static ITypeSymbol GetNullableUnderlyingType(this ITypeSymbol type)
/// </summary>
/// <returns>The all base classes.</returns>
/// <param name="type">Type.</param>
/// <param name="includeSuperType">Whether to include the type as well as its base types.</param>
public static IEnumerable<INamedTypeSymbol> GetAllBaseClasses(this INamedTypeSymbol type, bool includeSuperType = false)
{
if (!includeSuperType)
Expand All @@ -126,6 +127,7 @@ public static IEnumerable<INamedTypeSymbol> GetAllBaseClasses(this INamedTypeSym
/// </summary>
/// <returns>All classes and interfaces.</returns>
/// <param name="type">Type.</param>
/// <param name="includeSuperType">Whether to include the type as well as its base types.</param>
public static IEnumerable<INamedTypeSymbol> GetAllBaseClassesAndInterfaces(this INamedTypeSymbol type, bool includeSuperType = false)
{
if (!includeSuperType)
Expand Down
Loading