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
[BuildCheck] Editor config support #9811
base: main
Are you sure you want to change the base?
Conversation
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.
First quick pass. Looks good! :-)
Though I'd love to see my static leftover being turned into mockable interface
I haven't reviewed the copied files though... (hopefully we'll anyways end up consuming a shared version from Roslyn)
src/Build/BuildCop/Infrastructure/EditorConfig/IEditorConfigParser.cs
Outdated
Show resolved
Hide resolved
src/Build/BuildCop/Infrastructure/EditorConfig/EditorConfigParser.cs
Outdated
Show resolved
Hide resolved
…dd Roslyn editorconfig tests for section matcher
…t implementetion.
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.
I added couple additional comments
Can you add to this doc some details about what the exposed interface to this stuff is? That is, what interfaces/whatever MSBuild code will be using to learn about editorconfig-driven configuration? Also, does this PR introduce the patterns that we'll use to map (stuff in the .editorconfig) to (severity for rules), or is that coming later? |
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.
Re-reviewed latest state - looks goot to go for initial version!
src/Build/BuildCheck/Infrastructure/BuildCheckConfigurationException.cs
Outdated
Show resolved
Hide resolved
Added example of the usage (API) and what it returns.
The PR introduced both -> .editorconfig parsing and mapping the configuration to the actual rules |
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.
Apologies for the delay. Looks great overall, I am leaving a few inline comments.
src/Build/BuildCheck/Infrastructure/EditorConfig/EditorConfigParser.cs
Outdated
Show resolved
Hide resolved
src/Build/BuildCheck/Infrastructure/EditorConfig/EditorConfigParser.cs
Outdated
Show resolved
Hide resolved
src/Build/BuildCheck/Infrastructure/EditorConfig/EditorConfigParser.cs
Outdated
Show resolved
Hide resolved
src/Build/BuildCheck/Infrastructure/EditorConfig/EditorConfigParser.cs
Outdated
Show resolved
Hide resolved
src/Build/BuildCheck/Infrastructure/EditorConfig/EditorConfigParser.cs
Outdated
Show resolved
Hide resolved
{ | ||
var editorConfigfileContent = File.ReadAllText(editorConfigFilePath); | ||
editorConfig = EditorConfigFile.Parse(editorConfigfileContent); | ||
editorConfigFileCache[editorConfigFilePath] = editorConfig; |
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.
Is it Ok for this class to not be thread safe?
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.
Discussed offline with @JanKrivanek and there is a case with graph enabled scenario where it could be used like that. So update it to the use ConcurrentDictionary.
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.
I haver couple comments for consideration - but overall looks good!
src/Build/BuildCheck/Infrastructure/BuildCheckConfigurationErrorScope.cs
Outdated
Show resolved
Hide resolved
src/Build/BuildCheck/Infrastructure/EditorConfig/EditorConfigParser.cs
Outdated
Show resolved
Hide resolved
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.
Thnak you for all the improvement roundtrips on the PR!
First iteration of the code with latest merged changes from exp/build-analyzers.
Design capturing current implementation could be viewed here: https://github.com/dotnet/msbuild/tree/dev/f-alizada/support-editorconfig/src/Build/BuildCop/Infrastructure/EditorConfig
Discussions:
Current implementation.
The editorConfig parsing functionality is being used by https://github.com/dotnet/msbuild/blob/dev/f-alizada/support-editorconfig/src/Build/BuildCheck/Infrastructure/ConfigurationProvider.cs#L129
to fetch all configs from .editorconfig.
Retrieve infra configuration for rule:
msbuild/src/Build/BuildCheck/Infrastructure/ConfigurationProvider.cs
Line 166 in e0dfb8d
Retrieve non infra configuration for rule:
msbuild/src/Build/BuildCheck/Infrastructure/ConfigurationProvider.cs
Line 46 in e0dfb8d