Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .build/dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<!-- J2N will break binary compatibility in 3.0.0 to fix the APIs of collection types -->
<J2NPackageVersion>[2.2.0-alpha-0042, 3.0.0)</J2NPackageVersion>
<LiquidTestReportsMarkdownPackageVersion>1.0.9</LiquidTestReportsMarkdownPackageVersion>
<LuceneNetCodeAnalysisDevPackageVersion>1.0.0-alpha.18</LuceneNetCodeAnalysisDevPackageVersion>
<LuceneNetCodeAnalysisDevPackageVersion>1.0.0-alpha.36</LuceneNetCodeAnalysisDevPackageVersion>
<MicrosoftAspNetCoreHttpAbstractionsPackageVersion>2.3.0</MicrosoftAspNetCoreHttpAbstractionsPackageVersion>
<MicrosoftAspNetCoreTestHostPackageVersion>8.0.19</MicrosoftAspNetCoreTestHostPackageVersion>
<MicrosoftBclMemoryPackageVersion>10.0.0-rc.1.25451.107</MicrosoftBclMemoryPackageVersion>
Expand Down
10 changes: 10 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@
<NoWarn Label="Java array parameters can sometimes be replaced with .NET out or ref parameters">$(NoWarn);LuceneDev1003</NoWarn>
<NoWarn Label="Return array may be able to be replaced with out values">$(NoWarn);LuceneDev1004</NoWarn>
<NoWarn Label="Floating point values embedded in strings should be formatted with J2N.Numerics Single or Double ToString methods">$(NoWarn);LuceneDev1006</NoWarn>
<NoWarn Label="Generic Dictionary indexer '...' may throw KeyNotFoundException. Use TryGetValue instead.">$(NoWarn);LuceneDev1007</NoWarn>
<NoWarn Label="Generic Dictionary indexer '...' may throw KeyNotFoundException. Use TryGetValue and check the value for null.">$(NoWarn);LuceneDev1008</NoWarn>
<NoWarn Label="Call to 'Parse' on numeric type 'Single' should specify an IFormatProvider (typically CultureInfo.InvariantCulture).">$(NoWarn);LuceneDev2000</NoWarn>
<NoWarn Label="Call to 'ToString' on numeric type 'Int64' should specify an IFormatProvider (typically CultureInfo.InvariantCulture).">$(NoWarn);LuceneDev2001</NoWarn>
<NoWarn Label="Call to 'Convert.ToString' should specify an IFormatProvider (typically CultureInfo.InvariantCulture).">$(NoWarn);LuceneDev2002</NoWarn>
<NoWarn Label="Call to 'string.Format' with a numeric argument should specify an IFormatProvider (typically CultureInfo.InvariantCulture).">$(NoWarn);LuceneDev2003</NoWarn>
<NoWarn Label="Call to 'TryParse' on J2N numeric type 'Int32' should specify an IFormatProvider (typically CultureInfo.InvariantCulture).">$(NoWarn);LuceneDev2004</NoWarn>
<NoWarn Label="Numeric value of type 'Int32' is concatenated to a string and will be formatted using the current culture. Wrap with .ToString(CultureInfo.InvariantCulture) explicitly.">$(NoWarn);LuceneDev2005</NoWarn>
<NoWarn Label="Numeric value of type 'Int32' is interpolated into a string and will be formatted using the current culture. Use FormattableString.Invariant or wrap with .ToString(CultureInfo.InvariantCulture) explicitly.">$(NoWarn);LuceneDev2006</NoWarn>
<NoWarn Label="Call to 'Parse' passes a non-invariant IFormatProvider. Use CultureInfo.InvariantCulture unless current-culture behavior is intentional.">$(NoWarn);LuceneDev2007</NoWarn>

</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/Lucene.Net.Analysis.Common/Analysis/Util/StemmerUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static bool StartsWith(ReadOnlySpan<char> s, ReadOnlySpan<char> prefix)
}

// LUCENENET: use more efficient implementation in MemoryExtensions
return s.StartsWith(prefix, StringComparison.Ordinal);
return s.StartsWith(prefix);
}

/// <summary>
Expand Down Expand Up @@ -147,7 +147,7 @@ public static bool EndsWith(ReadOnlySpan<char> s, ReadOnlySpan<char> suffix)
}

// LUCENENET: use more efficient implementation in MemoryExtensions
return s.EndsWith(suffix, StringComparison.Ordinal);
return s.EndsWith(suffix);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ internal static bool CanImplicitlyConvertTo(this Type from, Type to)
return true;

// Look for the marker that indicates from was null
if (from is null && (to.GetTypeInfo().IsClass || to.FullName.StartsWith("System.Nullable")))
if (from is null && (to.GetTypeInfo().IsClass || to.FullName.StartsWith("System.Nullable", StringComparison.Ordinal)))
return true;

if (convertibleValueTypes.ContainsKey(to) && convertibleValueTypes[to].Contains(from))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ public void TestICUSentenceBoundary()
BreakIterator bi = BreakIterator.GetSentenceInstance(CultureInfo.CurrentCulture);
IBoundaryScanner scanner = new BreakIteratorBoundaryScanner(bi);

int start = TEXT.IndexOf("any application");
int expected = TEXT.IndexOf("It is a");
int start = TEXT.IndexOf("any application", StringComparison.Ordinal);
int expected = TEXT.IndexOf("It is a", StringComparison.Ordinal);
TestFindStartOffset(text, start, expected, scanner);

expected = TEXT.IndexOf("application that requires") + "application that requires\n".Length;
expected = TEXT.IndexOf("application that requires", StringComparison.Ordinal) + "application that requires\n".Length;
TestFindEndOffset(text, start, expected, scanner);
}

Expand Down
2 changes: 2 additions & 0 deletions src/Lucene.Net.Tests/Support/TestHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,9 @@ public enum TestEnum
E4,
}

#pragma warning disable LuceneDev4001
[MethodImpl(MethodImplOptions.NoInlining)]
#pragma warning restore LuceneDev4001
public static void DoNotIgnore<T>(T value, int consumed)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;

namespace TestHelper
{
Expand Down Expand Up @@ -260,7 +261,7 @@ private static string FormatDiagnostics(DiagnosticAnalyzer analyzer, params Diag
Assert.IsTrue(location.IsInSource,
$"Test base does not currently handle diagnostics in metadata locations. Diagnostic in metadata: {diagnostics[i]}\r\n");

string resultMethodName = diagnostics[i].Location.SourceTree.FilePath.EndsWith(".cs") ? "GetCSharpResultAt" : "GetBasicResultAt";
string resultMethodName = diagnostics[i].Location.SourceTree.FilePath.EndsWith(".cs", StringComparison.OrdinalIgnoreCase) ? "GetCSharpResultAt" : "GetBasicResultAt";
var linePosition = diagnostics[i].Location.GetLineSpan().StartLinePosition;

builder.AppendFormat("{0}({1}, {2}, {3}.{4})",
Expand Down
Loading