DotNetAnalyzers / StyleCopAnalyzers

An implementation of StyleCop rules using the .NET Compiler Platform
MIT License
2.61k stars 506 forks source link

Ability to have multiple (hierarchical) configuration files #3841

Closed alexrp closed 1 month ago

alexrp commented 1 month ago

I have a .stylecop.json file that is shared across my GitHub organization. I store it in my .github repository and use dotnet-file to synchronize it across the organization whenever it changes.

This is a pretty convenient setup, but it runs into a small problem: Not all repositories are necessarily under the same license. This means that the file header configuration (containing SPDX-License-Identifier) must be different in some repositories, which in turn defeats this whole synchronization scheme.

It would be nice if there was a way to specify multiple configuration files in a hierarchical way, such that I can have all the shared configuration in the .github repository as it is now, but also configure the file header settings in a small extra configuration file that isn't synchronized.

sharwell commented 1 month ago

You can place shared default values in a .globalconfig file, which will be overridden by stylecop.json.

alexrp commented 1 month ago

Ah, I wasn't aware that the analyzers pick up those properties from EditorConfig. That satisfies the use case for this feature request then, thanks!