Skip to content

Commit

Permalink
changes made for Redundant jump statements #684 (#724)
Browse files Browse the repository at this point in the history
* changes made for Redundant jump statements (fixes #684)

* Added review comments.

* Updated changes.

* Update DocumentDictionary.cs
  • Loading branch information
sachdevlaksh authored Oct 28, 2022
1 parent 3f54dce commit 22cac25
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ private void Step4()
if (Suffix(RV, "o"))
{
CT = RemoveSuffix(CT, "o");
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}

}
Expand Down Expand Up @@ -1376,7 +1376,7 @@ private void Step5()
}

CT = RemoveSuffix(CT, "e");
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}
}

Expand Down
32 changes: 16 additions & 16 deletions src/Lucene.Net.Analysis.Common/Analysis/En/KStemmer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ private void Plural()
{
Lookup();
}
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}
else
{
Expand Down Expand Up @@ -872,7 +872,7 @@ private void PastTense()
word.UnsafeWrite('e');
k = j + 1;
// nolookup() - we already tried the "e" ending
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}
}

Expand Down Expand Up @@ -990,7 +990,7 @@ private void Aspect()
word.UnsafeWrite('e');
k = j + 1;
// nolookup(); we already tried an 'e' ending
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}
}

Expand Down Expand Up @@ -1068,7 +1068,7 @@ private void ItyEndings()
word.Length = j + 1;
k = j;
// nolookup(), we already did it.
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}
}

Expand Down Expand Up @@ -1106,7 +1106,7 @@ private void NceEndings()
k = old_k;
// nolookup() because we restored the original ending
}
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}

/// <summary>handle -ness</summary>
Expand All @@ -1126,7 +1126,7 @@ private void NessEndings()
}
Lookup();
}
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}

/// <summary>handle -ism</summary>
Expand All @@ -1142,7 +1142,7 @@ private void IsmEndings()
k = j;
Lookup();
}
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}

/// <summary>this routine deals with -ment endings.</summary>
Expand All @@ -1162,7 +1162,7 @@ private void MentEndings()
k = old_k;
// nolookup
}
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}

/// <summary>this routine deals with -ize endings.</summary>
Expand Down Expand Up @@ -1203,7 +1203,7 @@ private void IzeEndings()
k = old_k;
// nolookup()
}
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}

/// <summary>handle -ency and -ancy</summary>
Expand All @@ -1229,7 +1229,7 @@ private void NcyEndings()
k = j + 3;
Lookup();
}
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}

/// <summary>handle -able and -ible</summary>
Expand Down Expand Up @@ -1283,7 +1283,7 @@ private void BleEndings()
k = old_k;
// nolookup()
}
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}

/// <summary>
Expand Down Expand Up @@ -1327,7 +1327,7 @@ private void IcEndings()
k = j + 2;
// nolookup()
}
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}

private static char[] ization = "ization".ToCharArray();
Expand Down Expand Up @@ -1473,7 +1473,7 @@ private void IonEndings()
}

// nolookup(); all of the other paths restored original values
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}

/// <summary>
Expand Down Expand Up @@ -1647,7 +1647,7 @@ private void LyEndings()
k = j;
// nolookup()... we already tried removing the "ly" variant
}
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}

/// <summary>
Expand Down Expand Up @@ -1744,7 +1744,7 @@ private void AlEndings()
}

}
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}

/// <summary>
Expand Down Expand Up @@ -1804,7 +1804,7 @@ private void IveEndings()
k = old_k;
// nolookup()
}
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}

internal KStemmer()
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemmer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ private void Step3b(StringBuilder sb)
{
sb.Remove(index, index + 3 - index);
}
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net.Suggest/Suggest/DocumentDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public bool MoveNext()
{
if (contextField.GetBinaryValue() is null && contextField.GetStringValue() is null)
{
continue;
//continue; //LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net/Codecs/BlockTreeTermsReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ private void SeekToStartTerm(BytesRef target)
return;
}
}
continue;
//continue; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}
else if (cmp == 0)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net/Codecs/Compressing/CompressionMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public override void Compress(byte[] bytes, int off, int len, DataOutput output)
{
if (Debugging.AssertsEnabled) Debugging.Assert(len == 0, "{0}", len);
output.WriteVInt32(0);
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net/Codecs/Compressing/LZ4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ public static void CompressHC(byte[] src, int srcOff, int srcLen, DataOutput @ou
CopyTo(match2, match1);
CopyTo(match3, match2);

goto search3Continue;
// goto search3Continue; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
search3Continue: ;
}
//search3Break: ; // LUCENENET NOTE: Unreachable
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net/Codecs/MultiLevelSkipListReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public virtual int SkipTo(int target)
{
if (!LoadNextSkip(level))
{
continue;
// continue; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}
}
else
Expand Down
1 change: 0 additions & 1 deletion src/Lucene.Net/Support/IO/FileSupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ public static FileInfo CreateTempFile(string prefix, string suffix, DirectoryInf
catch (IOException e) when (IsFileAlreadyExistsException(e, fileName))
{
// If the error was because the file exists, try again.
continue;
}
}
return new FileInfo(fileName);
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net/Util/Automaton/UTF32ToUTF8.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ private void Build(State start, State end, UTF8Sequence startUTF8, UTF8Sequence
{
// Super degen: just single edge, one UTF8 byte:
start.AddTransition(new Transition(startUTF8.ByteAt(upto), endUTF8.ByteAt(upto), end));
return;
//return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions src/Lucene.Net/Util/Fst/FSTEnum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ protected virtual void DoSeekCeil()
Incr();
arc = m_fst.ReadFirstTargetArc(arc, GetArc(m_upto), m_fstReader);
targetLabel = TargetLabel;
continue;
// continue; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}
else if (low == arc.NumArcs)
{
Expand Down Expand Up @@ -390,7 +390,7 @@ protected virtual void DoSeekFloor()
Incr();
arc = m_fst.ReadFirstTargetArc(arc, GetArc(m_upto), m_fstReader);
targetLabel = TargetLabel;
continue;
// continue; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}
else if (high == -1)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public override string ReadLine()
if (COMMENT_END.IsMatch(line))
{
inComment = false;
continue; // Skip this line
// continue; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
}
}
else
Expand Down

0 comments on commit 22cac25

Please sign in to comment.