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

[SR-12804] swift-format fails to pick up custom configurations #326

Closed
tcldr opened this issue May 13, 2020 · 2 comments
Closed

[SR-12804] swift-format fails to pick up custom configurations #326

tcldr opened this issue May 13, 2020 · 2 comments
Labels
bug Something isn't working swift-format

Comments

@tcldr
Copy link

tcldr commented May 13, 2020

Previous ID SR-12804
Radar None
Original Reporter @tcldr
Type Bug
Status Closed
Resolution Invalid

Attachment: Download

Environment

swift-format swift-5.2-branch
Apple Swift version 5.2.2 (swiftlang-1103.0.32.6 clang-1103.0.32.51)
Target: x86_64-apple-darwin19.4.0

Additional Detail from JIRA
Votes 0
Component/s swift-format
Labels Bug
Assignee None
Priority Medium

md5: 22c9b59e707798dd0bc5db47b2cb6554

Issue Description:

I've noticed that the only way I can get swift-format to use a custom config is to set the '--configuration' flag explicitly.

My understanding from the docs is that if a file named '.swiftformat' exists within the same directory as the file – or any of its parent directories – swift-format should use that configuration instead.

Example: working In a dir named TestFormat are two files: Test.swift and '.swiftformat'. The '.swiftformat' file has its indentation set to four spaces.

Expected:
When you call `swift-format -r -i .`, Test.swift is formatted with indentation of four spaces.

Actual:
When you call `swift-format -r -i .`, Test.swift is formatted with the default configs indentation of two spaces.

Workaround:
Call `swift-format -r -i --configuration .swiftformat .` specifying the config explicitly instead.

@allevato
Copy link
Collaborator

Can you verify that you're using the correct filename? It should be .swift-format: https://github.com/apple/swift-format#configuration

@tcldr
Copy link
Author

tcldr commented Jun 25, 2020

Ah ha![]( Not sure how I missed that... Thank you)

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 9, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working swift-format
Projects
None yet
Development

No branches or pull requests

2 participants