-
Notifications
You must be signed in to change notification settings - Fork 172
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
Added reflection based discovery of analyzers and fixes #698
Added reflection based discovery of analyzers and fixes #698
Conversation
e4622af
to
e42fb0f
Compare
e42fb0f
to
577fbd1
Compare
From the failed Formatting_Check leg:
|
ffe2fa6
to
b7c20e4
Compare
- script: dotnet run --project ./src/dotnet-format.csproj -- @validate.rsp | ||
- script: dotnet publish ./src/dotnet-format.csproj -c Release | ||
displayName: Publish dotnet-format | ||
- script: dotnet ./artifacts/bin/dotnet-format/Release/netcoreapp2.1/publish/dotnet-format.dll @validate.rsp |
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.
In order to run codestyle analyzers, we need to publish before we run because not all dependencies are copied into the build folder.
{ | ||
var reportFilePath = GetReportFilePath(reportPath!); // IsNullOrEmpty is not annotated on .NET Core 2.1 | ||
var reportFilePath = GetReportFilePath(formatOptions.ReportPath!); // IsNullOrEmpty is not annotated on .NET Core 2.1 |
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.
:(
@@ -29,27 +29,27 @@ internal static class CodeFormatter | |||
new EndOfLineFormatter(), | |||
new CharsetFormatter(), | |||
new ImportsFormatter(), | |||
new AnalyzerFormatter(new RoslynCodeStyleAnalyzerFinder(), new AnalyzerRunner(), new SolutionCodeFixApplier()), | |||
new AnalyzerFormatter("Code Style", new RoslynCodeStyleAnalyzerFinder(), new AnalyzerRunner(), new SolutionCodeFixApplier()), |
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.
Can we add constants for these strings?
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.
Will do in a followup pr. likely want to change how these formatters are instantiated regardless.
So excited for this to be a record in C# 9 |
internal static class AnalyzerFinderHelpers | ||
{ | ||
public static ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> LoadAnalyzersAndFixers( | ||
IEnumerable<Assembly> assemblies, |
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.
Can we add unit tests for this class?
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.
Will add in a follow up
@JoeRobich This all looks fantastic. All I would ask is that you add new perf tests for these scenarios so it will be easier to iterate on improving them. I still need to do the work to get the perf tests to run on CI :( |
No description provided.