Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add linter #28

Closed
wants to merge 3 commits into from
Closed
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
4 changes: 2 additions & 2 deletions benchmark/Benchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public string GetValue(Summary summary, BenchmarkCase benchmarkCase)
[Config(typeof(Config))]
public class RealDataBenchmark
{

private class Config : ManualConfig
#pragma warning disable CA1812
private sealed class Config : ManualConfig
{
public Config()
{
Expand Down
4 changes: 2 additions & 2 deletions benchmark/benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
</PropertyGroup>

<ItemGroup>
Expand All @@ -23,6 +25,4 @@
</None>
</ItemGroup>



</Project>
3 changes: 2 additions & 1 deletion src/SimdUnicode.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<Nullable>enable</Nullable>
<!-- This is required for SIMD, sse c# - How to run unsafe code in "visual studio code"? - Stack Overflow https://stackoverflow.com/questions/50636693/how-to-run-unsafe-code-in-visual-studio-code -->
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
</PropertyGroup>

</Project>
4 changes: 2 additions & 2 deletions test/UTF8ValidationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

private const int NumTrials = 1000;
private readonly RandomUtf8 generator = new RandomUtf8(1234, 1, 1, 1, 1);
private static readonly Random rand = new Random();

Check warning on line 12 in test/UTF8ValidationTests.cs

View workflow job for this annotation

GitHub Actions / build

Unused field 'rand' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1823)

[Fact]
public void TestGoodSequences()
Expand Down Expand Up @@ -113,7 +113,7 @@
{
byte[] utf8 = generator.Generate(512);
bool isValidUtf8 = ValidateUtf8(utf8);
string utf8HexString = BitConverter.ToString(utf8).Replace("-", " ");

Check warning on line 116 in test/UTF8ValidationTests.cs

View workflow job for this annotation

GitHub Actions / build

'string.Replace(string, string?)' has a method overload that takes a 'StringComparison' parameter. Replace this call in 'tests.Utf8SIMDValidationTests.NoErrorTest()' with a call to 'string.Replace(string, string?, System.StringComparison)' for clarity of intent. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1307)
Assert.True(isValidUtf8, $"Failure NoErrorTest. Sequence: {utf8HexString}");
}
}
Expand Down Expand Up @@ -332,8 +332,8 @@
[Fact]
public void BruteForceTest()
{
// Random rand = new Random(); // Random instance for test

#pragma warning disable CA5394
Random rand = new Random(); // Random instance for test
for (int i = 0; i < NumTrials; i++)
{
// Generate random UTF-8 sequence
Expand Down Expand Up @@ -372,7 +372,7 @@
public static bool ValidateUtf8Fuschia(byte[] data)
{
int pos = 0;
int len = data.Length;

Check warning on line 375 in test/UTF8ValidationTests.cs

View workflow job for this annotation

GitHub Actions / build

In externally visible method 'bool Utf8SIMDValidationTests.ValidateUtf8Fuschia(byte[] data)', validate parameter 'data' is non-null before using it. If appropriate, throw an 'ArgumentNullException' when the argument is 'null'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1062)
uint codePoint;

while (pos < len)
Expand Down
7 changes: 2 additions & 5 deletions test/tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
</PropertyGroup>

<ItemGroup>
Expand All @@ -26,8 +26,5 @@

<ItemGroup>
<ProjectReference Include="..\src\SimdUnicode.csproj" />
<!-- <ProjectReference Include="..\test\randomutf8.csproj" /> -->

</ItemGroup>

</Project>
Loading