-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
Pipe to dotnet csharpier
fails
#1240
Comments
csharpier/Src/CSharpier.Cli/Options/ConfigurationFileOptions.cs Lines 45 to 57 in 5d898a3
[EDIT]
Yikes. What if I run this at
https://learn.microsoft.com/en-us/dotnet/api/system.io.searchoption?view=net-8.0 |
An easy way to get csharpier to not go poking around is to supply a path to the config file with #1228 was created to avoid the recursive scanning which should resolve most of your concerns, I'll bump it up in priority. I didn't really take into account what could happen when someone was piping input to csharpier from different directories when implementing the current version of editorconfig parsing, my bad. I had created #288 to allow you to specify |
Thanks. If I use this in a script I'll add #1228 does sound like the way to go. My gut feel is that directory scanning has to be slower. Do you have any benchmarks around the config scanning code? I could look at implementing this if you're open to contributions? |
It turns out that when I added the code to search subtrees ahead of time for all config files I limited the editorconfig searching when std in was piped in, but neglected to also limit the standard config searching. #1243 is a quick fix for the problem you have. I don't know that I've benchmarked this specifc problem, but at one point each file that was formatted was redoing the scanning + parsing for the csharpier ignore file. I think it was the reparsing of that file that was the main performance problem. Definitely open to contributions if you feel like taking it on, but #1228 seems less important with this quick fix. |
@belav BTW, I had a look a few weeks back to implement this. However, a significant portion of the tests fail on Few solutions.
Thoughts? |
@jamesfoster-excelpoint I've been using #2. I work on windows and all the tests run on linux, so I thought I had the tests setup in a way that they deal with the line ending differences. If I recall correctly there are places where I specifically use '\n' or '\r\n' instead of raw strings, and other places where I normalize them via code. |
@belav Yeah. I saw some tests use explicit conversion and they pass. But there are others that don't. Happy to make a PR for this. Do you want all tests to do explicit line ending conversion? |
Environments:
dotnet csharpier
Steps to reproduce:
run csharpier from the command line in a folder with folders you don't have access to
Expected behavior:
It should write the formatted text to stdout and NOT go poking about in directories you have no business accessing!!
Actual behavior:
The text was updated successfully, but these errors were encountered: