Add analyzer action for reporting diagnostics in additional files#45076
Merged
16 commits merged intodotnet:masterfrom Jul 15, 2020
Merged
Add analyzer action for reporting diagnostics in additional files#4507616 commits merged intodotnet:masterfrom
16 commits merged intodotnet:masterfrom
Conversation
Contributor
Author
|
@dotnet/roslyn-compiler Ping for reviews. |
Addresses dotnet#44131 The added analyzer APIs are similar to the existing APIs for syntax tree callback. This commit adds the compiler APIs + tests Future enhancement: Add analyzer action for reporting diagnostics in analyzer config files
09f2fb4 to
d2d197f
Compare
Contributor
Author
|
Ping @dotnet/roslyn-compiler for reviews |
Contributor
Author
|
Ping @dotnet/roslyn-compiler @dotnet/roslyn-ide for reviews. |
jaredpar
reviewed
Jul 10, 2020
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisContextInfo.cs
Outdated
Show resolved
Hide resolved
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisContextInfo.cs
Outdated
Show resolved
Hide resolved
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisResultBuilder.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisScope.cs
Outdated
Show resolved
Hide resolved
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisScope.cs
Outdated
Show resolved
Hide resolved
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisScope.cs
Outdated
Show resolved
Hide resolved
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisScope.cs
Outdated
Show resolved
Hide resolved
cston
reviewed
Jul 10, 2020
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisContextInfo.cs
Outdated
Show resolved
Hide resolved
cston
reviewed
Jul 10, 2020
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisResult.cs
Outdated
Show resolved
Hide resolved
cston
reviewed
Jul 10, 2020
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisResultBuilder.cs
Outdated
Show resolved
Hide resolved
cston
reviewed
Jul 10, 2020
cston
approved these changes
Jul 11, 2020
Contributor
Author
jmarolf
reviewed
Jul 13, 2020
jmarolf
reviewed
Jul 13, 2020
src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.NormalPriorityProcessor.cs
Outdated
Show resolved
Hide resolved
jmarolf
reviewed
Jul 13, 2020
src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.NormalPriorityProcessor.cs
Outdated
Show resolved
Hide resolved
jmarolf
reviewed
Jul 13, 2020
src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.NormalPriorityProcessor.cs
Outdated
Show resolved
Hide resolved
jmarolf
reviewed
Jul 13, 2020
src/Features/Core/Portable/SolutionCrawler/AggregateIncrementalAnalyzer.cs
Outdated
Show resolved
Hide resolved
jmarolf
reviewed
Jul 13, 2020
src/Features/Core/Portable/SolutionCrawler/AggregateIncrementalAnalyzer.cs
Outdated
Show resolved
Hide resolved
jmarolf
reviewed
Jul 13, 2020
src/Features/Core/Portable/SolutionCrawler/AggregateIncrementalAnalyzer.cs
Outdated
Show resolved
Hide resolved
jmarolf
reviewed
Jul 13, 2020
src/Features/Core/Portable/SolutionCrawler/AggregateIncrementalAnalyzer.cs
Outdated
Show resolved
Hide resolved
jmarolf
reviewed
Jul 13, 2020
jmarolf
reviewed
Jul 13, 2020
jmarolf
approved these changes
Jul 13, 2020
jaredpar
approved these changes
Jul 15, 2020
Contributor
Author
|
Thank you everyone! |
jasonmalinowski
added a commit
to jasonmalinowski/roslyn
that referenced
this pull request
Aug 7, 2020
For reasons that aren't entirely clear, when we create a preview of a code fix, we remove and re-add documents that are being changed when we produce the PreviewWorkspace. This process had an bug which meant that the file path of an .editorconfig got dropped, so the resultant .editorconfig document path was null. This later caused a crash if the diagnostic engine, when processing the PreviewWorkspace's new solution, tried asking for a Compilation, since the null path would get passed to AnalyzerConfig.Parse(), and it would throw. This was exposed by dotnet#45076; until then if you had a preview of just an .editorconfig file, nothing would actually be analyzed and so nothing asked for the Compilation. The crash is "fixed" by dotnet#44331 in that asking for a Compilation no longer results in a call to AnalyzerConfig.Parse(); you have to ask for a Compilation and then do something with a semantic model. By luck, that doesn't happen in the common repro, but more obscure things absolutely could still fail. This is being tested by the integration test being added in dotnet#46639. We don't really have a good unit tests here as far as I can tell, but even then a unit test really doesn't validate any of the end-to-end here. Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1162464
mavasani
added a commit
to mavasani/roslyn
that referenced
this pull request
Sep 22, 2022
Closes dotnet#44131 dotnet#45076 added support for reporting analyzer diagnostics in additional files. This PR addresses pending work from dotnet#44131 (comment) by adding similar support for editorconfig/globalconfig files in the project. There are two primary public API additions
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #44131
The added analyzer APIs are similar to the existing APIs for syntax tree callback.
I have split the changes into separate commits for compiler and IDE changes for easier review.
Compiler changes in 450cf6a: Adds analyzer API + driver implementation + tests.
IDE changes in d2d197f: IDE support for analyzing and reporting diagnostics in non-source files
Future enhancement: Add analyzer action for reporting diagnostics in analyzer config files.