lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ilya (JIRA)" <j...@apache.org>
Subject [jira] [Created] (LUCENENET-557) Suspicious code found by PVS-Studio
Date Mon, 14 Mar 2016 14:15:33 GMT
Ilya created LUCENENET-557:
------------------------------

             Summary: Suspicious code found by PVS-Studio
                 Key: LUCENENET-557
                 URL: https://issues.apache.org/jira/browse/LUCENENET-557
             Project: Lucene.Net
          Issue Type: Bug
          Components: Lucene.Net Contrib
    Affects Versions: Lucene.Net 3.0.3
            Reporter: Ilya


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?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message