Skip to content

Commit 0e4c555

Browse files
ahornaceVladimir Kotal
authored andcommitted
Add check for trailing spaces
1 parent 917059f commit 0e4c555

File tree

155 files changed

+587
-597
lines changed

Some content is hidden

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

155 files changed

+587
-597
lines changed

dev/checkstyle/style.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
<module name="FileLength"/>
1414
<module name="FileTabCharacter"/>
1515

16+
<module name="RegexpSingleline">
17+
<property name="format" value="\s+$"/>
18+
<property name="minimum" value="0"/>
19+
<property name="maximum" value="0"/>
20+
<property name="message" value="Line has trailing spaces."/>
21+
</module>
22+
1623
<module name="LineLength">
1724
<property name="max" value="150"/>
1825
</module>

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public class AnalyzerGuru {
216216
* List of all registered {@code FileAnalyzerFactory} instances.
217217
*/
218218
private static final List<AnalyzerFactory> factories = new ArrayList<>();
219-
219+
220220
/**
221221
* Names of all analysis packages.
222222
*/
@@ -768,35 +768,35 @@ public static AnalyzerFactory findByFileTypeName(String fileTypeName) {
768768
* @throws InvocationTargetException if the underlying constructor throws an exception
769769
*/
770770
public static AnalyzerFactory findFactory(String factoryClassName)
771-
throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException,
771+
throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException,
772772
InvocationTargetException {
773773
Class<?> fcn;
774774
try {
775775
fcn = Class.forName(factoryClassName);
776-
776+
777777
} catch (ClassNotFoundException e) {
778778
fcn = getFactoryClass(factoryClassName);
779-
779+
780780
if (fcn == null) {
781781
throw new ClassNotFoundException("Unable to locate class " + factoryClassName);
782782
}
783783
}
784-
784+
785785
return findFactory(fcn);
786786
}
787787

788788
/**
789789
* Get Analyzer factory class using class simple name.
790-
*
790+
*
791791
* @param simpleName which may be either the factory class
792792
* simple name (eg. CAnalyzerFactory), the analyzer name
793793
* (eg. CAnalyzer), or the language name (eg. C)
794-
*
794+
*
795795
* @return the analyzer factory class, or null when not found.
796796
*/
797797
public static Class<?> getFactoryClass(String simpleName) {
798798
Class<?> factoryClass = null;
799-
799+
800800
// Build analysis package name list first time only
801801
if (analysisPkgNames.isEmpty()) {
802802
Package[] p = Package.getPackages();
@@ -807,17 +807,17 @@ public static Class<?> getFactoryClass(String simpleName) {
807807
}
808808
}
809809
}
810-
810+
811811
// This allows user to enter the language or analyzer name
812812
// (eg. C or CAnalyzer vs. CAnalyzerFactory)
813813
// Note that this assumes a regular naming scheme of
814-
// all language parsers:
814+
// all language parsers:
815815
// <language>Analyzer, <language>AnalyzerFactory
816-
816+
817817
if (!simpleName.contains("Analyzer")) {
818818
simpleName += "Analyzer";
819819
}
820-
820+
821821
if (!simpleName.contains("Factory")) {
822822
simpleName += "Factory";
823823
}
@@ -831,10 +831,10 @@ public static Class<?> getFactoryClass(String simpleName) {
831831
// Ignore
832832
}
833833
}
834-
834+
835835
return factoryClass;
836836
}
837-
837+
838838
/**
839839
* Find a {@code FileAnalyzerFactory} which is an instance of the specified
840840
* class. If one doesn't exist, create one and register it.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ protected TokenStreamComponents createComponents(String fieldName) {
185185
try (HistoryAnalyzer historyAnalyzer = new HistoryAnalyzer()) {
186186
return historyAnalyzer.createComponents(fieldName);
187187
}
188-
//below is set by PlainAnalyzer to workaround #1376 symbols search works like full text search
188+
//below is set by PlainAnalyzer to workaround #1376 symbols search works like full text search
189189
case QueryBuilder.REFS: {
190190
return new TokenStreamComponents(symbolTokenizerFactory.get());
191191
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,26 @@ public HistoryAnalyzer() {
5353
super(Analyzer.PER_FIELD_REUSE_STRATEGY);
5454
stopWords = StopFilter.makeStopSet(ENGLISH_STOP_WORDS);
5555
}
56-
56+
5757
/**
5858
* Creates components using a new {@link PlainFullTokenizer}, filtered using
5959
* a default set of English stop-words.
60-
* @param fieldName name of field for which to create components
60+
* @param fieldName name of field for which to create components
6161
* @return components for this analyzer (NB safe to use even if this
6262
* analyzer were to be garbage-collected)
6363
*/
6464
@Override
65-
protected TokenStreamComponents createComponents(String fieldName) {
65+
protected TokenStreamComponents createComponents(String fieldName) {
6666
JFlexTokenizer plainfull = new JFlexTokenizer(new PlainFullTokenizer(
6767
AbstractAnalyzer.DUMMY_READER));
6868
//we are counting position increments, this might affect the queries
6969
//later and need to be in sync, especially for highlighting of results
7070
return new TokenStreamComponents(plainfull, new StopFilter(plainfull,
7171
stopWords));
7272
}
73-
73+
7474
@Override
75-
protected TokenStream normalize(String fieldName, TokenStream in) {
75+
protected TokenStream normalize(String fieldName, TokenStream in) {
7676
return new LowerCaseFilter(in);
77-
}
77+
}
7878
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ protected boolean writeSymbol(String symbol, Set<String> keywords, int line,
465465
boolean caseSensitive) throws IOException {
466466
return writeSymbol(symbol, keywords, line, caseSensitive, false);
467467
}
468-
468+
469469
/**
470470
* Write a symbol and generate links as appropriate.
471471
*

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
*/
5050
public class PathTokenizer extends Tokenizer {
5151

52-
// below should be '/' since we try to convert even windows file separators
52+
// below should be '/' since we try to convert even windows file separators
5353
// to unix ones
5454
public static final char DEFAULT_DELIMITER = '/';
5555
private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@
3232
*/
3333
public class AdaAnalyzerFactory extends FileAnalyzerFactory {
3434

35-
private static final String name = "Ada";
36-
35+
private static final String NAME = "Ada";
36+
3737
private static final String[] SUFFIXES = {
3838
"ADA",
3939
"ADB",
4040
"ADS"
4141
};
4242

4343
public AdaAnalyzerFactory() {
44-
super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name);
44+
super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, NAME);
4545
}
4646

4747
@Override

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public class Consts {
104104
kwd.add("while");
105105
kwd.add("with");
106106
kwd.add("xor");
107-
107+
108108
kwd.add("ascii"); // A.1 The Package Standard
109109
kwd.add("base"); // A.1 The Package Standard
110110
kwd.add("boolean"); // A.1 The Package Standard

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/BZip2Analyzer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,5 +127,5 @@ public InputStream getStream() throws IOException {
127127
}
128128
}
129129
};
130-
}
130+
}
131131
}

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/BZip2AnalyzerFactory.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
import org.opengrok.indexer.analysis.FileAnalyzerFactory;
2727

