Skip to content

Commit

Permalink
Fix checkstyle configuration and errors. WrenSecurity#71
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelhoral committed Apr 12, 2023
1 parent 3d598e4 commit fcf9943
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,24 @@ public Set<HostPort> getReplicationServers()
return replicationServers;
}

@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
else if (obj instanceof SuffixDescriptor)
{
final SuffixDescriptor other = (SuffixDescriptor) obj;
return getId().equals(other.getId());
}
else
{
return false;
}
}

@Override
public int hashCode()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,8 @@ private final Set<String> selectIndexesToRebuild(final EntryContainer entryConta
}
break;
default:
throw new UnsupportedOperationException("Unsupported rebuild mode " + rebuildConfig.getRebuildMode());
throw new UnsupportedOperationException("Unsupported rebuild mode "
+ rebuildConfig.getRebuildMode());
}
if (indexesToRebuild.contains(entryContainer.getDN2ID().getName().getIndexId())) {
// Always rebuild id2childrencount with dn2id.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ public interface Attribute extends Iterable<ByteString>
/** Marks code that can be removed once we are switching from server's to SDK's {@code Attribute}. */
public @interface RemoveOnceSwitchingAttributes
{
/** Free-form comment. */
/**
* Free-form comment.
* @return the comment
*/
String comment() default "";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ public final int size()
return values.size();
}

// @Checkstyle:ignore
@Override
public int hashCode()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public int size() {
return attribute.size();
}

// @Checkstyle:ignore
@Override
public int hashCode()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,12 @@
*/
package org.opends.server.types;





import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;



/**
* This class defines an annotation type that can be used to describe
* the position of a package, class, or method in the OpenDS public
Expand Down Expand Up @@ -80,12 +74,10 @@
/**
* Retrieves the stability level for the associated class or method.
*
* return The stability level for the associated class or method.
* @return The stability level for the associated class or method.
*/
StabilityLevel stability() default StabilityLevel.PRIVATE;



/**
* Indicates whether third-party code should be allowed to directly
* create new instances of the associated object type by calling the
Expand All @@ -96,14 +88,12 @@
* obtained elsewhere (e.g., provided as an argument to a method
* overridden by the third-party code).
*
* return {@code true} if third-party code should be allowed to
* @return {@code true} if third-party code should be allowed to
* create new instances of the associated object type, or
* {@code false} if not.
*/
boolean mayInstantiate() default false;



/**
* Indicates whether the associated class/interface/method may be
* extended/implemented/overridden by third-party code. In some
Expand All @@ -112,34 +102,30 @@
* may be extended by internal code but should not be extended by
* classes outside the OpenDS code base.
*
* return {@code true} if the associated class/interface/method
* @return {@code true} if the associated class/interface/method
* may be extended by third-party code, or {@code false} if
* not.
*/
boolean mayExtend() default false;



/**
* Indicates whether the associated method may be invoked by
* third-party code.
*
* return {@code true} if third-party code should be allowed to
* @return {@code true} if third-party code should be allowed to
* invoke the associated method, or {@code false} if not.
*/
boolean mayInvoke() default false;



/**
* Retrieves a string that may contain additional notes that should
* be taken into consideration by third-party developers that may be
* interested in using the associated code.
*
* return A string that may contain additional notes that should
* @return A string that may contain additional notes that should
* be taken into consideration by third-party developers
* that may be interested in using the associated code.
*/
String notes() default "";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static org.opends.server.util.CollectionUtils.*;
import static org.opends.server.util.StaticUtils.*;

import com.google.common.collect.Maps;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,12 @@ public final class DynamicConstants
/** The documentation url. */
public static String DOC_REFERENCE_WIKI = "${docWikiUrl}";
/** The documentation url. */
// @Checkstyle:ignore
public static String DOC_QUICK_REFERENCE_GUIDE = "${docGuideRefUrl}";

/** The administration guide. */
public static String ADMINISTRATION_GUIDE_URL = "${docGuideAdminUrl}";
/** The administration guide. */
// @Checkstyle:ignore
public static String ADMINISTRATION_GUIDE_URL = "${docGuideAdminUrl}";

/** A string representation of the version number. */
public static String VERSION_NUMBER_STRING = String.format("%s.%s.%s", MAJOR_VERSION, MINOR_VERSION, POINT_VERSION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,84 +13,85 @@
information: "Portions Copyright [year] [name of copyright owner]".
Copyright 2012-2015 ForgeRock AS.
Portions Copyright 2023 Wren Security.
-->
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<!-- Toggle Checkstyle on/off -->
<module name="SuppressWithPlainTextCommentFilter">
<property name="offCommentFormat" value="@Checkstyle:off" />
<property name="onCommentFormat" value="@Checkstyle:on" />
</module>

<!-- Ensure that each source file starts with the appropriate header -->
<module name="RegexpHeader">
<!-- Use header file template passed in from Maven -->
<property name="headerFile" value="${checkstyle.header.file}" />
<!-- Allow a file header to start with one of the 3 first lines of the headerFile -->
<property name="multiLines" value="1,2,3" />
</module>

<module name="Checker">
<!-- Toggle Checkstyle on/off -->
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="@Checkstyle:off" />
<property name="onCommentFormat" value="@Checkstyle:on" />
</module>

<!-- Ensure that no line exceeds 120 characters in length -->
<!-- FIXME Not sure how to disable length checking for selected lines https://github.com/checkstyle/checkstyle/issues/11939 -->
<!-- <module name="LineLength"> -->
<!-- <property name="max" value="120" /> -->
<!-- </module> -->

<!-- Ensure that no tab characters are used -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>

<!-- Ensure that no line ends with whitespace -->
<module name="RegexpSingleline">
<!-- \s matches whitespace character, $ matches end of line. -->
<property name="format" value="\s+$"/>
<property name="message" value="Line ends with whitespace." />
</module>

<module name="TreeWalker">
<!-- Instruct Checkstyle to ignore a specific check for a whole file -->
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="@Checkstyle:ignore ([\w\|]+)"/>
<property name="checkFormat" value="$1"/>
<property name="influenceFormat" value="1000000" />
</module>
<!-- Instruct Checkstyle to ignore next line -->

<!-- Instruct Checkstyle to ignore next line -->
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="@Checkstyle:ignore" />
<property name="influenceFormat" value="1" />
</module>

<!-- Instruct Checkstyle to ignore next N lines (-ve means previous lines) -->
<!-- Instruct Checkstyle to ignore next N lines (-ve means previous lines) -->
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="@Checkstyle:ignoreFor (\d+)" />
<property name="influenceFormat" value="$1" />
</module>

<!-- Ensure that each source file starts with the appropriate header -->
<module name="RegexpHeader">
<!-- Use header file template passed in from Maven -->
<property name="headerFile" value="${checkstyle.header.file}" />
<!-- Allow a file header to start with one of the 3 first lines of the headerFile -->
<property name="multiLines" value="1,2,3" />
</module>

<!-- Ensure that no tab characters are used -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>

<!-- Ensure that no line ends with whitespace -->
<module name="RegexpSingleline">
<!-- \s matches whitespace character, $ matches end of line. -->
<property name="format" value="\s+$"/>
<property name="message" value="Line ends with whitespace." />
<!-- Instruct Checkstyle to ignore next line -->
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="@Checkstyle:ignore" />
<property name="influenceFormat" value="1" />
</module>

<module name="TreeWalker">
<property name="cacheFile" value="${basedir}/.checkstyle-cache/opends-checkstyle.cache" />

<module name="FileContentsHolder"/>

<!-- Ensure that all classes and interfaces are documented -->
<!-- Ensure that all non-private classes and interfaces are documented -->
<module name="JavadocType">
<property name="scope" value="private" />
<property name="scope" value="protected" />
</module>


<!-- Ensure that all non-private methods are documented -->
<module name="JavadocMethod">
<property name="scope" value="protected" />
<property name="allowUndeclaredRTE" value="true" />
<property name="allowMissingParamTags" value="false" />
<property name="allowMissingJavadoc" value="false" />
<property name="accessModifiers" value="public,protected" />
</module>


<!-- Ensure that all public and protected fields are documented -->
<module name="JavadocVariable">
<property name="scope" value="protected" />
</module>


<!-- Ensure that all Javadoc comments are well-formed -->
<module name="JavadocStyle">
<property name="scope" value="protected" />
Expand All @@ -99,12 +100,6 @@
<property name="checkHtml" value="true" />
</module>


<!-- Ensure that no line exceeds 120 characters in length -->
<module name="LineLength">
<property name="max" value="120" />
</module>

<!-- Check for string == rather than .equals checks -->
<module name="StringLiteralEquality" />

Expand All @@ -113,27 +108,22 @@
implements .hashCode() -->
<module name="EqualsHashCode" />


<!-- Make sure that all classes have a package statement -->
<module name="PackageDeclaration" />


<!-- Identify any switch statements with fall-through -->
<module name="FallThrough" />


<!-- Make sure that long constants are defined with an uppercase L -->
<module name="UpperEll" />


<!-- Perform basic validation on imports -->
<module name="RedundantImport" />
<module name="UnusedImports" />
<module name="IllegalImport">
<property name="illegalPkgs" value="sun" />
</module>


<!-- As per Sun conventions -->
<!-- Use braces for with all control flow statements -->
<module name="NeedBraces" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<suppress checks="JavadocMethod" files="/src/test/java" />
<suppress checks="JavadocVariable" files="/src/test/java" />
<suppress checks="JavadocStyle" files="/src/test/java" />
<suppress checks="LineLength" files="/src/test/java" />
<!--
<suppress checks="ModifierOrder" files="/src/test/java" />
<suppress checks="RedundantModifier" files="/src/test/java" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import org.opends.server.types.Entry;
import org.opends.server.types.Modification;
import org.opends.server.types.operation.PreOperationModifyOperation;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.ldap.DN;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@
</opendj.osgi.import>

<!-- Override Checkstyle versions to avoid unnecessary errors -->
<checkstylePluginVersion>2.9.1</checkstylePluginVersion>
<checkstyleVersion>5.5</checkstyleVersion>
<!-- <checkstylePluginVersion>2.9.1</checkstylePluginVersion>-->
<!-- <checkstyleVersion>5.5</checkstyleVersion>-->
</properties>

<dependencyManagement>
Expand Down

0 comments on commit fcf9943

Please sign in to comment.