Skip to content

Commit e348042

Browse files
ginoaugustinevladak
authored andcommitted
Upgrade checkstyle and add new rules
Signed-off-by: Gino Augustine <[email protected]>
1 parent 8dfcae7 commit e348042

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+193
-138
lines changed

dev/checkstyle/style.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@
2525
</module>
2626

2727
<module name="TreeWalker">
28+
<module name="InvalidJavadocPosition"/>
2829
<module name="JavadocStyle"/>
30+
<module name="AtclauseOrder"/>
31+
<module name="MissingJavadocType">
32+
<property name="tokens"
33+
value="INTERFACE_DEF, ENUM_DEF,
34+
RECORD_DEF, ANNOTATION_DEF"/>
35+
</module>
2936
<module name="AvoidStarImport"/>
3037
<module name="RedundantImport"/>
3138
<module name="UnusedImports"/>

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/PathTokenizer.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ public final boolean incrementToken() throws IOException {
9292
if (i >= buf.length) {
9393
buf = Arrays.copyOf(buf, buf.length * 2);
9494
}
95-
/**
96-
* "In general, String.toLowerCase(Locale) should be used to map
97-
* characters to lowercase. String case mapping methods have several
98-
* benefits over Character case mapping methods. String case mapping
99-
* methods can perform locale-sensitive mappings, context-sensitive
100-
* mappings, and 1:M character mappings, whereas the Character case
101-
* mapping methods cannot." See below.
95+
/*
96+
"In general, String.toLowerCase(Locale) should be used to map
97+
characters to lowercase. String case mapping methods have several
98+
benefits over Character case mapping methods. String case mapping
99+
methods can perform locale-sensitive mappings, context-sensitive
100+
mappings, and 1:M character mappings, whereas the Character case
101+
mapping methods cannot." See below.
102102
*/
103103
buf[i++] = (char) c;
104104
c = input.read();

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/uue/UuencodeAnalyzerFactory.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ public class UuencodeAnalyzerFactory extends FileAnalyzerFactory {
3535
private static final String NAME = "UUEncoded";
3636

3737
private static final String[] SUFFIXES = {
38-
/**
39-
* XXX:
40-
* FreeBSD and DragonFly .fnt files are uuencoded;
41-
* Minix3 .fnt files are binary. -- 2013-04 cnst
42-
*/
38+
/*
39+
XXX:
40+
FreeBSD and DragonFly .fnt files are uuencoded;
41+
Minix3 .fnt files are binary. -- 2013-04 cnst
42+
*/
4343
"UU", "UUE", /*"FNT",*/ "BASE64"
4444
};
4545

opengrok-indexer/src/main/java/org/opengrok/indexer/authorization/AuthorizationEntity.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -420,13 +420,13 @@ protected void processTargetGroupsAndProjects() {
420420
Set<String> groups = new TreeSet<>();
421421

422422
for (String x : forGroups()) {
423-
/**
424-
* Full group discovery takes place here. All projects/repositories
425-
* in the group are added into "forProjects" and all subgroups
426-
* (including projects/repositories) and parent groups (excluding
427-
* the projects/repositories) are added into "forGroups".
428-
*
429-
* If the group does not exist then a warning is issued.
423+
/*
424+
Full group discovery takes place here. All projects/repositories
425+
in the group are added into "forProjects" and all subgroups
426+
(including projects/repositories) and parent groups (excluding
427+
the projects/repositories) are added into "forGroups".
428+
429+
If the group does not exist then a warning is issued.
430430
*/
431431
Group g;
432432
if ((g = Group.getByName(x)) != null) {
@@ -442,9 +442,9 @@ protected void processTargetGroupsAndProjects() {
442442
setForGroups(groups);
443443

444444
forProjects().removeIf(t -> {
445-
/**
446-
* Check the existence of the projects and issue a warning if there
447-
* is no such project.
445+
/*
446+
Check the existence of the projects and issue a warning if there
447+
is no such project.
448448
*/
449449
if ( Project.getByName(t) == null) {
450450
LOGGER.log(Level.WARNING, "Configured project \"{0}\" in forProjects"
@@ -474,8 +474,7 @@ public synchronized void setWorking() {
474474

475475
/**
476476
* Check if this plugin has failed during loading or is missing.
477-
*
478-
* This method has the same effect as !{@link isWorking()}.
477+
* This method has the same effect as !{@link #isWorking()}.
479478
*
480479
* @return true if failed, true otherwise
481480
* @see #isWorking()

opengrok-indexer/src/main/java/org/opengrok/indexer/authorization/AuthorizationPlugin.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,12 @@ public synchronized void unload() {
171171
public boolean isAllowed(Nameable entity,
172172
AuthorizationEntity.PluginDecisionPredicate pluginPredicate,
173173
AuthorizationEntity.PluginSkippingPredicate skippingPredicate) {
174-
/**
175-
* We don't check the skippingPredicate here as this instance is
176-
* <b>always</b> a part of some stack (may be the default stack) and the
177-
* stack checks the skipping predicate before invoking this method.
178-
*
179-
* @see AuthorizationStack#processStack
174+
/*
175+
We don't check the skippingPredicate here as this instance is
176+
<b>always</b> a part of some stack (may be the default stack) and the
177+
stack checks the skipping predicate before invoking this method.
178+
179+
@see AuthorizationStack#processStack
180180
*/
181181

182182
if (isFailed()) {
@@ -205,14 +205,14 @@ public boolean setPlugin(IAuthorizationPlugin plugin) {
205205
unload();
206206
}
207207
try {
208-
/**
209-
* The exception should not happen here as we already have an
210-
* instance of IAuthorizationPlugin. But it is required by the
211-
* compiler.
212-
*
213-
* NOTE: If we were to add a throws clause here we would interrupt
214-
* the whole stack walk through and prevent the other authorization
215-
* entities to work properly.
208+
/*
209+
The exception should not happen here as we already have an
210+
instance of IAuthorizationPlugin. But it is required by the
211+
compiler.
212+
213+
NOTE: If we were to add a throws clause here we would interrupt
214+
the whole stack walk through and prevent the other authorization
215+
entities to work properly.
216216
*/
217217
this.plugin = plugin.getClass().getDeclaredConstructor().newInstance();
218218
return true;

opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/CommandTimeoutType.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
*/
2323
package org.opengrok.indexer.configuration;
2424

25+
/**
26+
* Command Time Out Type.
27+
* Different time out config valid are present for each
28+
* command type.
29+
*/
2530
public enum CommandTimeoutType {
2631
INTERACTIVE,
2732
INDEXER,

opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/Configuration.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -642,19 +642,18 @@ public Map<String, String> getCmds() {
642642
/**
643643
* @return int the current message limit
644644
* @see org.opengrok.indexer.web.messages.MessagesContainer
645-
*
646-
* @return int the current message limit
647645
*/
648646
public int getMessageLimit() {
649647
return messageLimit;
650648
}
651649

652650
/**
653-
* @see org.opengrok.indexer.web.messages.MessagesContainer
654651
*
655652
* @param messageLimit the limit
656653
* @throws IllegalArgumentException when the limit is negative
654+
* @see org.opengrok.indexer.web.messages.MessagesContainer
657655
*/
656+
658657
public void setMessageLimit(int messageLimit) throws IllegalArgumentException {
659658
if (messageLimit < 0) {
660659
throw new IllegalArgumentException(
@@ -940,12 +939,10 @@ public String getDataRoot() {
940939

941940
/**
942941
* Sets data root.
943-
*
944942
* This method also sets the pluginDirectory if it is not already set.
945943
*
946-
* @see #setPluginDirectory(java.lang.String)
947-
*
948944
* @param dataRoot data root path
945+
* @see #setPluginDirectory(java.lang.String)
949946
*/
950947
public void setDataRoot(String dataRoot) {
951948
if (dataRoot != null && getPluginDirectory() == null) {

opengrok-indexer/src/main/java/org/opengrok/indexer/history/AnnotationCache.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626

2727
import java.io.File;
2828

29+
/**
30+
* Annotation Cache Related Operations.
31+
*/
2932
public interface AnnotationCache extends Cache {
3033
/**
3134
* Retrieve annotation from cache.

opengrok-indexer/src/main/java/org/opengrok/indexer/history/Cache.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
import java.util.List;
3030
import java.util.logging.Logger;
3131

32+
/**
33+
* Cache interface for common cache related operations.
34+
*/
3235
public interface Cache {
3336

3437
Logger LOGGER = LoggerFactory.getLogger(Cache.class);

opengrok-indexer/src/main/java/org/opengrok/indexer/history/HistoryGuru.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,14 +783,14 @@ public boolean fillLastHistoryEntries(File directory, List<DirectoryEntry> entri
783783

784784
/**
785785
* Recursively search for repositories with a depth limit, add those found to the internally used map.
786-
* @see #putRepository(Repository)
787786
*
788787
* @param files list of directories to check if they contain a repository
789788
* @param allowedNesting number of levels of nested repos to allow
790789
* @param depth maximum scanning depth
791790
* @param isNested a value indicating if a parent {@link Repository} was already found above the {@code files}
792791
* @param progress {@link org.opengrok.indexer.util.Progress} instance
793792
* @return collection of added repositories
793+
* @see #putRepository(Repository)
794794
*/
795795
private Collection<RepositoryInfo> addRepositories(File[] files, int allowedNesting, int depth, boolean isNested,
796796
Progress progress) {

0 commit comments

Comments
 (0)