.editorconfig is not considered, when its part of the .gitignore
In the following implementation, the ignore file is explicitly considered, when searching for a configuration file: https://github.com/belav/csharpier/blob/4b30a177f33be5facae530432cc07dac6d991fe1/Src/CSharpier.Cli/EditorConfig/EditorConfigLocator.cs#L25
Does it really make sense to consider the ignore file, when searching for the configuration? Wouldn't it be better to only consider the ignore file when determining files to format?
Environments:
- CSharpier Version: 1.0.0
- Running CSharpier via: dotnet cli
- Operating System: Debian
Steps to reproduce:
- Add the
.editorconfigto the.gitignore - Apply the formatting
Expected behavior:
-
.gitignoreshould only be applied when determining files to format -
.editorconfigis considered
Actual behavior:
-
.gitignoreis also applied when looking for configuration files -
.editorconfigis not considered at all
+1 for this. In some of my projects the .editorconfig file is generated by a NuGet package, so we've added the .editorconfig to the .gitignore
That change came about due to #1023 - an external dependency had a .editorconfig with an invalid rule that was causing parsing to fail.
I haven't tested it, but I believe as a workaround because the .csharpierignore takes priority you can explicitly include the .editorconfig with something like below. Also note that I pulled the .gitignore support out of 1.0.1 for now due to performance issues, but it will be returning in 1.0.2.
![PathToGitIgnored]/.editorconfig
I think I agree that it is a bit odd to consider the ignore file when looking for configuration files. Perhaps there should be a way to exclude a configuration file, or if a configuration file cannot be parsed it is a warning instead of an error.
Thanks for your answer, and your awesome work btw!!
The workaround works. We had the same idea and already solved it that way.