Skip to content

Commit

Permalink
Review for CA1822: Mark members as static (apache#690)
Browse files Browse the repository at this point in the history
* sweep: Review for CA1822: Mark members as static

* chore: Review changes

* chore: Remove unused abort methods
  • Loading branch information
nikcio authored Oct 17, 2022
1 parent 86052e5 commit 878dc64
Show file tree
Hide file tree
Showing 100 changed files with 189 additions and 195 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public virtual int Stem(char[] s, int len)
/// <param name="s"> input buffer </param>
/// <param name="len"> length of input buffer </param>
/// <returns> new stemmed length </returns>
private int RemoveArticle(char[] s, int len)
private static int RemoveArticle(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len > 6 && StemmerUtil.EndsWith(s, len, "ият"))
{
Expand All @@ -112,7 +112,7 @@ private int RemoveArticle(char[] s, int len)
return len;
}

private int RemovePlural(char[] s, int len)
private static int RemovePlural(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len > 6)
{
Expand Down
10 changes: 5 additions & 5 deletions src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemmer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected internal virtual string Stem(string term)
/// Checks a term if it can be processed correctly.
/// </summary>
/// <returns> true if, and only if, the given term consists in letters. </returns>
private bool IsStemmable(string term)
private static bool IsStemmable(string term) // LUCENENET: CA1822: Mark members as static
{
for (int c = 0; c < term.Length; c++)
{
Expand All @@ -109,7 +109,7 @@ private bool IsStemmable(string term)
/// Checks a term if it can be processed indexed.
/// </summary>
/// <returns> true if it can be indexed </returns>
private bool IsIndexable(string term)
private static bool IsIndexable(string term) // LUCENENET: CA1822: Mark members as static
{
return (term.Length < 30) && (term.Length > 2);
}
Expand All @@ -118,7 +118,7 @@ private bool IsIndexable(string term)
/// See if string is 'a','e','i','o','u'
/// </summary>
/// <returns> true if is vowel </returns>
private bool IsVowel(char value)
private static bool IsVowel(char value) // LUCENENET: CA1822: Mark members as static
{
return (value == 'a') || (value == 'e') || (value == 'i') || (value == 'o') || (value == 'u');
}
Expand Down Expand Up @@ -259,7 +259,7 @@ private string GetRV(string value)
/// 4) ç -> c
/// </summary>
/// <returns> null or a string transformed </returns>
private string ChangeTerm(string value)
private static string ChangeTerm(string value) // LUCENENET: CA1822: Mark members as static
{
int j;
string r = "";
Expand Down Expand Up @@ -319,7 +319,7 @@ private string ChangeTerm(string value)
/// Check if a string ends with a suffix
/// </summary>
/// <returns> true if the string ends with the specified suffix </returns>
private bool Suffix(string value, string suffix)
private static bool Suffix(string value, string suffix) // LUCENENET: CA1822: Mark members as static
{

// be-safe !!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31134,7 +31134,7 @@ private char YyCharAt(int pos)
/// in error fallback rules.
/// </summary>
/// <param name="errorCode">the code of the errormessage to display</param>
private void ZzScanError(int errorCode)
private static void ZzScanError(int errorCode) // LUCENENET: CA1822: Mark members as static
{
string message;
// LUCENENET specific: Defensive check so we don't have to catch IndexOutOfRangeException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private void ParseNode(XmlReader node)
}
}

private XmlReaderSettings GetXmlReaderSettings()
private static XmlReaderSettings GetXmlReaderSettings() // LUCENENET: CA1822: Mark members as static
{
return

Expand All @@ -202,7 +202,7 @@ private XmlReaderSettings GetXmlReaderSettings()
};
}

private IDictionary<string, string> GetAttributes(XmlReader node)
private static IDictionary<string, string> GetAttributes(XmlReader node) // LUCENENET: CA1822: Mark members as static
{
var result = new Dictionary<string, string>();
if (node.HasAttributes)
Expand Down
6 changes: 3 additions & 3 deletions src/Lucene.Net.Analysis.Common/Analysis/Cz/CzechStemmer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public virtual int Stem(char[] s, int len)
return len;
}

private int RemoveCase(char[] s, int len)
private static int RemoveCase(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len > 7 && StemmerUtil.EndsWith(s, len, "atech"))
{
Expand Down Expand Up @@ -96,7 +96,7 @@ private int RemoveCase(char[] s, int len)
return len;
}

private int RemovePossessives(char[] s, int len)
private static int RemovePossessives(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len > 5 && (StemmerUtil.EndsWith(s, len, "ov") || StemmerUtil.EndsWith(s, len, "in") || StemmerUtil.EndsWith(s, len, "ův")))
{
Expand All @@ -106,7 +106,7 @@ private int RemovePossessives(char[] s, int len)
return len;
}

private int Normalize(char[] s, int len)
private static int Normalize(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (StemmerUtil.EndsWith(s, len, "čt")) // čt -> ck
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public virtual int Stem(char[] s, int len)
return Step2(s, len);
}

private bool StEnding(char ch)
private static bool StEnding(char ch) // LUCENENET: CA1822: Mark members as static
{
switch (ch)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Lucene.Net.Analysis.Common/Analysis/De/GermanStemmer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected internal virtual string Stem(string term)
/// Checks if a term could be stemmed.
/// </summary>
/// <returns> true if, and only if, the given term consists in letters. </returns>
private bool IsStemmable(string term)
private static bool IsStemmable(string term) // LUCENENET: CA1822: Mark members as static
{
for (int c = 0; c < term.Length; c++)
{
Expand Down Expand Up @@ -159,7 +159,7 @@ private void Optimize(StringBuilder buffer)
/// <summary>
/// Removes a particle denotion ("ge") from a term.
/// </summary>
private void RemoveParticleDenotion(StringBuilder buffer)
private static void RemoveParticleDenotion(StringBuilder buffer) // LUCENENET: CA1822: Mark members as static
{
if (buffer.Length > 4)
{
Expand Down Expand Up @@ -265,7 +265,7 @@ private void Substitute(StringBuilder buffer)
/// character combinations. Umlauts will remain as their corresponding vowel,
/// as "ß" remains as "ss".
/// </summary>
private void Resubstitute(StringBuilder buffer)
private static void Resubstitute(StringBuilder buffer) // LUCENENET: CA1822: Mark members as static
{
for (int c = 0; c < buffer.Length; c++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public override bool IncrementToken()
}
}

private int LowerCase(int codepoint)
private static int LowerCase(int codepoint) // LUCENENET: CA1822: Mark members as static
{
switch (codepoint)
{
Expand Down
52 changes: 26 additions & 26 deletions src/Lucene.Net.Analysis.Common/Analysis/El/GreekStemmer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public virtual int Stem(char[] s, int len)
return Rule22(s, len);
}

private int Rule0(char[] s, int len)
private static int Rule0(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len > 9 && (StemmerUtil.EndsWith(s, len, "καθεστωτοσ") ||
StemmerUtil.EndsWith(s, len, "καθεστωτων")))
Expand Down Expand Up @@ -183,7 +183,7 @@ private int Rule0(char[] s, int len)
return len;
}

private int Rule1(char[] s, int len)
private static int Rule1(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len > 4 && (StemmerUtil.EndsWith(s, len, "αδεσ") ||
StemmerUtil.EndsWith(s, len, "αδων")))
Expand All @@ -206,7 +206,7 @@ private int Rule1(char[] s, int len)
return len;
}

private int Rule2(char[] s, int len)
private static int Rule2(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len > 4 && (StemmerUtil.EndsWith(s, len, "εδεσ") ||
StemmerUtil.EndsWith(s, len, "εδων")))
Expand All @@ -227,7 +227,7 @@ private int Rule2(char[] s, int len)
return len;
}

private int Rule3(char[] s, int len)
private static int Rule3(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len > 5 && (StemmerUtil.EndsWith(s, len, "ουδεσ") ||
StemmerUtil.EndsWith(s, len, "ουδων")))
Expand Down Expand Up @@ -259,7 +259,7 @@ private int Rule3(char[] s, int len)
private static readonly CharArraySet exc4 = new CharArraySet(LuceneVersion.LUCENE_CURRENT, new string[] { "θ", "δ", "ελ", "γαλ", "ν", "π", "ιδ", "παρ" }, false);
#pragma warning restore 612, 618

private int Rule4(char[] s, int len)
private static int Rule4(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len > 3 && (StemmerUtil.EndsWith(s, len, "εωσ") ||
StemmerUtil.EndsWith(s, len, "εων")))
Expand All @@ -273,7 +273,7 @@ private int Rule4(char[] s, int len)
return len;
}

private int Rule5(char[] s, int len)
private static int Rule5(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len > 2 && StemmerUtil.EndsWith(s, len, "ια"))
{
Expand Down Expand Up @@ -305,7 +305,7 @@ private int Rule5(char[] s, int len)
"πετσ", "πιτσ", "πικαντ", "πλιατσ", "ποστελν", "πρωτοδ", "σερτ",
"συναδ", "τσαμ", "υποδ", "φιλον", "φυλοδ", "χασ" }, false);

private int Rule6(char[] s, int len)
private static int Rule6(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
bool removed = false;
if (len > 3 && (StemmerUtil.EndsWith(s, len, "ικα") ||
Expand Down Expand Up @@ -338,7 +338,7 @@ private int Rule6(char[] s, int len)
new string[] { "αναπ", "αποθ", "αποκ", "αποστ", "βουβ", "ξεθ", "ουλ",
"πεθ", "πικρ", "ποτ", "σιχ", "χ" }, false);

private int Rule7(char[] s, int len)
private static int Rule7(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len == 5 && StemmerUtil.EndsWith(s, len, "αγαμε"))
{
Expand Down Expand Up @@ -396,7 +396,7 @@ private int Rule7(char[] s, int len)
"ολογαλ", "πενταρφ", "περηφ", "περιτρ", "πλατ", "πολυδαπ", "πολυμηχ",
"στεφ", "ταβ", "τετ", "υπερηφ", "υποκοπ", "χαμηλοδαπ", "ψηλοταβ" }, false);

private int Rule8(char[] s, int len)
private static int Rule8(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
bool removed = false;

Expand Down Expand Up @@ -458,7 +458,7 @@ private int Rule8(char[] s, int len)
"βαρον", "ντρ", "σκ", "κοπ", "μπορ", "νιφ", "παγ", "παρακαλ", "σερπ",
"σκελ", "συρφ", "τοκ", "υ", "δ", "εμ", "θαρρ", "θ" }, false);

private int Rule9(char[] s, int len)
private static int Rule9(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len > 5 && StemmerUtil.EndsWith(s, len, "ησετε"))
{
Expand Down Expand Up @@ -509,7 +509,7 @@ private int Rule9(char[] s, int len)
return len;
}

private int Rule10(char[] s, int len)
private static int Rule10(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len > 5 && (StemmerUtil.EndsWith(s, len, "οντασ") || StemmerUtil.EndsWith(s, len, "ωντασ")))
{
Expand All @@ -529,7 +529,7 @@ private int Rule10(char[] s, int len)
return len;
}

private int Rule11(char[] s, int len)
private static int Rule11(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len > 6 && StemmerUtil.EndsWith(s, len, "ομαστε"))
{
Expand Down Expand Up @@ -563,7 +563,7 @@ private int Rule11(char[] s, int len)
new string[] { "αλ", "αρ", "εκτελ", "ζ", "μ", "ξ", "παρακαλ", "αρ", "προ", "νισ" }, false);
#pragma warning restore 612, 618

private int Rule12(char[] s, int len)
private static int Rule12(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len > 5 && StemmerUtil.EndsWith(s, len, "ιεστε"))
{
Expand Down Expand Up @@ -592,7 +592,7 @@ private int Rule12(char[] s, int len)
#pragma warning restore 612, 618
new string[] { "διαθ", "θ", "παρακαταθ", "προσθ", "συνθ" }, false);

private int Rule13(char[] s, int len)
private static int Rule13(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len > 6 && StemmerUtil.EndsWith(s, len, "ηθηκεσ"))
{
Expand Down Expand Up @@ -638,7 +638,7 @@ private int Rule13(char[] s, int len)
"λεχ", "μ", "πατ", "ρ", "λ", "μεδ", "μεσαζ", "υποτειν", "αμ", "αιθ",
"ανηκ", "δεσποζ", "ενδιαφερ", "δε", "δευτερευ", "καθαρευ", "πλε", "τσα" }, false);

private int Rule14(char[] s, int len)
private static int Rule14(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
bool removed = false;

Expand Down Expand Up @@ -692,7 +692,7 @@ private int Rule14(char[] s, int len)
#pragma warning restore 612, 618
new string[] { "ψοφ", "ναυλοχ" }, false);

private int Rule15(char[] s, int len)
private static int Rule15(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
bool removed = false;
if (len > 4 && StemmerUtil.EndsWith(s, len, "αγεσ"))
Expand Down Expand Up @@ -737,7 +737,7 @@ private int Rule15(char[] s, int len)
#pragma warning restore 612, 618
new string[] { "ν", "χερσον", "δωδεκαν", "ερημον", "μεγαλον", "επταν" }, false);

private int Rule16(char[] s, int len)
private static int Rule16(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
bool removed = false;
if (len > 4 && StemmerUtil.EndsWith(s, len, "ησου"))
Expand Down Expand Up @@ -765,7 +765,7 @@ private int Rule16(char[] s, int len)
#pragma warning restore 612, 618
new string[] { "ασβ", "σβ", "αχρ", "χρ", "απλ", "αειμν", "δυσχρ", "ευχρ", "κοινοχρ", "παλιμψ" }, false);

private int Rule17(char[] s, int len)
private static int Rule17(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len > 4 && StemmerUtil.EndsWith(s, len, "ηστε"))
{
Expand All @@ -785,7 +785,7 @@ private int Rule17(char[] s, int len)
#pragma warning restore 612, 618
new string[] { "ν", "ρ", "σπι", "στραβομουτσ", "κακομουτσ", "εξων" }, false);

private int Rule18(char[] s, int len)
private static int Rule18(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
bool removed = false;

Expand Down Expand Up @@ -816,7 +816,7 @@ private int Rule18(char[] s, int len)
#pragma warning restore 612, 618
new string[] { "παρασουσ", "φ", "χ", "ωριοπλ", "αζ", "αλλοσουσ", "ασουσ" }, false);

private int Rule19(char[] s, int len)
private static int Rule19(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
bool removed = false;

Expand All @@ -841,7 +841,7 @@ private int Rule19(char[] s, int len)
return len;
}

private int Rule20(char[] s, int len)
private static int Rule20(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len > 5 && (StemmerUtil.EndsWith(s, len, "ματων") || StemmerUtil.EndsWith(s, len, "ματοσ")))
{
Expand All @@ -854,7 +854,7 @@ private int Rule20(char[] s, int len)
return len;
}

private int Rule21(char[] s, int len)
private static int Rule21(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len > 9 && StemmerUtil.EndsWith(s, len, "ιοντουσαν"))
{
Expand Down Expand Up @@ -973,7 +973,7 @@ private int Rule21(char[] s, int len)
return len;
}

private int Rule22(char[] s, int len)
private static int Rule22(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (StemmerUtil.EndsWith(s, len, "εστερ") ||
StemmerUtil.EndsWith(s, len, "εστατ"))
Expand Down Expand Up @@ -1002,7 +1002,7 @@ private int Rule22(char[] s, int len)
/// <param name="len"> The length of the char[] array. </param>
/// <param name="suffix"> A <see cref="string"/> object to check if the word given ends with these characters. </param>
/// <returns> True if the word ends with the suffix given , false otherwise. </returns>
private bool EndsWith(char[] s, int len, string suffix)
private static bool EndsWith(char[] s, int len, string suffix) // LUCENENET: CA1822: Mark members as static
{
int suffixLen = suffix.Length;
if (suffixLen > len)
Expand All @@ -1028,7 +1028,7 @@ private bool EndsWith(char[] s, int len, string suffix)
/// <param name="len"> The length of the <see cref="T:char[]"/> array. </param>
/// <returns> True if the word contained in the leading portion of <see cref="T:char[]"/> array ,
/// ends with a vowel , false otherwise. </returns>
private bool EndsWithVowel(char[] s, int len)
private static bool EndsWithVowel(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len == 0)
{
Expand Down Expand Up @@ -1057,7 +1057,7 @@ private bool EndsWithVowel(char[] s, int len)
/// <param name="len"> The length of the <see cref="T:char[]"/> array. </param>
/// <returns> True if the word contained in the leading portion of <see cref="T:char[]"/> array ,
/// ends with a vowel , false otherwise. </returns>
private bool EndsWithVowelNoY(char[] s, int len)
private static bool EndsWithVowelNoY(char[] s, int len) // LUCENENET: CA1822: Mark members as static
{
if (len == 0)
{
Expand Down
Loading

0 comments on commit 878dc64

Please sign in to comment.