-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Remove default indent from .editorconfig #49136
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
Remove default indent from .editorconfig #49136
Conversation
Prior to 3a3e5f6, there was no default indent configured in `.editorconfig`. This changed to 4 spaces when we configured an explicit indent of 2 for Gradle files. However, this change meant that YAML files then had 4-space indents, which is valid, but the repo's YAML files typically use 2-space indents. Therefore, change the default indent to 2 (which also matches e.g. bash scripts), and configure `.java` and `.groovy` specifically to use 4-space indents.
|
Pinging @elastic/es-core-infra (:Core/Infra/Core) |
henningandersen
left a comment
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.
Thanks for looking into this @pugnascotia , I left a comment to consider/discuss.
| indent_size = 4 | ||
|
|
||
| [*.bat] | ||
| indent_size = 2 |
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.
This means xml and html also use 2 space indent. I do not have the full overview of file types, but looks like intellij primarily uses 2 space indent for json, yaml and properties and thus 4 space for the rest. However, asciidoc and sql also seems to be using 2 space indent?
I am not really sure how to proceed without carefully considering each file type that we have. For now, I suggest to specify all the known files explicitly and leave out the default size (though I see the point in eventually including that). Could also keep default indent at 4 (but I think a default of 2 is more appropriate in the end?).
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.
Reflecting a bit more on this, I think just including xml and html with indent_size 4 into this PR can work out. We should then be prepared to adjust any additional file types too, but hopefully we have then hit most types correctly.
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.
I think you're right, I've pushed another change.
Instead of applying a default indent via `.editorconfig`, explicitly set an indent size for a variety of file types.
henningandersen
left a comment
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.
LGTM.
Prior to 3a3e5f6, there was no default indent configured in `.editorconfig`. This changed to 4 spaces when we configured an explicit indent of 2 for Gradle files. However, this change meant that YAML files then had 4-space indents, which is valid, but the repo's YAML files typically use 2-space indents. Remove the default indent again, and instead explicitly set an indent size for a variety of file types.
Backport of #49136. Prior to 3a3e5f6, there was no default indent configured in `.editorconfig`. This changed to 4 spaces when we configured an explicit indent of 2 for Gradle files. However, this change meant that YAML files then had 4-space indents, which is valid, but the repo's YAML files typically use 2-space indents. Remove the default indent again, and instead explicitly set an indent size for a variety of file types.
Prior to 3a3e5f6, there was no default indent configured in
.editorconfig. This changed to 4 spaces when we configured an explicit indent of 2 for Gradle files. However, this change meant that YAML files then had 4-space indents, which is valid, but the repo's YAML files typically use 2-space indents.Remove the default indent again, and specify the indent explicitly for a number of file extensions.