diff --git a/build.gradle b/build.gradle index 508493c2..fe9ba086 100644 --- a/build.gradle +++ b/build.gradle @@ -27,6 +27,7 @@ allprojects { } } +apply plugin: 'checkstyle' apply plugin: 'idea' apply plugin: 'elasticsearch.esplugin' apply plugin: 'elasticsearch.java-rest-test' @@ -40,6 +41,10 @@ noticeFile = rootProject.file('NOTICE.txt') // disable uploadArchives task for now, no upload happening currently uploadArchives.enabled = false +checkstyle { + configFile = rootProject.file('config/checkstyle/checkstyle.xml') +} + esplugin { name 'ltr' description 'Learning to Rank Query w/ RankLib Models' @@ -63,13 +68,6 @@ repositories { } } -dependencyLicenses { - mapping from: /lucene-.*/, to: 'lucene' - mapping from: /asm-.*/, to: 'asm' - mapping from: /Ranky-.*/, to: 'lucene' - mapping from: /compiler-.*/, to: 'lucene' -} - sourceSets { javaRestTest { compileClasspath += sourceSets["main"].output + sourceSets["test"].output + configurations["testRuntimeClasspath"] @@ -86,18 +84,5 @@ java { checkstyleMain.enabled = true checkstyleTest.enabled = true -// FIXME dependency license check needs to be enabled -dependencyLicenses.enabled = false - -// FIXME thirdparty audit needs to be enabled -thirdPartyAudit.enabled = false - -// Uncomment this to skip license header checks -licenseHeaders.enabled = false - -// No need to validate POM, as we do not upload to sonatype +// // No need to validate POM, as we do not upload to sonatype validateNebulaPom.enabled = false - -// Elastic tried to remove the logging requirement for plugins, but didn't get it quite right so this is a short term fix until 7.11 -// https://github.com/elastic/elasticsearch/issues/65247 -loggerUsageCheck.enabled = false diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 00000000..befd8f1e --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml new file mode 100644 index 00000000..b51ae0e2 --- /dev/null +++ b/config/checkstyle/suppressions.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gradle.properties b/gradle.properties index 373fa102..10717d12 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ ltrVersion = 1.5.4 -elasticsearchVersion = 7.10.2 +elasticsearchVersion = 7.11.1 luceneVersion = 8.7.0 ow2Version = 8.0.1 -antlrVersion=4.5.1-1 +antlrVersion = 4.5.1-1 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 12d38de6..8cf6eb5a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/com/o19s/es/ltr/action/TransportListStoresAction.java b/src/main/java/com/o19s/es/ltr/action/TransportListStoresAction.java index 20403b20..a97bc3fb 100644 --- a/src/main/java/com/o19s/es/ltr/action/TransportListStoresAction.java +++ b/src/main/java/com/o19s/es/ltr/action/TransportListStoresAction.java @@ -34,8 +34,6 @@ import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation; @@ -43,7 +41,6 @@ import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; @@ -61,23 +58,13 @@ public class TransportListStoresAction extends TransportMasterNodeReadAction() : null, null ); - processor.process(new FetchSubPhase.HitContext(hit, context, doc, new SourceLookup())); + processor.process(new FetchSubPhase.HitContext(hit, context, doc)); hits.add(hit); } } diff --git a/src/test/resources/rest-api-spec/api/ltr.add_features_to_set.json b/src/test/resources/rest-api-spec/api/ltr.add_features_to_set.json index 16f43579..6fd2a8bb 100644 --- a/src/test/resources/rest-api-spec/api/ltr.add_features_to_set.json +++ b/src/test/resources/rest-api-spec/api/ltr.add_features_to_set.json @@ -1,6 +1,7 @@ { "ltr.add_features_to_set": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.cache_stats.json b/src/test/resources/rest-api-spec/api/ltr.cache_stats.json index ac606cb9..72b8f0e1 100644 --- a/src/test/resources/rest-api-spec/api/ltr.cache_stats.json +++ b/src/test/resources/rest-api-spec/api/ltr.cache_stats.json @@ -1,6 +1,7 @@ { "ltr.cache_stats": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.clear_cache.json b/src/test/resources/rest-api-spec/api/ltr.clear_cache.json index 1668a3ab..3fbce62c 100644 --- a/src/test/resources/rest-api-spec/api/ltr.clear_cache.json +++ b/src/test/resources/rest-api-spec/api/ltr.clear_cache.json @@ -1,6 +1,7 @@ { "ltr.clear_cache": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.create_feature.json b/src/test/resources/rest-api-spec/api/ltr.create_feature.json index ccfd4a0c..4d062771 100644 --- a/src/test/resources/rest-api-spec/api/ltr.create_feature.json +++ b/src/test/resources/rest-api-spec/api/ltr.create_feature.json @@ -1,6 +1,7 @@ { "ltr.create_feature": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.create_featureset.json b/src/test/resources/rest-api-spec/api/ltr.create_featureset.json index a03953d4..9e59c32e 100644 --- a/src/test/resources/rest-api-spec/api/ltr.create_featureset.json +++ b/src/test/resources/rest-api-spec/api/ltr.create_featureset.json @@ -1,6 +1,7 @@ { "ltr.create_featureset": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.create_model.json b/src/test/resources/rest-api-spec/api/ltr.create_model.json index a3fcfc47..2792e237 100644 --- a/src/test/resources/rest-api-spec/api/ltr.create_model.json +++ b/src/test/resources/rest-api-spec/api/ltr.create_model.json @@ -1,6 +1,7 @@ { "ltr.create_model": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.create_model_from_set.json b/src/test/resources/rest-api-spec/api/ltr.create_model_from_set.json index 779f502d..d902a42a 100644 --- a/src/test/resources/rest-api-spec/api/ltr.create_model_from_set.json +++ b/src/test/resources/rest-api-spec/api/ltr.create_model_from_set.json @@ -1,6 +1,7 @@ { "ltr.create_model_from_set": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.create_store.json b/src/test/resources/rest-api-spec/api/ltr.create_store.json index 1f77a988..b3cdbafc 100644 --- a/src/test/resources/rest-api-spec/api/ltr.create_store.json +++ b/src/test/resources/rest-api-spec/api/ltr.create_store.json @@ -1,6 +1,7 @@ { "ltr.create_store": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.delete_feature.json b/src/test/resources/rest-api-spec/api/ltr.delete_feature.json index 2a5758de..e7d5a7ff 100644 --- a/src/test/resources/rest-api-spec/api/ltr.delete_feature.json +++ b/src/test/resources/rest-api-spec/api/ltr.delete_feature.json @@ -1,6 +1,7 @@ { "ltr.delete_feature": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.delete_featureset.json b/src/test/resources/rest-api-spec/api/ltr.delete_featureset.json index aa293667..f32d27ef 100644 --- a/src/test/resources/rest-api-spec/api/ltr.delete_featureset.json +++ b/src/test/resources/rest-api-spec/api/ltr.delete_featureset.json @@ -1,6 +1,7 @@ { "ltr.delete_featureset": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.delete_model.json b/src/test/resources/rest-api-spec/api/ltr.delete_model.json index 80aa21c9..5fab71e8 100644 --- a/src/test/resources/rest-api-spec/api/ltr.delete_model.json +++ b/src/test/resources/rest-api-spec/api/ltr.delete_model.json @@ -1,6 +1,7 @@ { "ltr.delete_model": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.delete_store.json b/src/test/resources/rest-api-spec/api/ltr.delete_store.json index ab988fe7..d326c62e 100644 --- a/src/test/resources/rest-api-spec/api/ltr.delete_store.json +++ b/src/test/resources/rest-api-spec/api/ltr.delete_store.json @@ -1,6 +1,7 @@ { "ltr.delete_store": { "stability": "stable", + "visibility": "private", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.get_feature.json b/src/test/resources/rest-api-spec/api/ltr.get_feature.json index 4f9ab668..404c8eb7 100644 --- a/src/test/resources/rest-api-spec/api/ltr.get_feature.json +++ b/src/test/resources/rest-api-spec/api/ltr.get_feature.json @@ -1,6 +1,7 @@ { "ltr.get_feature": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.get_featureset.json b/src/test/resources/rest-api-spec/api/ltr.get_featureset.json index ff3ec4d6..a7e545d5 100644 --- a/src/test/resources/rest-api-spec/api/ltr.get_featureset.json +++ b/src/test/resources/rest-api-spec/api/ltr.get_featureset.json @@ -1,6 +1,7 @@ { "ltr.get_featureset": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.get_model.json b/src/test/resources/rest-api-spec/api/ltr.get_model.json index a59c3c8f..22abd34b 100644 --- a/src/test/resources/rest-api-spec/api/ltr.get_model.json +++ b/src/test/resources/rest-api-spec/api/ltr.get_model.json @@ -1,6 +1,7 @@ { "ltr.get_model": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.get_stats.json b/src/test/resources/rest-api-spec/api/ltr.get_stats.json index 5b342540..c8daacc7 100644 --- a/src/test/resources/rest-api-spec/api/ltr.get_stats.json +++ b/src/test/resources/rest-api-spec/api/ltr.get_stats.json @@ -1,6 +1,7 @@ { "ltr.get_stats": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.get_store.json b/src/test/resources/rest-api-spec/api/ltr.get_store.json index 3c93b7cd..17275767 100644 --- a/src/test/resources/rest-api-spec/api/ltr.get_store.json +++ b/src/test/resources/rest-api-spec/api/ltr.get_store.json @@ -1,6 +1,7 @@ { "ltr.get_store": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.list_feature.json b/src/test/resources/rest-api-spec/api/ltr.list_feature.json index 8cdac00b..62e1c1ac 100644 --- a/src/test/resources/rest-api-spec/api/ltr.list_feature.json +++ b/src/test/resources/rest-api-spec/api/ltr.list_feature.json @@ -1,6 +1,7 @@ { "ltr.list_feature": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.list_featureset.json b/src/test/resources/rest-api-spec/api/ltr.list_featureset.json index 0e1dc4c4..7340fe2a 100644 --- a/src/test/resources/rest-api-spec/api/ltr.list_featureset.json +++ b/src/test/resources/rest-api-spec/api/ltr.list_featureset.json @@ -1,6 +1,7 @@ { "ltr.list_featureset": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.list_model.json b/src/test/resources/rest-api-spec/api/ltr.list_model.json index 21d120e1..e9724a67 100644 --- a/src/test/resources/rest-api-spec/api/ltr.list_model.json +++ b/src/test/resources/rest-api-spec/api/ltr.list_model.json @@ -1,6 +1,7 @@ { "ltr.list_model": { "stability": "stable", + "visibility":"public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.list_stores.json b/src/test/resources/rest-api-spec/api/ltr.list_stores.json index daf9bc55..5e9e3167 100644 --- a/src/test/resources/rest-api-spec/api/ltr.list_stores.json +++ b/src/test/resources/rest-api-spec/api/ltr.list_stores.json @@ -1,6 +1,7 @@ { "ltr.list_stores": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.update_feature.json b/src/test/resources/rest-api-spec/api/ltr.update_feature.json index 1a7a92a8..31622ec5 100644 --- a/src/test/resources/rest-api-spec/api/ltr.update_feature.json +++ b/src/test/resources/rest-api-spec/api/ltr.update_feature.json @@ -1,6 +1,7 @@ { "ltr.update_feature": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.update_featureset.json b/src/test/resources/rest-api-spec/api/ltr.update_featureset.json index 899e542f..9f735f9a 100644 --- a/src/test/resources/rest-api-spec/api/ltr.update_featureset.json +++ b/src/test/resources/rest-api-spec/api/ltr.update_featureset.json @@ -1,6 +1,7 @@ { "ltr.update_featureset": { "stability": "stable", + "visibility": "public", "url": { "paths": [ { diff --git a/src/test/resources/rest-api-spec/api/ltr.update_model.json b/src/test/resources/rest-api-spec/api/ltr.update_model.json index 724e4461..91178c98 100644 --- a/src/test/resources/rest-api-spec/api/ltr.update_model.json +++ b/src/test/resources/rest-api-spec/api/ltr.update_model.json @@ -1,6 +1,7 @@ { "ltr.update_model": { "stability": "stable", + "visibility": "public", "url": { "paths": [ {