Skip to content

Commit 2ce4a75

Browse files
author
Vladimir Kotal
authored
fix Sonar issues in CtagsReader (#3805)
* fix Sonar issue * tidy up variable declarations
1 parent 319b1c2 commit 2ce4a75

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,23 +126,21 @@ public enum tagFields {
126126
* <p>TODO:
127127
* <p>NOTE this is a big tradeoff in terms of input data, e.g. field
128128
* "find" will be considered "file" and overwrite the value, so if
129-
* ctags will send us buggy input. We will output buggy data TOO! NO
130-
* VALIDATION happens of input - but then we gain LOTS of speed, due to
129+
* ctags will send us buggy input, we will output buggy data TOO!
130+
* NO VALIDATION happens of input - but then we gain LOTS of speed, due to
131131
* not comparing the same field names again and again fully.
132132
*/
133-
public static int charCmpEndOffset = 0;
133+
private static final int CHAR_CMP_END_OFFSET = 0;
134134

135135
/**
136136
* Quickly get if the field name matches allowed/consumed ones.
137137
* @param fullName the name to look up
138138
* @return a defined value, or null if unmatched
139139
*/
140140
public static CtagsReader.tagFields quickValueOf(String fullName) {
141-
int i;
142-
boolean match;
143141
for (tagFields x : tagFields.values()) {
144-
match = true;
145-
for (i = 0; i <= charCmpEndOffset; i++) {
142+
boolean match = true;
143+
for (int i = 0; i <= CHAR_CMP_END_OFFSET; i++) {
146144
if (x.name.charAt(i) != fullName.charAt(i)) {
147145
match = false;
148146
break;

0 commit comments

Comments
 (0)