-
-
Notifications
You must be signed in to change notification settings - Fork 89
-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
Using .gitignore to exclude files #631
Comments
I am curious what you are ignoring with .gitignore that you also want to exclude from formatting. CSharpier currently has logic that attempts to ignore any known generated code files. For example files that start with |
I couldn't find any way to get csharpier to verbosely print what files it's loading, but without
with
Some examples of the extra files, none have any consistent pattern:
The .gitignore files for directories:
Some of these can have .cs files, some can't, so it's easier to ignore them all. |
I created #632 because getting a list of what csharpier is doing seems like a useful thing. From what I know of Unity, and from glancing at a few public repos, it seems like all of the code that you would want formatted lives in ./Assets. So if none of the ignored folders there include .cs files, then maybe running csharpier against just that folder is an easy fix. I've had some time to noodle on a few possible approaches to using a .gitignore as the .csharpierignore. If csharpier uses a .gitignore it finds instead of looking for a .csharpierignore, it could end up formatting code that was previously ignored. If there is a ./.csharpierignore, a ./src/.gitignore, and a file at ./src/FileIgnoredByCSharpierIgnore.cs, then the ./src/.gitignore would be picked up and used and the file that was previously ignored would now get formatted. You could add it to the .gitignore and still leave it in the repo, but that feels a bit weird. If you can specify an ignore file with the cli, you could use Another option would be to implement an import feature. The .csharpierignore can then import the .gitignore. Although getting exclusions to work seems like it would be a bit messy. https://stackoverflow.com/questions/5533050/gitignore-exclude-folder-but-include-specific-subfolder This also feels like the most work, and introduces a whole new concept to ignore files. So my hope is that |
Hi! 👋 Thanks for making this. I was so surprised when I started playing around with Unity again that there wasn't an opinionated formatter like prettier for C# that would work from the command line, so I was pleased to find this.
I see that there's a
.csharpierignore
file, but between Unity and Rider there's a lot of directories to ignore. It would be nice if we could specify ignoring.gitignore
also, either by default or with configuration.Currently working around it by symbolic linking
.csharpierignore
to.gitignore
.The text was updated successfully, but these errors were encountered: