-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Context
Configuration module will be responsible for loading user settings from .editorconfigs in a structured form. The OM for configuration will yet be determined - we should be able to support strongly typed configuration, but it will be known at compile time and can be assumed 'hardcoded'. It should as well be possible to pass-through a custome key-value pairs as configuration - basically anything that is not recognized by existing OM will be stuffed to a lookup and provided to the analyzer.
Note .editorconfig files are hierarchical - more details https://editorconfig.org/#file-location
Plus .editorconfig might be included in nuget packages and written to source location during restore phase. Thiough for a V1 we might just decide to ignore configuration changes upon build start.
Things to be investigated and decided
- Rules group, naming (e.g.
dotnet_diagnostic.MSB00123.severity = warning) - Any additional support for grouping? (e.g. how to effectively distinguish all rules imported from specific package)
- Where/How to discover .editorconfig files (e.g. Roslyn consider hieratchical editorconfig files in included sources locations plus packed in regular nugets or analyzer nugets)
References
- https://editorconfig.org/
- https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/configuration-files
- Roslyn imlementation:
- https://github.com/dotnet/roslyn/blob/8a7ca9af3360ef388b6dad61c95e2d0629d7a032/src/Compilers/Core/Portable/CommandLine/AnalyzerConfig.cs
- https://github.com/dotnet/roslyn/tree/8a7ca9af3360ef388b6dad61c95e2d0629d7a032/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EditorConfig
- https://www.mytechramblings.com/posts/configure-roslyn-analyzers-using-editorconfig
Followup work in scope of this epic:
- Configuration - ConfigurationContext should contain infra config as well #10123
- [Feature Request]: Expand BuildCheck editorconfig allowable syntax #10232
- Multiword configuration options renaming #10315