Skip to content

Improve resiliency to auto-formatting in server #48940

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

Merged
merged 1 commit into from
Nov 11, 2019

Conversation

pugnascotia
Copy link
Contributor

Backport of #48450.

Make a number of changes so that code in the server directory is more
resilient to automatic formatting. This covers:

  • Reformatting multiline JSON to embed whitespace in the strings
  • Move some comments around to they aren't auto-formatted to a strange
    place. This also required moving some && and || operators from the
    end-of-line to start-of-line`.
  • Add helper method reformatJson(), to strip whitespace from a JSON
    document using XContent methods. This is sometimes necessary where
    a test is comparing some machine-generated JSON with an expected
    value.

Also, HyperLogLogPlusPlus.java is now excluded from formatting because it
contains large data tables that don't reformat well with the current settings,
and changing the settings would be worse for the rest of the codebase.

Make a number of changes so that code in the `server` directory is more
resilient to automatic formatting. This covers:

* Reformatting multiline JSON to embed whitespace in the strings
* Move some comments around to they aren't auto-formatted to a strange
  place. This also required moving some `&&` and `||` operators from the
  end-of-line to start-of-line`.
* Add helper method `reformatJson()`, to strip whitespace from a JSON
  document using XContent methods. This is sometimes necessary where
  a test is comparing some machine-generated JSON with an expected
  value.

Also, `HyperLogLogPlusPlus.java` is now excluded from formatting because it
contains large data tables that don't reformat well with the current settings,
and changing the settings would be worse for the rest of the codebase.
@pugnascotia pugnascotia added :Core/Infra/Core Core issues without another label backport v7.6.0 labels Nov 11, 2019
@elasticmachine
Copy link
Collaborator

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

@pugnascotia
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/1

@pugnascotia pugnascotia merged commit 014e1b1 into elastic:7.x Nov 11, 2019
@pugnascotia pugnascotia deleted the 7.x branch November 11, 2019 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport :Core/Infra/Core Core issues without another label v7.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants