Commit Graph

19 Commits

Author SHA1 Message Date
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
Ryan Ernst 68817d7ca2
Rename o.e.common in libs/core to o.e.core (#73909)
When libs/core was created, several classes were moved from server's
o.e.common package, but they were not moved to a new package. Split
packages need to go away long term, so that Elasticsearch can even think
about modularization. This commit moves all the classes under o.e.common
in core to o.e.core.

relates #73784
2021-06-08 09:53:28 -07:00
Rene Groeschke e609e07cfe
Remove internal build logic from public build tool plugins (#72470)
Extract usage of internal API from TestClustersPlugin and PluginBuildPlugin and related plugins and build logic

This includes a refactoring of ElasticsearchDistribution to handle types
better in a way we can differentiate between supported Elasticsearch
Distribution types supported in TestCkustersPlugin and types only supported
in internal plugins.

It also introduces a set of internal versions of public plugins.

As part of this we also generate the plugin descriptors now.

As a follow up on this we can actually move these public used classes into 
an extra project (declared as included build)

We keep LoggedExec and VersionProperties effectively public And workaround for RestTestBase
2021-05-06 14:02:35 +02:00
Rory Hunter ac371b070a
Refresh formatter config (#71588)
Write out the formatter config using the latest Eclipse. This has the
effect of configuring assertion formatting properly, which has improved
how some of our assertion messsages are formatted. Also reconfigure how
annotations are formatted, so that they are correctly line-wrapped.
2021-04-13 09:33:41 +01:00
Rory Hunter de24331e6b
Upgrade Spotless from 5.9.0 to 5.12.0 (#71561)
Upgrade Spotless from 5.9.0 to 5.12.0. This causes a few formatting changes around
how lambdas are arranged, mostly for the better.
2021-04-12 19:34:44 +01:00
Mark Vieira 6339691fe3
Consolidate REST API specifications and publish under Apache 2.0 license (#70036) 2021-03-26 16:20:14 -07:00
Joe Gallo 4cc4c2cc47
[REST Compatible API] Route refactoring (#69573)
Related to #51816

Makes `Route`s  `RestApiVersion` -aware (and `RestHandler`s `RestApiVersion` -agnostic). Refactors 
how `Route`s are constructed in the case of deprecation or replacement of routes.
2021-03-05 19:11:37 -05:00
Rene Groeschke bdf229a148
Introduce Internal Test Artifact Plugin (#68766)
This reduces the ceremony declaring test artifacts for a project.
It also solves an issue with usage of deprecated testRuntime that
testArtifacts extendsFrom which seems not required at all and would have
broke with Gradle 7.0 anyhow

Test artifact resolution is now variant aware which allows us a more adequate 
compile and runtime classpath for the consuming projects.

We also Introduce a convention method in the elasticsearch build to declare 
test artifact dependencies in an easy way close to how its done by the gradle build in 
test fixture plugin.

Furthermore we cleaned up some inconsistent test dependencies declarations when 
relying on a project and on its test artifacts
2021-02-16 14:36:17 +01:00
Rory Hunter 9c7fe876a2
Replace NOT operator with explicit `false` check - part 10 (#68652)
Part 10 (and hopefully the last one).

We have an in-house rule to compare explicitly against `false` instead
of using the logical not operator (`!`). However, this hasn't
historically been enforced, meaning that there are many violations in
the source at present.

We now have a Checkstyle rule that can detect these cases, but before we
can turn it on, we need to fix the existing violations. This is being
done over a series of PRs, since there are a lot to fix.
2021-02-08 15:38:22 +00:00
Rene Groeschke 5dfa6f46ac
Remove deprecated usage of default configuration (#68575)
This has been deprecated in gradle before but we havnt been warned.

Gradle 7.0 will likely introduce a change in behaviour here that we
should fix the usage of this configuration upfront.

See https://github.com/gradle/gradle/issues/16027 for further information
about the change in Gradle 7.0
2021-02-07 12:08:02 +01:00
Mark Vieira a92a647b9f Update sources with new SSPL+Elastic-2.0 license headers
As per the new licensing change for Elasticsearch and Kibana this commit
moves existing Apache 2.0 licensed source code to the new dual license
SSPL+Elastic license 2.0. In addition, existing x-pack code now uses
the new version 2.0 of the Elastic license. Full changes include:

 - Updating LICENSE and NOTICE files throughout the code base, as well
   as those packaged in our published artifacts
 - Update IDE integration to now use the new license header on newly
   created source files
 - Remove references to the "OSS" distribution from our documentation
 - Update build time verification checks to no longer allow Apache 2.0
   license header in Elasticsearch source code
 - Replace all existing Apache 2.0 license headers for non-xpack code
   with updated header (vendored code with Apache 2.0 headers obviously
   remains the same).
 - Replace all Elastic license 1.0 headers with new 2.0 header in xpack.
2021-02-02 16:10:53 -08:00
David Roberts fec9e13a8b
[ML] Rename "file" to "text" (#68216)
Completes the process of renaming "file" to "text" in the
text structure plugin.

The unit test classes for some of the classes renamed in
this PR had already been renamed before, so they weren't
easy to navigate to in IntelliJ.
2021-01-29 16:09:38 +00:00
David Roberts c82fc14242
[ML] Return 400 status for invalid charset in find_structure (#68201)
If an invalid charset argument is supplied to the
_text_structure/find_structure endpoint it should
return a 400 status. Previously it was returning
a 500 status. This change corrects that mistake.

Fixes #68130
2021-01-29 13:11:19 +00:00
David Roberts 09f485b140
[ML] Return status 400 for grok_pattern errors in find_structure (#68205)
The _text_structure/find_structure endpoint should return a
400 error if an invalid grok_pattern override is supplied.
Previously this was happening in the case of high-level
errors, like named patterns that didn't exist, but in the
case of low-level errors in the regex structure 500 errors
were being returned. This change rectifies the mistake, so
that now both high-level and low-level errors in grok_pattern
overrides return status 400.

Fixes #68132
2021-01-29 13:03:55 +00:00
David Roberts 6de38ef1d3
[ML] Make find_structure validate lines_to_sample at least 2 (#68199)
Previously the _text_structure/find_structure endpoint was
validating that lines_to_sample was greater than zero if
specified. However, the docs stated that 2 was the minimum
value allowed, and values of 1 were silently increased to 2.
This change removes the leniency and validates that, if
supplied, lines_to_sample is set to at least 2.

Fixes #68128
2021-01-29 13:00:45 +00:00
Benjamin Trent 24ebcc8c24
[ML] [DOCS] update find-structure reference docs (#67586)
The text structure finder API documentation had many references to the "files". While this is one use of the API, the API now has a more generic name. This commit replaces many references to the word "file" to the more generic word "text".
2021-01-15 12:19:38 -05:00
Benjamin Trent 5cf569ffff
[ML] move find file structure finder in Rest high Level client to its new endpoint and plugin (#67290)
Find file structure finder is now its own plugin, and separated from the ml plugin.

This commit updates the rest high level client to reflect this.

Additionally, this adjusts the internal and client object names from `FileStructure` to the more general `TextStructure`
2021-01-14 08:16:52 -05:00
Benjamin Trent a437af3406
[ML] rename the text structure action and update required permissions (#67388)
This renames the text structure finder action to match the plugin name.
Also, this adds a new reserved role name so that adding specific permissions for this API is simple.
2021-01-13 14:11:25 -05:00
Benjamin Trent af179ab2f5
[ML] move find file structure to a new API endpoint (#67123)
This introduces a new `text-structure` plugin. This is the new home of the find file structure API. 

The old REST URL is still available but is deprecated.

The new URL is: `_text_structure/find_structure`. All parameters and behavior are unchanged.

Changes to the high-level REST client and docs will be in separate commit.

related to: https://github.com/elastic/elasticsearch/issues/67001
2021-01-11 08:56:02 -05:00