Skip to content
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

Ability To Turn Off Formatting For Subdirectory #870

Open
samdeane opened this issue Nov 5, 2024 · 4 comments
Open

Ability To Turn Off Formatting For Subdirectory #870

samdeane opened this issue Nov 5, 2024 · 4 comments

Comments

@samdeane
Copy link

samdeane commented Nov 5, 2024

I have a .swift-format file at the root of my repo, but some third-party code in a sub-directory. I'd like to be able to disable formatting for the subdirectory.

There are a couple of ways that this could be accomplished

  • a setting in .swift-format with a pattern or patterns for paths to be excluded from formatting
  • detecting the presence of a file .no-swift-format and disabling formatting anywhere below that file in the tree

The former case is useful, but would not be sufficient in the situation where you've a submodule with some third-party code, and that submodule has its own .swift-format file. In that situation the module's file would take precedence as it is closest, but you'd want to be able to override it locally without having to make changes to it.

Detecting a .no-swift-format file at the same level would be efficient in this situation, and the file could be added to .gitignore for the module, so that creating it locally would not cause upstream problems.

@samdeane
Copy link
Author

samdeane commented Nov 5, 2024

See also this thread

@ahoppen
Copy link
Member

ahoppen commented Nov 5, 2024

Synced to Apple’s issue tracker as rdar://139269456

@samdeane
Copy link
Author

samdeane commented Nov 7, 2024

Have added an untested implementation at #873.

@samdeane
Copy link
Author

samdeane commented Nov 27, 2024

#873 now tested locally and submitted for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants