You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2022/10/28 16:43:20 UTC

[lucenenet] branch master updated: changes made for Redundant jump statements #684 (#724)

This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git


The following commit(s) were added to refs/heads/master by this push:
     new 22cac2587 changes made for Redundant jump statements #684 (#724)
22cac2587 is described below

commit 22cac258732325c5029256ef34ce1640786a01ff
Author: Lakshay Sachdeva <35...@users.noreply.github.com>
AuthorDate: Fri Oct 28 22:13:12 2022 +0530

    changes made for Redundant jump statements #684 (#724)
    
    * changes made for Redundant jump statements (fixes #684)
    
    * Added review comments.
    
    * Updated changes.
    
    * Update DocumentDictionary.cs
---
 .../Analysis/Br/BrazilianStemmer.cs                |  4 +--
 .../Analysis/En/KStemmer.cs                        | 32 +++++++++++-----------
 .../Analysis/Nl/DutchStemmer.cs                    |  2 +-
 .../Suggest/DocumentDictionary.cs                  |  2 +-
 src/Lucene.Net/Codecs/BlockTreeTermsReader.cs      |  2 +-
 .../Codecs/Compressing/CompressionMode.cs          |  2 +-
 src/Lucene.Net/Codecs/Compressing/LZ4.cs           |  2 +-
 src/Lucene.Net/Codecs/MultiLevelSkipListReader.cs  |  2 +-
 src/Lucene.Net/Support/IO/FileSupport.cs           |  1 -
 src/Lucene.Net/Util/Automaton/UTF32ToUTF8.cs       |  2 +-
 src/Lucene.Net/Util/Fst/FSTEnum.cs                 |  4 +--
 .../SourceCode/SourceCodeSectionReader.cs          |  2 +-
 12 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemmer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemmer.cs
index 1fbfca927..86073aee0 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemmer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemmer.cs
@@ -1340,7 +1340,7 @@ namespace Lucene.Net.Analysis.Br
             if (Suffix(RV, "o"))
             {
                 CT = RemoveSuffix(CT, "o");
-                return;
+                //return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
             }
 
         }
@@ -1376,7 +1376,7 @@ namespace Lucene.Net.Analysis.Br
                 }
 
                 CT = RemoveSuffix(CT, "e");
-                return;
+                //return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
             }
         }
 
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/En/KStemmer.cs b/src/Lucene.Net.Analysis.Common/Analysis/En/KStemmer.cs
index 9c224c57a..77281f902 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/En/KStemmer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/En/KStemmer.cs
@@ -722,7 +722,7 @@ namespace Lucene.Net.Analysis.En
                     {
                         Lookup();
                     }
-                    return;
+                    //return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
                 }
                 else
                 {
@@ -872,7 +872,7 @@ namespace Lucene.Net.Analysis.En
                 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
             }
         }
 
@@ -990,7 +990,7 @@ namespace Lucene.Net.Analysis.En
                 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
             }
         }
 
@@ -1068,7 +1068,7 @@ namespace Lucene.Net.Analysis.En
                 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
             }
         }
 
@@ -1106,7 +1106,7 @@ namespace Lucene.Net.Analysis.En
                 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>
@@ -1126,7 +1126,7 @@ namespace Lucene.Net.Analysis.En
                 }
                 Lookup();
             }
-            return;
+            //return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
         }
 
         /// <summary>handle -ism</summary>
@@ -1142,7 +1142,7 @@ namespace Lucene.Net.Analysis.En
                 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>
@@ -1162,7 +1162,7 @@ namespace Lucene.Net.Analysis.En
                 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>
@@ -1203,7 +1203,7 @@ namespace Lucene.Net.Analysis.En
                 k = old_k;
                 // nolookup()
             }
-            return;
+            //return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
         }
 
         /// <summary>handle -ency and -ancy</summary>
@@ -1229,7 +1229,7 @@ namespace Lucene.Net.Analysis.En
                 k = j + 3;
                 Lookup();
             }
-            return;
+            //return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
         }
 
         /// <summary>handle -able and -ible</summary>
@@ -1283,7 +1283,7 @@ namespace Lucene.Net.Analysis.En
                 k = old_k;
                 // nolookup()
             }
-            return;
+            //return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
         }
 
         /// <summary>
@@ -1327,7 +1327,7 @@ namespace Lucene.Net.Analysis.En
                 k = j + 2;
                 // nolookup()
             }
-            return;
+            //return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
         }
 
         private static char[] ization = "ization".ToCharArray();
@@ -1473,7 +1473,7 @@ namespace Lucene.Net.Analysis.En
             }
 
             // nolookup(); all of the other paths restored original values
-            return;
+            //return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
         }
 
         /// <summary>
@@ -1647,7 +1647,7 @@ namespace Lucene.Net.Analysis.En
                 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>
@@ -1744,7 +1744,7 @@ namespace Lucene.Net.Analysis.En
                 }
 
             }
-            return;
+            //return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
         }
 
         /// <summary>
@@ -1804,7 +1804,7 @@ namespace Lucene.Net.Analysis.En
                 k = old_k;
                 // nolookup()
             }
-            return;
+            //return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
         }
 
         internal KStemmer()
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemmer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemmer.cs
index c9193b759..d272a234d 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemmer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemmer.cs
@@ -242,7 +242,7 @@ namespace Lucene.Net.Analysis.Nl
                 {
                     sb.Remove(index, index + 3 - index);
                 }
-                return;
+                //return; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
             }
         }
 
diff --git a/src/Lucene.Net.Suggest/Suggest/DocumentDictionary.cs b/src/Lucene.Net.Suggest/Suggest/DocumentDictionary.cs
index eaf1c746b..a820baae5 100644
--- a/src/Lucene.Net.Suggest/Suggest/DocumentDictionary.cs
+++ b/src/Lucene.Net.Suggest/Suggest/DocumentDictionary.cs
@@ -176,7 +176,7 @@ namespace Lucene.Net.Search.Suggest
                         {
                             if (contextField.GetBinaryValue() is null && contextField.GetStringValue() is null)
                             {
-                                continue;
+                                //continue; //LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
                             }
                             else
                             {
diff --git a/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs b/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs
index bfd1df80b..3fb848c52 100644
--- a/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs
+++ b/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs
@@ -1241,7 +1241,7 @@ namespace Lucene.Net.Codecs
                                             return;
                                         }
                                     }
-                                    continue;
+                                    //continue; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
                                 }
                                 else if (cmp == 0)
                                 {
diff --git a/src/Lucene.Net/Codecs/Compressing/CompressionMode.cs b/src/Lucene.Net/Codecs/Compressing/CompressionMode.cs
index 46ef05032..a92d7dc7a 100644
--- a/src/Lucene.Net/Codecs/Compressing/CompressionMode.cs
+++ b/src/Lucene.Net/Codecs/Compressing/CompressionMode.cs
@@ -265,7 +265,7 @@ namespace Lucene.Net.Codecs.Compressing
                 {
                     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
                 {
diff --git a/src/Lucene.Net/Codecs/Compressing/LZ4.cs b/src/Lucene.Net/Codecs/Compressing/LZ4.cs
index 2e8f68ac1..55f1dbea5 100644
--- a/src/Lucene.Net/Codecs/Compressing/LZ4.cs
+++ b/src/Lucene.Net/Codecs/Compressing/LZ4.cs
@@ -640,7 +640,7 @@ namespace Lucene.Net.Codecs.Compressing
                         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
diff --git a/src/Lucene.Net/Codecs/MultiLevelSkipListReader.cs b/src/Lucene.Net/Codecs/MultiLevelSkipListReader.cs
index baf302a32..a4c24ab2c 100644
--- a/src/Lucene.Net/Codecs/MultiLevelSkipListReader.cs
+++ b/src/Lucene.Net/Codecs/MultiLevelSkipListReader.cs
@@ -159,7 +159,7 @@ namespace Lucene.Net.Codecs
                 {
                     if (!LoadNextSkip(level))
                     {
-                        continue;
+                        // continue; // LUCENENET: Removed redundant jump statements. https://rules.sonarsource.com/csharp/RSPEC-3626
                     }
                 }
                 else
diff --git a/src/Lucene.Net/Support/IO/FileSupport.cs b/src/Lucene.Net/Support/IO/FileSupport.cs
index 7d0f7be32..90294dbe1 100644
--- a/src/Lucene.Net/Support/IO/FileSupport.cs
+++ b/src/Lucene.Net/Support/IO/FileSupport.cs
@@ -192,7 +192,6 @@ namespace Lucene.Net.Support.IO
                 catch (IOException e) when (IsFileAlreadyExistsException(e, fileName))
                 {
                     // If the error was because the file exists, try again.
-                    continue;
                 }
             }
             return new FileInfo(fileName);
diff --git a/src/Lucene.Net/Util/Automaton/UTF32ToUTF8.cs b/src/Lucene.Net/Util/Automaton/UTF32ToUTF8.cs
index 5d270d0a6..b11ab0e52 100644
--- a/src/Lucene.Net/Util/Automaton/UTF32ToUTF8.cs
+++ b/src/Lucene.Net/Util/Automaton/UTF32ToUTF8.cs
@@ -180,7 +180,7 @@ namespace Lucene.Net.Util.Automaton
                 {
                     // 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
                 {
diff --git a/src/Lucene.Net/Util/Fst/FSTEnum.cs b/src/Lucene.Net/Util/Fst/FSTEnum.cs
index 7b12ee7a4..9d5f7901c 100644
--- a/src/Lucene.Net/Util/Fst/FSTEnum.cs
+++ b/src/Lucene.Net/Util/Fst/FSTEnum.cs
@@ -216,7 +216,7 @@ namespace Lucene.Net.Util.Fst
                         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)
                     {
@@ -390,7 +390,7 @@ namespace Lucene.Net.Util.Fst
                         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)
                     {
diff --git a/src/dotnet/tools/lucene-cli/SourceCode/SourceCodeSectionReader.cs b/src/dotnet/tools/lucene-cli/SourceCode/SourceCodeSectionReader.cs
index c2927b356..0ec50949e 100644
--- a/src/dotnet/tools/lucene-cli/SourceCode/SourceCodeSectionReader.cs
+++ b/src/dotnet/tools/lucene-cli/SourceCode/SourceCodeSectionReader.cs
@@ -106,7 +106,7 @@ namespace Lucene.Net.Cli.SourceCode
                     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