From 7ccfc7d208f7f8f2a15947244ac78b637eddde77 Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Sun, 16 Jan 2022 17:30:30 +0100 Subject: [PATCH] Various fixes --- .../UseAnonymousFunctionOrMethodGroupAnalyzer.cs | 3 +-- src/CSharp.Workspaces/CSharp/SyntaxInverter.cs | 2 +- .../Commands/LogicalLinesOfCodeCommand.cs | 10 +++++----- .../Commands/PhysicalLinesOfCodeCommand.cs | 12 ++++++------ .../Testing/CSharp/CSharpTestOptions.cs | 1 + src/Tests/Testing.Common/Testing/TestOptions.cs | 1 + src/Workspaces.Core/Spelling/SpellingAnalyzer.cs | 4 ++-- 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/Analyzers/CSharp/Analysis/UseAnonymousFunctionOrMethodGroupAnalyzer.cs b/src/Analyzers/CSharp/Analysis/UseAnonymousFunctionOrMethodGroupAnalyzer.cs index 3c1bdd321c..12cb74756a 100644 --- a/src/Analyzers/CSharp/Analysis/UseAnonymousFunctionOrMethodGroupAnalyzer.cs +++ b/src/Analyzers/CSharp/Analysis/UseAnonymousFunctionOrMethodGroupAnalyzer.cs @@ -709,7 +709,7 @@ private static void AnalyzeSimpleMemberAccessExpression(SyntaxNodeAnalysisContex ConvertMethodGroupToAnonymousFunctionAnalysis.IsFixable(simpleMemberAccess, context.SemanticModel, context.CancellationToken); } - +#endif private static bool ConvertToAnonymousFunction(SyntaxNodeAnalysisContext context) { return context.PreferAnonymousFunctionOrMethodGroup() == true; @@ -719,7 +719,6 @@ private static bool ConvertToMethodGroup(SyntaxNodeAnalysisContext context) { return context.PreferAnonymousFunctionOrMethodGroup() == false; } -#endif private static void ReportAnonymousFunction(SyntaxNodeAnalysisContext context, AnonymousFunctionExpressionSyntax anonymousMethod) { diff --git a/src/CSharp.Workspaces/CSharp/SyntaxInverter.cs b/src/CSharp.Workspaces/CSharp/SyntaxInverter.cs index 8020b93640..238b06a524 100644 --- a/src/CSharp.Workspaces/CSharp/SyntaxInverter.cs +++ b/src/CSharp.Workspaces/CSharp/SyntaxInverter.cs @@ -11,10 +11,10 @@ namespace Roslynator.CSharp { - [Obsolete("SyntaxInverter is obsolete, use SyntaxLogicalInverter instead.")] /// /// Provides static methods for syntax inversion. /// + [Obsolete("SyntaxInverter is obsolete, use SyntaxLogicalInverter instead.")] public static class SyntaxInverter { /// diff --git a/src/CommandLine/Commands/LogicalLinesOfCodeCommand.cs b/src/CommandLine/Commands/LogicalLinesOfCodeCommand.cs index 556c62a1bf..b71175aad0 100644 --- a/src/CommandLine/Commands/LogicalLinesOfCodeCommand.cs +++ b/src/CommandLine/Commands/LogicalLinesOfCodeCommand.cs @@ -133,11 +133,11 @@ private static void WriteMetrics( Math.Max(totalPreprocessorDirectiveLines.Length, totalLines.Length)))); WriteLine(Verbosity.Minimal); - WriteLine($"{totalCodeLines.PadLeft(maxDigits)} {totalCodeLineCount / (double)totalLineCount,4:P0} logical lines of code", ConsoleColors.Green, Verbosity.Minimal); - WriteLine($"{totalWhitespaceLines.PadLeft(maxDigits)} {totalWhitespaceLineCount / (double)totalLineCount,4:P0} white-space lines", Verbosity.Minimal); - WriteLine($"{totalCommentLines.PadLeft(maxDigits)} {totalCommentLineCount / (double)totalLineCount,4:P0} comment lines", Verbosity.Minimal); - WriteLine($"{totalPreprocessorDirectiveLines.PadLeft(maxDigits)} {totalPreprocessorDirectiveLineCount / (double)totalLineCount,4:P0} preprocessor directive lines", Verbosity.Minimal); - WriteLine($"{totalLines.PadLeft(maxDigits)} {totalLineCount / (double)totalLineCount,4:P0} total lines", Verbosity.Minimal); + WriteLine($"{totalCodeLines.PadLeft(maxDigits)} {totalCodeLineCount / (double)totalLineCount,5:P0} logical lines of code", ConsoleColors.Green, Verbosity.Minimal); + WriteLine($"{totalWhitespaceLines.PadLeft(maxDigits)} {totalWhitespaceLineCount / (double)totalLineCount,5:P0} white-space lines", Verbosity.Minimal); + WriteLine($"{totalCommentLines.PadLeft(maxDigits)} {totalCommentLineCount / (double)totalLineCount,5:P0} comment lines", Verbosity.Minimal); + WriteLine($"{totalPreprocessorDirectiveLines.PadLeft(maxDigits)} {totalPreprocessorDirectiveLineCount / (double)totalLineCount,5:P0} preprocessor directive lines", Verbosity.Minimal); + WriteLine($"{totalLines.PadLeft(maxDigits)} {totalLineCount / (double)totalLineCount,5:P0} total lines", Verbosity.Minimal); } protected override void ProcessResults(IEnumerable results) diff --git a/src/CommandLine/Commands/PhysicalLinesOfCodeCommand.cs b/src/CommandLine/Commands/PhysicalLinesOfCodeCommand.cs index 9ae62b0df4..dff8a651cb 100644 --- a/src/CommandLine/Commands/PhysicalLinesOfCodeCommand.cs +++ b/src/CommandLine/Commands/PhysicalLinesOfCodeCommand.cs @@ -144,7 +144,7 @@ private void WriteMetrics(int totalCodeLineCount, int totalBlockBoundaryLineCoun || !Options.IncludeComments || !Options.IncludePreprocessorDirectives) { - WriteLine($"{totalCodeLines.PadLeft(maxDigits)} {totalCodeLineCount / (double)totalLineCount,4:P0} lines of code", ConsoleColors.Green, Verbosity.Minimal); + WriteLine($"{totalCodeLines.PadLeft(maxDigits)} {totalCodeLineCount / (double)totalLineCount,5:P0} lines of code", ConsoleColors.Green, Verbosity.Minimal); } else { @@ -152,18 +152,18 @@ private void WriteMetrics(int totalCodeLineCount, int totalBlockBoundaryLineCoun } if (Options.IgnoreBlockBoundary) - WriteLine($"{totalBlockBoundaryLines.PadLeft(maxDigits)} {totalBlockBoundaryLineCount / (double)totalLineCount,4:P0} block boundary lines", Verbosity.Minimal); + WriteLine($"{totalBlockBoundaryLines.PadLeft(maxDigits)} {totalBlockBoundaryLineCount / (double)totalLineCount,5:P0} block boundary lines", Verbosity.Minimal); if (!Options.IncludeWhitespace) - WriteLine($"{totalWhitespaceLines.PadLeft(maxDigits)} {totalWhitespaceLineCount / (double)totalLineCount,4:P0} white-space lines", Verbosity.Minimal); + WriteLine($"{totalWhitespaceLines.PadLeft(maxDigits)} {totalWhitespaceLineCount / (double)totalLineCount,5:P0} white-space lines", Verbosity.Minimal); if (!Options.IncludeComments) - WriteLine($"{totalCommentLines.PadLeft(maxDigits)} {totalCommentLineCount / (double)totalLineCount,4:P0} comment lines", Verbosity.Minimal); + WriteLine($"{totalCommentLines.PadLeft(maxDigits)} {totalCommentLineCount / (double)totalLineCount,5:P0} comment lines", Verbosity.Minimal); if (!Options.IncludePreprocessorDirectives) - WriteLine($"{totalPreprocessorDirectiveLines.PadLeft(maxDigits)} {totalPreprocessorDirectiveLineCount / (double)totalLineCount,4:P0} preprocessor directive lines", Verbosity.Minimal); + WriteLine($"{totalPreprocessorDirectiveLines.PadLeft(maxDigits)} {totalPreprocessorDirectiveLineCount / (double)totalLineCount,5:P0} preprocessor directive lines", Verbosity.Minimal); - WriteLine($"{totalLines.PadLeft(maxDigits)} {totalLineCount / (double)totalLineCount,4:P0} total lines", Verbosity.Minimal); + WriteLine($"{totalLines.PadLeft(maxDigits)} {totalLineCount / (double)totalLineCount,5:P0} total lines", Verbosity.Minimal); } protected override void ProcessResults(IEnumerable results) diff --git a/src/Tests/Testing.CSharp/Testing/CSharp/CSharpTestOptions.cs b/src/Tests/Testing.CSharp/Testing/CSharp/CSharpTestOptions.cs index 531a81487e..4d4516fe7f 100644 --- a/src/Tests/Testing.CSharp/Testing/CSharp/CSharpTestOptions.cs +++ b/src/Tests/Testing.CSharp/Testing/CSharp/CSharpTestOptions.cs @@ -24,6 +24,7 @@ public sealed class CSharpTestOptions : TestOptions /// /// /// + /// public CSharpTestOptions( CSharpCompilationOptions compilationOptions = null, CSharpParseOptions parseOptions = null, diff --git a/src/Tests/Testing.Common/Testing/TestOptions.cs b/src/Tests/Testing.Common/Testing/TestOptions.cs index 601c2fcf5b..4ed8e9b4ec 100644 --- a/src/Tests/Testing.Common/Testing/TestOptions.cs +++ b/src/Tests/Testing.Common/Testing/TestOptions.cs @@ -18,6 +18,7 @@ public abstract class TestOptions /// /// /// + /// internal TestOptions( IEnumerable metadataReferences = null, IEnumerable allowedCompilerDiagnosticIds = null, diff --git a/src/Workspaces.Core/Spelling/SpellingAnalyzer.cs b/src/Workspaces.Core/Spelling/SpellingAnalyzer.cs index a5f6f0716d..d564ff69f7 100644 --- a/src/Workspaces.Core/Spelling/SpellingAnalyzer.cs +++ b/src/Workspaces.Core/Spelling/SpellingAnalyzer.cs @@ -15,8 +15,8 @@ internal sealed class SpellingAnalyzer [SuppressMessage("MicrosoftCodeAnalysisReleaseTracking", "RS2008:Enable analyzer release tracking")] public static readonly DiagnosticDescriptor DiagnosticDescriptor = new( id: CommonDiagnosticIdentifiers.PossibleMisspellingOrTypo, - title: "Possible misspelling or typo.", - messageFormat: "Possible misspelling or typo in '{0}'.", + title: "Possible misspelling or typo", + messageFormat: "Possible misspelling or typo in '{0}'", category: "Spelling", defaultSeverity: DiagnosticSeverity.Info, isEnabledByDefault: true,