Skip to content

Commit

Permalink
[Backport 2.x] Fix checkstyle (opensearch-project#3283) (opensearch-p…
Browse files Browse the repository at this point in the history
…roject#3287)

Backport cd45e78 from opensearch-project#3283

Moved only gradle settings and checkstyle files.

Signed-off-by: Andrey Pleskach <[email protected]>
  • Loading branch information
willyborankin authored Sep 6, 2023
1 parent 4de9c9e commit 3d191b8
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 33 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ jacocoTestReport {
}

checkstyle {
configFile file("checkstyle/sun_checks.xml")
configFile file("checkstyle/println_checks.xml")
toolVersion "10.3.3"
configDirectory.set(rootProject.file("checkstyle/"))
}

opensearchplugin {
Expand Down
18 changes: 16 additions & 2 deletions checkstyle/sun_checks.xml → checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
To suppress certain violations please review suppression filters.
Finally, it is worth reading the documentation.
-->

<!-- exSUN codestyle check with the additional check for System.out.ptintln -->
<module name="Checker">
<!--
If you set the basedir property below, then all reported file
Expand All @@ -36,6 +36,13 @@
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>
<!-- System.out.ptintln -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="src/main/java/org/opensearch/security/tools/*"/>
</module>
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="src/main/java/com/amazon/dlic/auth/http/kerberos/HTTPSpnegoAuthenticator.java"/>
</module>

<!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
<module name="SuppressionFilter">
Expand Down Expand Up @@ -188,6 +195,14 @@
<property name="optional" value="true"/>
</module>

<!-- System.out.println -->
<module name="RegexpSinglelineJava">
<property name="format" value="System.out.println"/>
<property name="ignoreCase" value="true"/>
<property name="message" value="Do not use System.out.println" />
<property name="severity" value="error"/>
</module>

</module>

<module name="RegexpSingleline">
Expand Down Expand Up @@ -215,5 +230,4 @@
<property name="checkFormat" value="$1"/>
</module>

<module name="PrintlnModule"/>
</module>
21 changes: 0 additions & 21 deletions checkstyle/println_checks.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.ExceptionsHelper;
import org.opensearch.core.action.ActionListener;
import org.opensearch.action.index.IndexRequest;
import org.opensearch.action.index.IndexResponse;
import org.opensearch.action.support.WriteRequest.RefreshPolicy;
Expand All @@ -43,7 +42,6 @@
import org.opensearch.rest.RestChannel;
import org.opensearch.rest.RestRequest;
import org.opensearch.rest.RestRequest.Method;
import org.opensearch.core.rest.RestStatus;
import org.opensearch.security.action.configupdate.ConfigUpdateAction;
import org.opensearch.security.action.configupdate.ConfigUpdateRequest;
import org.opensearch.security.action.configupdate.ConfigUpdateResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.google.common.collect.ImmutableList;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.core.action.ActionListener;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.inject.Inject;
import org.opensearch.core.action.ActionListener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
// CS-SUPPRESS-SINGLE: RegexpSingleline https://github.com/opensearch-project/OpenSearch/issues/3663

import com.google.common.collect.ImmutableList;

import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.core.action.ActionListener;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.action.admin.indices.create.CreateIndexResponse;
import org.opensearch.action.bulk.BulkRequestBuilder;
import org.opensearch.action.bulk.BulkResponse;
Expand All @@ -29,7 +27,6 @@
import org.opensearch.client.Client;
import org.opensearch.cluster.metadata.IndexMetadata;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.core.common.bytes.BytesReference;
import org.opensearch.common.collect.Tuple;
import org.opensearch.common.inject.Inject;
import org.opensearch.common.settings.Settings;
Expand Down

0 comments on commit 3d191b8

Please sign in to comment.