diff --git a/.github/workflows/code-hygiene.yml b/.github/workflows/code-hygiene.yml deleted file mode 100644 index a1adbb8a87507..0000000000000 --- a/.github/workflows/code-hygiene.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Code Hygiene - -on: [pull_request] - -jobs: - linelint: - runs-on: ubuntu-latest - name: Check if all files end in newline - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Linelint - uses: fernandrone/linelint@0.0.4 diff --git a/.linelint.yml b/.linelint.yml deleted file mode 100644 index ec947019f8ab6..0000000000000 --- a/.linelint.yml +++ /dev/null @@ -1,49 +0,0 @@ -# 'true' will fix files -autofix: true - -ignore: - - .git/ - - .gradle/ - - .idea/ - - '*.sha1' - - '*.txt' - - 'CHANGELOG.md' - - '.github/CODEOWNERS' - - 'buildSrc/src/testKit/opensearch.build/LICENSE' - - 'buildSrc/src/testKit/opensearch.build/NOTICE' - - 'server/licenses/apache-log4j-extras-DEPENDENCIES' - # Empty files - - 'buildSrc/src/integTest/resources/org/opensearch/gradle/internal/fake_git/remote/build.gradle' - - 'buildSrc/src/integTest/resources/org/opensearch/gradle/internal/fake_git/remote/distribution/archives/oss-darwin-tar/build.gradle' - - 'buildSrc/src/integTest/resources/org/opensearch/gradle/internal/fake_git/remote/distribution/bwc/bugfix/build.gradle' - - 'buildSrc/src/integTest/resources/org/opensearch/gradle/internal/fake_git/remote/distribution/bwc/minor/build.gradle' - - 'buildSrc/src/main/resources/buildSrc.marker' - - 'buildSrc/src/testKit/opensearch-build-resources/settings.gradle' - - 'buildSrc/src/testKit/opensearch.build/settings.gradle' - - 'buildSrc/src/testKit/reaper/settings.gradle' - - 'buildSrc/src/testKit/symbolic-link-preserving-tar/settings.gradle' - - 'buildSrc/src/testKit/testingConventions/empty_test_task/.gitignore' - - 'client/rest-high-level/src/main/resources/META-INF/services/org.opensearch.plugins.spi.NamedXContentProvider' - - 'distribution/bwc/bugfix/build.gradle' - - 'distribution/bwc/maintenance/build.gradle' - - 'distribution/bwc/minor/build.gradle' - - 'distribution/bwc/staged/build.gradle' - - 'libs/ssl-config/src/test/resources/certs/pem-utils/empty.pem' - - 'qa/evil-tests/src/test/resources/org/opensearch/common/logging/does_not_exist/nothing_to_see_here' - - 'qa/os/centos-6/build.gradle' - - 'qa/os/debian-8/build.gradle' - - 'qa/os/oel-6/build.gradle' - - 'qa/os/oel-7/build.gradle' - - 'qa/os/sles-12/build.gradle' - # Test requires no new line for these files - - 'server/src/test/resources/org/opensearch/action/bulk/simple-bulk11.json' - - 'server/src/test/resources/org/opensearch/action/search/simple-msearch5.json' - -rules: - # checks if file ends in a newline character - end-of-file: - # set to true to enable this rule - enable: true - - # if true also checks if file ends in a single newline character - single-new-line: true diff --git a/gradle/formatting.gradle b/gradle/formatting.gradle index 7cd8c35b5fef7..93be7b454d650 100644 --- a/gradle/formatting.gradle +++ b/gradle/formatting.gradle @@ -68,6 +68,7 @@ allprojects { removeUnusedImports() eclipse().configFile rootProject.file('buildSrc/formatterConfig.xml') trimTrailingWhitespace() + endWithNewline() custom 'Refuse wildcard imports', { // Wildcard imports can't be resolved; fail the build @@ -81,6 +82,12 @@ allprojects { paddedCell() } } + format 'misc', { + target '*.md', '*.gradle', '**/*.yaml', '**/*.yml', '**/*.svg' + + trimTrailingWhitespace() + endWithNewline() + } } precommit.dependsOn 'spotlessJavaCheck' diff --git a/modules/repository-url/src/yamlRestTest/resources/rest-api-spec/test/repository_url/20_repository.yml b/modules/repository-url/src/yamlRestTest/resources/rest-api-spec/test/repository_url/20_repository.yml index f40ad16bb4265..cc6b3b5ce1f33 100644 --- a/modules/repository-url/src/yamlRestTest/resources/rest-api-spec/test/repository_url/20_repository.yml +++ b/modules/repository-url/src/yamlRestTest/resources/rest-api-spec/test/repository_url/20_repository.yml @@ -27,6 +27,3 @@ type: url settings: url: "http://snapshot.unknown" - - - diff --git a/plugins/repository-hdfs/src/test/resources/rest-api-spec/test/hdfs_repository/30_snapshot.yml b/plugins/repository-hdfs/src/test/resources/rest-api-spec/test/hdfs_repository/30_snapshot.yml index fbe0e0a8b0066..7e76024dd2368 100644 --- a/plugins/repository-hdfs/src/test/resources/rest-api-spec/test/hdfs_repository/30_snapshot.yml +++ b/plugins/repository-hdfs/src/test/resources/rest-api-spec/test/hdfs_repository/30_snapshot.yml @@ -36,7 +36,7 @@ - match: { snapshot.shards.failed : 0 } # Remove our snapshot - - do: + - do: snapshot.delete: repository: test_snapshot_repository snapshot: test_snapshot diff --git a/plugins/repository-hdfs/src/test/resources/rest-api-spec/test/hdfs_repository/30_snapshot_get.yml b/plugins/repository-hdfs/src/test/resources/rest-api-spec/test/hdfs_repository/30_snapshot_get.yml index f38f4783b195b..3e61ef62f2a7d 100644 --- a/plugins/repository-hdfs/src/test/resources/rest-api-spec/test/hdfs_repository/30_snapshot_get.yml +++ b/plugins/repository-hdfs/src/test/resources/rest-api-spec/test/hdfs_repository/30_snapshot_get.yml @@ -59,7 +59,7 @@ - match: { snapshots.0.snapshot : test_snapshot_get } # Remove our snapshot - - do: + - do: snapshot.delete: repository: test_snapshot_get_repository snapshot: test_snapshot_get diff --git a/plugins/transport-nio/build.gradle b/plugins/transport-nio/build.gradle index 5ebb2a835782a..8a6a6a334e1a9 100644 --- a/plugins/transport-nio/build.gradle +++ b/plugins/transport-nio/build.gradle @@ -65,7 +65,7 @@ thirdPartyAudit { 'com.aayushatharva.brotli4j.encoder.Encoder', 'com.aayushatharva.brotli4j.encoder.Encoder$Mode', 'com.aayushatharva.brotli4j.encoder.Encoder$Parameters', - + // from io.netty.handler.codec.protobuf.ProtobufDecoder (netty) 'com.google.protobuf.ExtensionRegistry', 'com.google.protobuf.MessageLite$Builder', diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.cluster_manager/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.cluster_manager/10_basic.yml index b0f1c81b56a0e..6354c751aa5f3 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.cluster_manager/10_basic.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.cluster_manager/10_basic.yml @@ -20,7 +20,7 @@ setup: host .+ \n ip .+ \n node .+ \n - + $/ --- diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.health/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.health/10_basic.yml index 0d945d01a6ddb..52b27837a61ac 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.health/10_basic.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.health/10_basic.yml @@ -9,9 +9,9 @@ help: true node_selector: # Only send request to nodes in <2.0 versions, especially during ':qa:mixed-cluster:v1.x.x#mixedClusterTest'. - # Because YAML REST test takes the minimum OpenSearch version in the cluster to apply the filter in 'skip' section, + # Because YAML REST test takes the minimum OpenSearch version in the cluster to apply the filter in 'skip' section, # see OpenSearchClientYamlSuiteTestCase#initAndResetContext() for detail. - # During 'mixedClusterTest', the cluster can be mixed with nodes in 1.x and 2.x versions, + # During 'mixedClusterTest', the cluster can be mixed with nodes in 1.x and 2.x versions, # so node_selector is required, and only filtering version in 'skip' is not enough. version: "1.0.0 - 1.4.99" @@ -61,7 +61,7 @@ pending_tasks .+ \n max_task_wait_time .+ \n active_shards_percent .+ \n - + $/ --- diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cluster.state/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/cluster.state/10_basic.yml index fa973454cfba5..294f00bdd822b 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cluster.state/10_basic.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cluster.state/10_basic.yml @@ -17,18 +17,18 @@ - is_true: cluster_uuid - is_true: master_node - + --- "Get cluster state returns cluster_manager_node": - skip: version: " - 1.4.99" reason: "The metric cluster_manager_node is added to cluster state in version 2.0.0" - + - do: cluster.state: {} - + - set: cluster_manager_node: node_id - + - match: {master_node: $node_id} - match: {cluster_manager_node: $node_id} diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.delete_alias/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.delete_alias/10_basic.yml index 74684901579a4..43a6f656c09c3 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.delete_alias/10_basic.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.delete_alias/10_basic.yml @@ -28,6 +28,6 @@ indices.get_alias: index: testind name: testali - + - match: { 'status': 404 } - match: { 'error': 'alias [testali] missing' } diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.split/20_source_mapping.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.split/20_source_mapping.yml index 69061c6d0fbd4..2c878157f468e 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.split/20_source_mapping.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.split/20_source_mapping.yml @@ -2,7 +2,7 @@ "Split index ignores target template mapping": - skip: features: allowed_warnings - + # create index - do: indices.create: diff --git a/server/src/test/resources/org/opensearch/index/analysis/shingle_analysis.json b/server/src/test/resources/org/opensearch/index/analysis/shingle_analysis.json index 53e5bbd9fa946..4a4fc7d2c81b1 100644 --- a/server/src/test/resources/org/opensearch/index/analysis/shingle_analysis.json +++ b/server/src/test/resources/org/opensearch/index/analysis/shingle_analysis.json @@ -17,7 +17,7 @@ "output_unigrams" : false, "filler_token" : "FILLER" } - } + } } } -} +} \ No newline at end of file diff --git a/server/src/test/resources/org/opensearch/index/analysis/shingle_analysis2.json b/server/src/test/resources/org/opensearch/index/analysis/shingle_analysis2.json index 19b4d24063b8e..5927549c111fd 100644 --- a/server/src/test/resources/org/opensearch/index/analysis/shingle_analysis2.json +++ b/server/src/test/resources/org/opensearch/index/analysis/shingle_analysis2.json @@ -9,7 +9,7 @@ "output_unigrams" : false, "filler_token" : "FILLER" } - } + } } } } diff --git a/test/framework/build.gradle b/test/framework/build.gradle index 00d907ce6d108..255f554db7a79 100644 --- a/test/framework/build.gradle +++ b/test/framework/build.gradle @@ -88,7 +88,7 @@ test { systemProperty 'tests.gradle_index_compat_versions', BuildParams.bwcVersions.indexCompatible.join(',') systemProperty 'tests.gradle_wire_compat_versions', BuildParams.bwcVersions.wireCompatible.join(',') systemProperty 'tests.gradle_unreleased_versions', BuildParams.bwcVersions.unreleased.join(',') - + if (BuildParams.runtimeJavaVersion >= JavaVersion.VERSION_18) { jvmArgs += ["-Djava.security.manager=allow"] }