2828
public class BZip2AnalyzerFactory extends FileAnalyzerFactory {
29-
30-
private static final String name = "Bzip(2)";
31-
29+
30+
private static final String NAME = "Bzip(2)";
31+
3232
private static final String[] SUFFIXES = {
3333
"BZ", "BZ2"
3434
};
@@ -38,7 +38,7 @@ public class BZip2AnalyzerFactory extends FileAnalyzerFactory {
3838
};
3939

4040
public BZip2AnalyzerFactory() {
41-
super(null, null, SUFFIXES, MAGICS, null, null, null, name);
41+
super(null, null, SUFFIXES, MAGICS, null, null, null, NAME);
4242
}
4343

4444
@Override

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/GZIPAnalyzer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,5 +132,5 @@ public InputStream getStream() throws IOException {
132132
new GZIPInputStream(src.getStream()));
133133
}
134134
};
135-
}
135+
}
136136
}

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/GZIPAnalyzerFactory.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
import org.opengrok.indexer.analysis.FileAnalyzerFactory;
2727

2828
public class GZIPAnalyzerFactory extends FileAnalyzerFactory {
29-
30-
private static final String name = "GZIP";
31-
29+
30+
private static final String NAME = "GZIP";
31+
3232
private static final String[] SUFFIXES = {
3333
"GZ"
3434
};
@@ -38,7 +38,7 @@ public class GZIPAnalyzerFactory extends FileAnalyzerFactory {
3838
};
3939

4040
public GZIPAnalyzerFactory() {
41-
super(null, null, SUFFIXES, MAGICS, null, null, null, name);
41+
super(null, null, SUFFIXES, MAGICS, null, null, null, NAME);
4242
}
4343

4444
@Override

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/TarAnalyzerFactory.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@
2626
import org.opengrok.indexer.analysis.FileAnalyzerFactory;
2727

2828
public class TarAnalyzerFactory extends FileAnalyzerFactory {
29-
30-
private static final String name = "Tar";
31-
29+
30+
private static final String NAME = "Tar";
31+
3232
private static final String[] SUFFIXES = {
3333
"TAR"
3434
};
3535

3636
public TarAnalyzerFactory() {
37-
super(null, null, SUFFIXES, null, null, null, AbstractAnalyzer.Genre.XREFABLE, name);
37+
super(null, null, SUFFIXES, null, null, null, AbstractAnalyzer.Genre.XREFABLE, NAME);
3838
}
3939

4040
@Override

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/ZipAnalyzerFactory.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
import org.opengrok.indexer.analysis.FileAnalyzerFactory;
2929

3030
public final class ZipAnalyzerFactory extends FileAnalyzerFactory {
31-
32-
private static final String name = "Zip";
33-
31+
32+
private static final String NAME = "Zip";
33+
3434
private static final String[] SUFFIXES = {
3535
"ZIP"
3636
};
@@ -57,7 +57,7 @@ protected boolean doesCheckExtraFieldID() {
5757
new ZipAnalyzerFactory();
5858

5959
private ZipAnalyzerFactory() {
60-
super(null, null, SUFFIXES, null, MATCHER, null, AbstractAnalyzer.Genre.XREFABLE, name);
60+
super(null, null, SUFFIXES, null, MATCHER, null, AbstractAnalyzer.Genre.XREFABLE, NAME);
6161
}
6262

6363
@Override

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CAnalyzer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ protected int getSpecializedVersionNo() {
7676
protected JFlexXref newXref(Reader reader) {
7777
return new JFlexXref(new CXref(reader));
7878
}
79-
79+
8080
@Override
8181
protected boolean supportsScopes() {
8282
return true;

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CAnalyzerFactory.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
import org.opengrok.indexer.analysis.FileAnalyzerFactory;
2828

2929
public class CAnalyzerFactory extends FileAnalyzerFactory {
30-
31-
private static final String name = "C";
32-
30+
31+
private static final String NAME = "C";
32+
3333
private static final String[] SUFFIXES = {
3434
"C",
3535
"H",
@@ -44,7 +44,7 @@ public class CAnalyzerFactory extends FileAnalyzerFactory {
4444
};
4545

4646
public CAnalyzerFactory() {
47-
super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name);
47+
super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, NAME);
4848
}
4949

5050
@Override

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CxxAnalyzer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected int getSpecializedVersionNo() {
7474
protected JFlexXref newXref(Reader reader) {
7575
return new JFlexXref(new CxxXref(reader));
7676
}
77-
77+
7878
@Override
7979
protected boolean supportsScopes() {
8080
return true;

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/clojure/ClojureAnalyzerFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
public class ClojureAnalyzerFactory extends FileAnalyzerFactory {
2929

30-
private static final String name = "Clojure";
30+
private static final String NAME = "Clojure";
3131

3232
private static final String[] SUFFIXES = {
3333
"CLJ",
@@ -36,7 +36,7 @@ public class ClojureAnalyzerFactory extends FileAnalyzerFactory {
3636
};
3737

3838
public ClojureAnalyzerFactory() {
39-
super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name);
39+
super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, NAME);
4040
}
4141

4242
@Override

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/csharp/CSharpAnalyzer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected int getSpecializedVersionNo() {
6969
protected JFlexXref newXref(Reader reader) {
7070
return new JFlexXref(new CSharpXref(reader));
7171
}
72-
72+
7373
@Override
7474
protected boolean supportsScopes() {
7575
return true;

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/csharp/CSharpAnalyzerFactory.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
import org.opengrok.indexer.analysis.FileAnalyzerFactory;
2828

2929
public class CSharpAnalyzerFactory extends FileAnalyzerFactory {
30-
31-
private static final String name = "C#";
32-
30+
31+
private static final String NAME = "C#";
32+
3333
private static final String[] SUFFIXES = {
3434
"CS"
3535
};
3636

3737
public CSharpAnalyzerFactory() {
38-
super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name);
38+
super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, NAME);
3939
}
4040

4141
@Override

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/data/IgnorantAnalyzerFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class IgnorantAnalyzerFactory extends FileAnalyzerFactory {
4141
"%PDF",
4242
"Microsoft C/C++ MSF ", // PDB files: https://msdn.microsoft.com/en-us/library/yd4f8bd1(vs.71).aspx
4343
"!<arch>", // LIB files: https://msdn.microsoft.com/en-us/library/ba1z7822.aspx
44-
44+
4545
};
4646

4747
public IgnorantAnalyzerFactory() {

0 commit comments

Comments
 (0)