From 1452d55155d279269f9cfca8e7eccb4736799d95 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Wed, 17 Oct 2018 16:12:21 -0400 Subject: [PATCH] Expressions: Wrap at 140 columns (#34493) Apply our standard line length to all of the java files in the `lang-expression` plugin. --- buildSrc/src/main/resources/checkstyle_suppressions.xml | 3 --- .../script/expression/ExpressionScriptEngine.java | 3 ++- .../script/expression/MoreExpressionTests.java | 8 ++++++-- .../script/expression/StoredExpressionTests.java | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/buildSrc/src/main/resources/checkstyle_suppressions.xml b/buildSrc/src/main/resources/checkstyle_suppressions.xml index 345189a6b5d..68836f1e71f 100644 --- a/buildSrc/src/main/resources/checkstyle_suppressions.xml +++ b/buildSrc/src/main/resources/checkstyle_suppressions.xml @@ -656,9 +656,6 @@ - - - diff --git a/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/ExpressionScriptEngine.java b/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/ExpressionScriptEngine.java index 5d47c87a445..0ece3834653 100644 --- a/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/ExpressionScriptEngine.java +++ b/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/ExpressionScriptEngine.java @@ -455,7 +455,8 @@ public class ExpressionScriptEngine extends AbstractComponent implements ScriptE // TODO: document and/or error if params contains _score? // NOTE: by checking for the variable in params first, it allows masking document fields with a global constant, // but if we were to reverse it, we could provide a way to supply dynamic defaults for documents missing the field? - private static void bindFromParams(@Nullable final Map params, final SimpleBindings bindings, final String variable) throws ParseException { + private static void bindFromParams(@Nullable final Map params, + final SimpleBindings bindings, final String variable) throws ParseException { // NOTE: by checking for the variable in vars first, it allows masking document fields with a global constant, // but if we were to reverse it, we could provide a way to supply dynamic defaults for documents missing the field? Object value = params.get(variable); diff --git a/modules/lang-expression/src/test/java/org/elasticsearch/script/expression/MoreExpressionTests.java b/modules/lang-expression/src/test/java/org/elasticsearch/script/expression/MoreExpressionTests.java index 11310710769..fdf9e09e07f 100644 --- a/modules/lang-expression/src/test/java/org/elasticsearch/script/expression/MoreExpressionTests.java +++ b/modules/lang-expression/src/test/java/org/elasticsearch/script/expression/MoreExpressionTests.java @@ -120,7 +120,8 @@ public class MoreExpressionTests extends ESIntegTestCase { client().prepareIndex("test", "doc", "1").setSource("text", "hello goodbye"), client().prepareIndex("test", "doc", "2").setSource("text", "hello hello hello goodbye"), client().prepareIndex("test", "doc", "3").setSource("text", "hello hello goodebye")); - ScoreFunctionBuilder score = ScoreFunctionBuilders.scriptFunction(new Script(ScriptType.INLINE, "expression", "1 / _score", Collections.emptyMap())); + ScoreFunctionBuilder score = ScoreFunctionBuilders.scriptFunction( + new Script(ScriptType.INLINE, "expression", "1 / _score", Collections.emptyMap())); SearchRequestBuilder req = client().prepareSearch().setIndices("test"); req.setQuery(QueryBuilders.functionScoreQuery(QueryBuilders.termQuery("text", "hello"), score).boostMode(CombineFunction.REPLACE)); req.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); // make sure DF is consistent @@ -190,7 +191,10 @@ public class MoreExpressionTests extends ESIntegTestCase { } public void testMultiValueMethods() throws Exception { - ElasticsearchAssertions.assertAcked(prepareCreate("test").addMapping("doc", "double0", "type=double", "double1", "type=double", "double2", "type=double")); + ElasticsearchAssertions.assertAcked(prepareCreate("test").addMapping("doc", + "double0", "type=double", + "double1", "type=double", + "double2", "type=double")); ensureGreen("test"); Map doc1 = new HashMap<>(); diff --git a/modules/lang-expression/src/test/java/org/elasticsearch/script/expression/StoredExpressionTests.java b/modules/lang-expression/src/test/java/org/elasticsearch/script/expression/StoredExpressionTests.java index 1877326b7d0..4bf8af9a12e 100644 --- a/modules/lang-expression/src/test/java/org/elasticsearch/script/expression/StoredExpressionTests.java +++ b/modules/lang-expression/src/test/java/org/elasticsearch/script/expression/StoredExpressionTests.java @@ -65,8 +65,8 @@ public class StoredExpressionTests extends ESIntegTestCase { } try { client().prepareSearch() - .setSource( - new SearchSourceBuilder().scriptField("test1", new Script(ScriptType.STORED, null, "script1", Collections.emptyMap()))) + .setSource(new SearchSourceBuilder().scriptField("test1", + new Script(ScriptType.STORED, null, "script1", Collections.emptyMap()))) .setIndices("test").setTypes("scriptTest").get(); fail("search script should have been rejected"); } catch(Exception e) {