Commit graph

10 commits

Author SHA1 Message Date
Luigi Dell'Aquila
f69c7396d9
SQL: Fix FORMAT function to better comply with Microsoft SQL Server specification (#86225) 2022-05-18 12:03:00 +02:00
Rory Hunter
5b49982309
Formatting escape hatch (#81806)
Thanks to https://bugs.eclipse.org/bugs/show_bug.cgi?id=574437,
we've run into a situation where Spotless is incorrectly formatting
a particular piece of syntax (due the underlying Eclipse bug). We
were able to turn off formatting of this syntax using `// @formatter:off`
and `// @formatter:on`, but there was a further problem. We configure
IntelliJ to use the Eclipse formatter plugin, but this doesn't
respect the `@formatter` tags since these are set at the Spotless
level, not the Eclipse formatter level. Note that these tags aren't
set in the Eclipse formatter config, because there we use `// tag::`
and `// end::` in order to avoid reformatting docs snippets, which
have a much narrower line width.

What a mess.

So, to get around all this, drop the `@formatter` tags and tweak
our custom `SnippetLengthCheck` Checkstyle rule so that
`// tag:noformat` regions are not subject to the narrower line length
check, but are still exempt from formatting.
2021-12-16 16:18:34 +00:00
Rory Hunter
128a7e7744
Fix compiler warnings in :server - part 3 (#76024)
Part of #40366. Fix a number of javac issues when linting is enforced in `server/`.
2021-08-10 15:05:55 +01:00
Rory Hunter
7ab0735054
Add .editorconfig options for gradle and groovy files (#74286)
Add more IntelliJ config to `.editorconfig` for formatting `.gradle`
and `.groovy` files. This formatting isn't enforced, but is broadly
in line with our Spotless config. This work is helpful is useful
because the Eclipse Groovy formatter that Spotless can use doesn't
give us good results.
2021-06-21 20:50:05 +01:00
Rory Hunter
a5d2251064
Order imports when reformatting (#74059)
Change the formatter config to sort / order imports, and reformat the
codebase. We already had a config file for Eclipse users, so Spotless now
uses that.

The "Eclipse Code Formatter" plugin ought to be able to use this file as
well for import ordering, but in my experiments the results were poor.
Instead, use IntelliJ's `.editorconfig` support to configure import
ordering.

I've also added a config file for the formatter plugin.

Other changes:
   * I've quietly enabled the `toggleOnOff` option for Spotless. It was
     already possible to disable formatting for sections using the markers
     for docs snippets, so enabling this option just accepts this reality
     and makes it possible via `formatter:off` and `formatter:on` without
     the restrictions around line length. It should still only be used as
     a very last resort and with good reason.
   * I've removed mention of the `paddedCell` option from the contributing
     guide, since I haven't had to use that option for a very long time. I
     moved the docs to the spotless config.
2021-06-16 09:22:22 +01:00
Rory Hunter
a67a5f9216
Generate an IDE-compatible checkstyle configuration (#66109)
With a few changes, our checkstyle config can be used by e.g. IntelliJ's
Checkstyle plugin. Add a task to generate this file automatically, and
create the necessary IntelliJ config to use it.

Also add a line-length setting to .editorconfig.
2020-12-14 13:47:28 +00:00
Rory Hunter
e6c5db986a
Remove default indent from .editorconfig (#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.
2019-11-15 11:00:33 +00:00
Rory Hunter
3a3e5f6176
Apply 2-space indent to all gradle scripts (#48849)
Closes #48724. Update `.editorconfig` to make the Java settings the default
for all files, and then apply a 2-space indent to all `*.gradle` files.
Then reformat all the files.
2019-11-13 10:14:04 +00:00
Martijn Laarman
dfecb256cb
Exit batch files explictly using ERRORLEVEL (#29583)
* Exit batch files explictly using ERRORLEVEL

This makes sure the exit code is preserved when calling the batch
files from different contexts other than DOS

Fixes #29582

This also fixes specific error codes being masked by an explict

exit /b 1

causing the useful exitcodes from ExitCodes to be lost.

* fix line breaks for calling cli to match the bash scripts

* indent size of bash files is 2, make sure editorconfig does the same for bat files

* update indenting to match bash files

* update elasticsearch-keystore.bat indenting

* Update elasticsearch-node.bat to exit outside of endlocal
2019-01-25 16:44:33 +01:00
Jochen Schalanda
18e969e161 Add simple EditorConfig
The EditorConfig file applies the formatting rules described in CONTRIBUTING.md.
2015-11-30 14:47:03 +01:00