Skip to content

Commit d1e826f

Browse files
ahornaceVladimir Kotal
authored andcommitted
Add more CheckStyle rules
1 parent 7bd863c commit d1e826f

File tree

78 files changed

+243
-324
lines changed

Some content is hidden

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

78 files changed

+243
-324
lines changed

dev/checkstyle/style.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,14 @@
3232
<property name="offCommentFormat" value="&lt;editor-fold defaultstate=&quot;collapsed&quot; desc=&quot;Generated Code&quot;&gt;"/>
3333
<property name="onCommentFormat" value="&lt;/editor-fold&gt;"/>
3434
</module>
35+
36+
<module name="ModifierOrder"/>
37+
<module name="RedundantModifier"/>
38+
39+
<module name="SimplifyBooleanExpression"/>
40+
<module name="SimplifyBooleanReturn"/>
41+
42+
<module name="ArrayTypeStyle"/>
43+
<module name="UpperEll"/>
3544
</module>
3645
</module>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ private static List<MappedFactory> byFactory(
219219
private static class MappedFactory {
220220
public final String key;
221221
public final FileAnalyzerFactory fac;
222-
public MappedFactory(String key, FileAnalyzerFactory fac) {
222+
MappedFactory(String key, FileAnalyzerFactory fac) {
223223
this.key = key;
224224
this.fac = fac;
225225
}

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2017-2018, Chris Fraire <cfraire@me.com>.
2323
*/
2424

@@ -796,15 +796,14 @@ private static class CpatIndex {
796796
public final int lineEnd;
797797
public final boolean imprecise;
798798

799-
public CpatIndex(int lineno, int lineStart, int lineEnd) {
799+
CpatIndex(int lineno, int lineStart, int lineEnd) {
800800
this.lineno = lineno;
801801
this.lineStart = lineStart;
802802
this.lineEnd = lineEnd;
803803
this.imprecise = false;
804804
}
805805

806-
public CpatIndex(int lineno, int lineStart, int lineEnd,
807-
boolean imprecise) {
806+
CpatIndex(int lineno, int lineStart, int lineEnd, boolean imprecise) {
808807
this.lineno = lineno;
809808
this.lineStart = lineStart;
810809
this.lineEnd = lineEnd;
@@ -821,7 +820,7 @@ private static class PatResult {
821820
public final int end;
822821
public final String capture;
823822

824-
public PatResult(int start, int end, String capture) {
823+
PatResult(int start, int end, String capture) {
825824
this.start = start;
826825
this.end = end;
827826
this.capture = capture;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
2222
* Use is subject to license terms.
2323
* Portions Copyright (c) 2017-2018, Chris Fraire <cfraire@me.com>.
2424
*/
@@ -72,7 +72,7 @@ public class FileAnalyzer extends Analyzer {
7272
/**
7373
* What kind of file is this?
7474
*/
75-
public static enum Genre {
75+
public enum Genre {
7676
/**
7777
* xrefed - line numbered context
7878
*/
@@ -95,7 +95,7 @@ public static enum Genre {
9595
HTML("h");
9696
private final String typeName;
9797

98-
private Genre(String typename) {
98+
Genre(String typename) {
9999
this.typeName = typename;
100100
}
101101

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright 2011 Jens Elkner.
2323
* Portions Copyright (c) 2017-2018, Chris Fraire <cfraire@me.com>.
2424
*/
@@ -43,7 +43,7 @@ public class JFlexXref implements Xrefer, SymbolMatchedListener,
4343
* Used to indicate pre-formatted output with
4444
* {@link Util#htmlize(java.lang.CharSequence, java.lang.Appendable, boolean)}
4545
*/
46-
private final static boolean PRE = true;
46+
private static final boolean PRE = true;
4747

4848
private final ScanningSymbolMatcher matcher;
4949
private Writer out;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2018, Chris Fraire <cfraire@me.com>.
2323
*/
2424
package org.opengrok.indexer.analysis;
@@ -77,7 +77,7 @@ public final boolean incrementToken() throws IOException {
7777
return true;
7878
}
7979

80-
char buf[] = new char[64];
80+
char[] buf = new char[64];
8181
int c;
8282
int i = 0;
8383
do {

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ada/AdaLexHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class AdaLexHelper implements Resettable {
4242

4343
private final int SCOMMENT;
4444

45-
public AdaLexHelper(int sCOMMENT, AdaLexer lexer) {
45+
AdaLexHelper(int sCOMMENT, AdaLexer lexer) {
4646
if (lexer == null) {
4747
throw new IllegalArgumentException("`lexer' is null");
4848
}

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/MandocRunner.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
2222
* Copyright (c) 2017-2018, Chris Fraire <cfraire@me.com>.
2323
* (derived from Ctags.java).
2424
*/
@@ -122,8 +122,7 @@ public void start() throws IOException, MandocException {
122122

123123
errThread = new Thread(() -> {
124124
// implicitly capture `errorStream' for the InputStreamReader
125-
try (final BufferedReader error = new BufferedReader(
126-
new InputStreamReader(errorStream, StandardCharsets.UTF_8))) {
125+
try (BufferedReader error = new BufferedReader(new InputStreamReader(errorStream, StandardCharsets.UTF_8))) {
127126
String s;
128127
while ((s = error.readLine()) != null) {
129128
LOGGER.log(Level.WARNING, "Error from mandoc: {0}", s);

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/eiffel/EiffelLexHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class EiffelLexHelper implements Resettable {
4949
*/
5050
private String vstring_closer;
5151

52-
public EiffelLexHelper(int vSTRING, int sCOMMENT, EiffelLexer lexer) {
52+
EiffelLexHelper(int vSTRING, int sCOMMENT, EiffelLexer lexer) {
5353
if (lexer == null) {
5454
throw new IllegalArgumentException("`lexer' is null");
5555
}

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/ELFAnalyzer.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2018, Chris Fraire <cfraire@me.com>.
2323
*/
2424
package org.opengrok.indexer.analysis.executables;
@@ -209,7 +209,7 @@ private static class ELFHeader {
209209
public int e_shnum;
210210
public int e_shstrndx;
211211

212-
public ELFHeader(MappedByteBuffer fmap) throws IllegalArgumentException {
212+
ELFHeader(MappedByteBuffer fmap) throws IllegalArgumentException {
213213
if (fmap.get(ELFIdentification.EI_MAG0.value()) != 0x7f ||
214214
fmap.get(ELFIdentification.EI_MAG1.value()) != 'E' ||
215215
fmap.get(ELFIdentification.EI_MAG2.value()) != 'L' ||
@@ -291,7 +291,7 @@ private static class ELFSection {
291291
public int sh_addralign;
292292
public int sh_entsize;
293293

294-
public ELFSection(MappedByteBuffer fmap) {
294+
ELFSection(MappedByteBuffer fmap) {
295295
sh_name = fmap.getInt();
296296
sh_type = fmap.getInt();
297297
sh_flags = fmap.getInt();
@@ -310,7 +310,7 @@ public String toString() {
310310
}
311311
}
312312

313-
private static enum ELFIdentification {
313+
private enum ELFIdentification {
314314

315315
EI_MAG0(0),
316316
EI_MAG1(1),
@@ -323,7 +323,7 @@ private static enum ELFIdentification {
323323
EI_NIDENT(16);
324324
private final int value;
325325

326-
private ELFIdentification(int value) {
326+
ELFIdentification(int value) {
327327
this.value = value;
328328
}
329329

@@ -332,7 +332,7 @@ public int value() {
332332
}
333333
}
334334

335-
private static enum EI_Class {
335+
private enum EI_Class {
336336
ELFCLASSNONE(0),
337337
ELFCLASS32(1),
338338
ELFCLASS64(2);
@@ -343,7 +343,7 @@ private static enum EI_Class {
343343

344344
private final int value;
345345

346-
private EI_Class(int value) {
346+
EI_Class(int value) {
347347
this.value = value;
348348
}
349349

@@ -367,14 +367,14 @@ public String toString() {
367367
}
368368
}
369369

370-
private static enum EI_Data {
370+
private enum EI_Data {
371371
ELFDATANONE(0),
372372
ELFDATA2LSB(1),
373373
ELFDATA2MSB(2);
374374

375375
private final int value;
376376

377-
private EI_Data(int value) {
377+
EI_Data(int value) {
378378
this.value = value;
379379
}
380380

@@ -393,7 +393,7 @@ public int value() {
393393
}
394394
}
395395

396-
private static enum E_Type {
396+
private enum E_Type {
397397
ET_NONE(0),
398398
ET_REL(1),
399399
ET_EXEC(2),
@@ -407,7 +407,7 @@ private static enum E_Type {
407407

408408
private final int value;
409409

410-
private E_Type(int value) {
410+
E_Type(int value) {
411411
this.value = value;
412412
}
413413

@@ -436,7 +436,7 @@ public String toString() {
436436
}
437437
}
438438

439-
private static enum E_Machine {
439+
private enum E_Machine {
440440
EM_NONE(0),
441441
EM_M32(1),
442442
EM_SPARC(2),
@@ -455,7 +455,7 @@ private static enum E_Machine {
455455

456456
private final int value;
457457

458-
private E_Machine(int value) {
458+
E_Machine(int value) {
459459
this.value = value;
460460
}
461461

@@ -487,7 +487,7 @@ public String toString() {
487487
}
488488
}
489489

490-
private static enum E_Version {
490+
private enum E_Version {
491491
EV_NONE(0),
492492
EV_CURRENT(1);
493493

@@ -497,7 +497,7 @@ private static enum E_Version {
497497

498498
private final int value;
499499

500-
private E_Version(int value) {
500+
E_Version(int value) {
501501
this.value = value;
502502
}
503503

0 commit comments

Comments
 (0)