Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyLloyd committed Nov 9, 2024
1 parent bd845c9 commit 9e098e0
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 36 deletions.
6 changes: 5 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
dotnet_diagnostic.MA0016.severity = none # Prefer using collection abstraction instead of implementation
dotnet_diagnostic.MA0004.severity = none # Use Task.ConfigureAwait
2 changes: 1 addition & 1 deletion CsCheck/CsCheck.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ BREAKING CHANGES:
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.169" PrivateAssets="All" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.177" PrivateAssets="All" />
<None Include="../CsCheck.png" Pack="true" PackagePath="" Visible="False" />
<None Include="../README.md" Pack="true" PackagePath="" Visible="False" />
</ItemGroup>
Expand Down
5 changes: 0 additions & 5 deletions CsCheck/Logging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions Tests/SolveRootTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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, Func<double, double>, double, double, double> solver)
Expand Down
43 changes: 16 additions & 27 deletions Tests/UtilsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,68 +81,68 @@ static void Test(int[] ids, IEnumerable<int[]> 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],
Expand All @@ -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],
Expand All @@ -174,7 +174,7 @@ public void Permutations_1232()
[2, 3, 2, 1],
[2, 2, 3, 1],
[3, 2, 2, 1],
});
]);
}

[Fact]
Expand Down Expand Up @@ -223,17 +223,6 @@ public int GetHashCode([DisallowNull] int[] a)
return hash;
}
}

public static List<string>? GetResearchStages(ResearchProject project)
{
var phase = project.ExperimentalPhase;
if (phase is null) return null;
var stages = new List<string> { phase.PhaseName };
if (phase.LatestExperiment is not null)
stages.Add(phase.LatestExperiment.ExperimentName);
return stages;
}

}

public class Phase
Expand Down

0 comments on commit 9e098e0

Please sign in to comment.