Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Respect
.editorconfig
settings for formatting shell viashfmt
#2031Respect
.editorconfig
settings for formatting shell viashfmt
#2031Changes from all commits
4898462
d95436a
4ae13c9
1b3335d
733f7da
3c2701d
8bf8d8f
4c4b7bc
2c38247
28b079c
62f27ca
42b43dc
fc82b24
06325f8
6e52d6e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's very likely that project's aren't storing their shell scripts as siblings to the build file so this updates the search to be more inclusive by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can add an option to override
.editorconfig
path likeBaseKotlinExtension.KtlintConfig#setEditorConfigPath
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I can tell, when configuring ktlint for formatting, you actually provide the .editorconfig path to ktlint and that is an input supported by ktlint. As far as I can tell, there is no way to provide an
.editorconfig
path toshfmt
🙁With that said, I did request that an input flag be added for situations like this: mvdan/sh#1055
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can note a bit more here, that the
.editorconfig
file only be supported at the same level as shell files, you can't override it's path due to mvdan/sh#1055.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is an incorrect assumption, surprisingly. If I were to have the following project structure, all shell files will respect the
.editorconfig
settings. I can write tests to validate and solidify this claim, but this is the behavior I've seen in a standalone test project.shfmt
tries to be smart when looking for an.editorconfig
. I'm not sure I know what the process for finding the.editorconfig
is, but the developer's https://github.com/mvdan/editorconfig library is used instead of the default Go library and I think that plays a factor in finding the editorconfig.