New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run naming style analyzer #720
Conversation
// If you have changed target frameworks, make sure to update the program path. | ||
"program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/netcoreapp2.1/publish/dotnet-format.dll", | ||
"program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/netcoreapp2.1/dotnet-format.dll", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the dotnet-format project to copy package assemblies into build folder. This is needed for finding the Feature assemblies.
@@ -165,5 +173,42 @@ static void LogDiagnosticLocations(Solution solution, IEnumerable<Diagnostic> di | |||
|
|||
return solution; | |||
} | |||
|
|||
internal static async Task<ImmutableDictionary<Project, ImmutableArray<DiagnosticAnalyzer>>> FilterBySeverityAsync( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved from the AnalyzerFinderHelpers.
@@ -47,7 +49,7 @@ internal partial class AnalyzerRunner : IAnalyzerRunner | |||
foreach (var diagnostic in diagnostics) | |||
{ | |||
if (!diagnostic.IsSuppressed && | |||
diagnostic.Severity >= DiagnosticSeverity.Warning && | |||
diagnostic.Severity >= severity && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to filter on the correct severity.
{ | ||
private static readonly string s_executingPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); | ||
|
||
private readonly string _featuresPath = Path.Combine(s_executingPath, "Microsoft.CodeAnalysis.Features.dll"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some analyzers and fixers are language agnostic.
@@ -13,6 +13,9 @@ | |||
<NoWarn>$(NoWarn);8002</NoWarn> | |||
<Description>Command line tool for formatting C# and Visual Basic code files based on .editorconfig settings.</Description> | |||
|
|||
<!-- Copy nuget assemblies to build directory. --> | |||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes running debug builds easier.
@@ -44,7 +44,7 @@ public async Task TestFilterError() | |||
var allAnalyzers = await GetAnalyzersAsync(); | |||
var formattablePaths = ImmutableHashSet.Create(projects.First().Documents.First().FilePath); | |||
var minimumSeverity = DiagnosticSeverity.Error; | |||
var result = await AnalyzerFinderHelpers.FilterBySeverityAsync(projects, | |||
var result = await AnalyzerFormatter.FilterBySeverityAsync(projects, | |||
allAnalyzers, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alight with line above
@@ -28,7 +28,7 @@ public async Task TestFilterWarning() | |||
var allAnalyzers = await GetAnalyzersAsync(); | |||
var formattablePaths = ImmutableHashSet.Create(projects.First().Documents.First().FilePath); | |||
var minimumSeverity = DiagnosticSeverity.Warning; | |||
var result = await AnalyzerFinderHelpers.FilterBySeverityAsync(projects, | |||
var result = await AnalyzerFormatter.FilterBySeverityAsync(projects, | |||
allAnalyzers, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alight with line above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.