Skip to content

Conversation

@pugnascotia
Copy link
Contributor

@pugnascotia pugnascotia commented Nov 15, 2019

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.

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.
@pugnascotia pugnascotia added :Core/Infra/Core Core issues without another label v8.0.0 v7.6.0 labels Nov 15, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/Core)

Copy link
Contributor

@henningandersen henningandersen left a 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
Copy link
Contributor

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?).

Copy link
Contributor

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.

Copy link
Contributor Author

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.
Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@pugnascotia pugnascotia merged commit e6c5db9 into elastic:master Nov 15, 2019
@pugnascotia pugnascotia changed the title Change default indent to 2 in .editorconfig Remove default indent from .editorconfig Nov 15, 2019
pugnascotia added a commit to pugnascotia/elasticsearch that referenced this pull request Nov 15, 2019
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.
pugnascotia added a commit that referenced this pull request Nov 18, 2019
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants