diff --git a/.editorconfig b/.editorconfig index 7dc5d11..66a386f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,6 +8,8 @@ trim_trailing_whitespace = true csharp_style_namespace_declarations = file_scoped:warning +dotnet_diagnostic.IDE0290.severity = none # Use primary constructor + dotnet_diagnostic.CA1307.severity = none # Specify StringComparison for clarity dotnet_diagnostic.CA1051.severity = none # Do not declare visible instance fields dotnet_diagnostic.CA1062.severity = none # Validate arguments of public methods @@ -24,6 +26,7 @@ dotnet_diagnostic.CA1309.severity = none # Use ordinal string comparison dotnet_diagnostic.CA1814.severity = none # Prefer jagged arrays over multidimensional dotnet_diagnostic.CA1711.severity = none # Identifiers should not have incorrect suffix dotnet_diagnostic.CA2211.severity = none # Non-constant fields should not be visible +dotnet_diagnostic.CA2007.severity = none # Consider calling ConfigureAwait on the awaited task dotnet_diagnostic.CA1815.severity = silent # Override equals and operator equals on value types dotnet_diagnostic.CA1707.severity = silent # Identifiers should not contain underscores @@ -43,4 +46,5 @@ dotnet_diagnostic.MA0051.severity = none # Method is too long dotnet_diagnostic.MA0076.severity = none # Do not use implicit culture-sensitive ToString in interpolated strings dotnet_diagnostic.MA0075.severity = none # Do not use implicit culture-sensitive ToString dotnet_diagnostic.MA0001.severity = none # StringComparison is missing -dotnet_diagnostic.MA0016.severity = none # Prefer using collection abstraction instead of implementation \ No newline at end of file +dotnet_diagnostic.MA0016.severity = none # Prefer using collection abstraction instead of implementation +dotnet_diagnostic.MA0004.severity = none # Use Task.ConfigureAwait \ No newline at end of file diff --git a/CsCheck/CsCheck.csproj b/CsCheck/CsCheck.csproj index ba7c7fa..03e88f5 100644 --- a/CsCheck/CsCheck.csproj +++ b/CsCheck/CsCheck.csproj @@ -54,7 +54,7 @@ BREAKING CHANGES: - + diff --git a/CsCheck/Logging.cs b/CsCheck/Logging.cs index cb547ed..dafa1d5 100644 --- a/CsCheck/Logging.cs +++ b/CsCheck/Logging.cs @@ -3,11 +3,6 @@ namespace CsCheck; using System.Runtime.CompilerServices; using System.Text.Json; using System.Threading.Channels; -using System.Xml; - -#pragma warning disable IDE0290 // Use primary constructor -#pragma warning disable MA0004 // Use Task.ConfigureAwait -#pragma warning disable CA2007 // Consider calling ConfigureAwait on the awaited task public interface ILogger : IDisposable { diff --git a/Tests/SolveRootTests.cs b/Tests/SolveRootTests.cs index 490f9a0..67ae8e4 100644 --- a/Tests/SolveRootTests.cs +++ b/Tests/SolveRootTests.cs @@ -184,10 +184,10 @@ public void QuadraticRoot_Correct() return Gen.Select(genD, genD, genD) .Where((a, b, c) => a < b && ((c < a && !AreClose(c, a)) || (c > b && !AreClose(c, b)))) .Select((a, b, c) => (a, f(a), b, f(b), c, f(c))) - .Where((a, fa, b, fb, c, fc) => BoundsZero(fa, fb)) + .Where((_, fa, _, fb, _, _) => BoundsZero(fa, fb)) .Select((a, fa, b, fb, c, fc) => (root1, root2, a, b, c, QuadraticRoot(a, fa, b, fb, c, fc))); }) - .Sample((root1, root2, a, b, c, x) => AreClose(root1, x) || AreClose(root2, x)); + .Sample((root1, root2, _, _, _, x) => AreClose(root1, x) || AreClose(root2, x)); } static (int, int[]) TestSolver(double tol, Func, double, double, double> solver) diff --git a/Tests/UtilsTests.cs b/Tests/UtilsTests.cs index 80a60ff..1222171 100644 --- a/Tests/UtilsTests.cs +++ b/Tests/UtilsTests.cs @@ -81,68 +81,68 @@ static void Test(int[] ids, IEnumerable expected) [Fact] public void Permutations_11() { - Test([1, 1], new int[][] { + Test([1, 1], [ [1, 1], - }); + ]); } [Fact] public void Permutations_12() { - Test([1, 2], new int[][] { + Test([1, 2], [ [1, 2], [2, 1], - }); + ]); } [Fact] public void Permutations_112() { - Test([1, 1, 2], new int[][] { + Test([1, 1, 2], [ [1, 1, 2], [1, 2, 1], - }); + ]); } [Fact] public void Permutations_121() { - Test([1, 2, 1], new int[][] { + Test([1, 2, 1], [ [1, 2, 1], [2, 1, 1], [1, 1, 2], - }); + ]); } [Fact] public void Permutations_123() { - Test([1, 2, 3], new int[][] { + Test([1, 2, 3], [ [1, 2, 3], [2, 1, 3], [1, 3, 2], [3, 1, 2], [2, 3, 1], [3, 2, 1], - }); + ]); } [Fact] public void Permutations_1212() { - Test([1, 2, 1, 2], new int[][] { + Test([1, 2, 1, 2], [ [1, 2, 1, 2], [2, 1, 1, 2], [1, 1, 2, 2], [1, 2, 2, 1], [2, 1, 2, 1], - }); + ]); } [Fact] public void Permutations_1231() { - Test([1, 2, 3, 1], new int[][] { + Test([1, 2, 3, 1], [ [1, 2, 3, 1], [2, 1, 3, 1], [1, 3, 2, 1], @@ -155,13 +155,13 @@ public void Permutations_1231() [3, 2, 1, 1], [3, 1, 1, 2], [1, 1, 3, 2], - }); + ]); } [Fact] public void Permutations_1232() { - Test([1, 2, 3, 2], new int[][] { + Test([1, 2, 3, 2], [ [1, 2, 3, 2], [2, 1, 3, 2], [1, 3, 2, 2], @@ -174,7 +174,7 @@ public void Permutations_1232() [2, 3, 2, 1], [2, 2, 3, 1], [3, 2, 2, 1], - }); + ]); } [Fact] @@ -223,17 +223,6 @@ public int GetHashCode([DisallowNull] int[] a) return hash; } } - - public static List? GetResearchStages(ResearchProject project) - { - var phase = project.ExperimentalPhase; - if (phase is null) return null; - var stages = new List { phase.PhaseName }; - if (phase.LatestExperiment is not null) - stages.Add(phase.LatestExperiment.ExperimentName); - return stages; - } - } public class Phase