Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
Lucene.Net 3.0.3
-
None
-
None
Description
I have found several issues by analyzing Lucene.Net with PVS-Studio static analyzer.
1. V3035 Consider inspecting the 'substCount =+ 2' expression. Probably '+=' should be used here. Contrib.Analyzers GermanStemmer.cs 224
2. V3020 An unconditional 'return' within a loop. Contrib.Analyzers NGramTokenFilter.cs 109
Possible if statement should be used here instead of while
while (curPos + curGramSize <= curTermLength)
{ // while there is input
ClearAttributes();
termAtt.SetTermBuffer(curTermBuffer, curPos, curGramSize);
offsetAtt.SetOffset(tokStart + curPos, tokStart + curPos + curGramSize);
curPos++;
return true;
}
3. V3021 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains method return. This means that the second 'if' statement is senseless Contrib.Analyzers BrazilianStemmer.cs 1153
if (suffix(RV, "iu"))
{
CT = removeSuffix(CT, "iu"); return true;
}
if (suffix(RV, "iu"))
{
CT = removeSuffix(CT, "iu"); return true;
}
4. V3022 Expression 'side == null' is always false. Contrib.Analyzers EdgeNGramTokenizer.cs 147
Because side is a enum
5. V3029 The conditional expressions of the 'if' operators situated alongside each other are identical. Check lines: 517, 523. Lucene.Net QueryParserTokenManager.cs 517
Maybe JjCanMove_1 should be used here?