Skip to content

Commit ebe8794

Browse files
authored
refactor: specify encoding in editorconfig and cleanup code (#92)
This pull request contains a variety of small improvements and cleanups across the codebase, primarily focused on code formatting, consistency, and minor refactoring. The most significant changes address EditorConfig settings, code style, and a few code logic adjustments. **Formatting and Code Style Improvements:** * Added `charset = utf-8` and `trim_trailing_whitespace = true` to `.editorconfig` to enforce consistent encoding and whitespace handling across the project. **Code Quality and Refactoring:** * Made `DisableMutationTests` a `readonly` field in `Build.MutationTests.cs` to clarify its immutability. * Reformatted long lines and improved readability in conditional and method calls, such as in `Build.Pack.cs` and `ThatMockVerify.AllSetupsAreUsed.cs`. * Minor logic and whitespace adjustments in mutation test pipeline scripts for better maintainability. No functional changes have been introduced; these updates are intended to improve maintainability and code consistency.
1 parent d9d5989 commit ebe8794

57 files changed

Lines changed: 156 additions & 130 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ root = true
55
[*]
66

77
#### Core EditorConfig Options ####
8+
charset = utf-8
89

910
# Indentation and spacing
1011
indent_size = 4
@@ -14,6 +15,7 @@ tab_width = 4
1415
# New line preferences
1516
end_of_line = crlf
1617
insert_final_newline = true
18+
trim_trailing_whitespace = true
1719

1820
# C# files
1921
[*.cs]

Benchmarks/aweXpect.Mockolate.Benchmarks/HappyCaseBenchmarks.Dummy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using BenchmarkDotNet.Attributes;
1+
using BenchmarkDotNet.Attributes;
22

33
namespace aweXpect.Mockolate.Benchmarks;
44

Benchmarks/aweXpect.Mockolate.Benchmarks/HappyCaseBenchmarks.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using BenchmarkDotNet.Attributes;
1+
using BenchmarkDotNet.Attributes;
22
using BenchmarkDotNet.Configs;
33
using BenchmarkDotNet.Jobs;
44
using BenchmarkDotNet.Toolchains.InProcess.Emit;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
using BenchmarkDotNet.Running;
1+
using BenchmarkDotNet.Running;
22

33
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);

Directory.Packages.props

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
44
</PropertyGroup>
55
<ItemGroup>
6-
<PackageVersion Include="aweXpect" Version="2.31.0" />
7-
<PackageVersion Include="aweXpect.Core" Version="2.28.0" />
8-
<PackageVersion Include="aweXpect.Chronology" Version="1.0.0" />
9-
<PackageVersion Include="Mockolate" Version="2.2.0" />
6+
<PackageVersion Include="aweXpect" Version="2.31.0"/>
7+
<PackageVersion Include="aweXpect.Core" Version="2.28.0"/>
8+
<PackageVersion Include="aweXpect.Chronology" Version="1.0.0"/>
9+
<PackageVersion Include="Mockolate" Version="2.2.0"/>
1010
</ItemGroup>
1111
<ItemGroup>
12-
<PackageVersion Include="Nullable" Version="1.3.1" />
12+
<PackageVersion Include="Nullable" Version="1.3.1"/>
1313
</ItemGroup>
1414
<ItemGroup>
1515
<PackageVersion Include="Nuke.Common" Version="10.1.0"/>
@@ -18,15 +18,15 @@
1818
<PackageVersion Include="SharpCompress" Version="0.47.3"/>
1919
</ItemGroup>
2020
<ItemGroup>
21-
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.163" />
21+
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.163"/>
2222
</ItemGroup>
2323
<ItemGroup>
24-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
25-
<PackageVersion Include="BenchmarkDotNet" Version="0.15.8" />
24+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.3.0"/>
25+
<PackageVersion Include="BenchmarkDotNet" Version="0.15.8"/>
2626
<PackageVersion Include="xunit" Version="2.9.3"/>
2727
<PackageVersion Include="xunit.v3" Version="3.2.2"/>
2828
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5"/>
29-
<PackageVersion Include="coverlet.collector" Version="8.0.1" />
30-
<PackageVersion Include="PublicApiGenerator" Version="11.5.4" />
29+
<PackageVersion Include="coverlet.collector" Version="8.0.1"/>
30+
<PackageVersion Include="PublicApiGenerator" Version="11.5.4"/>
3131
</ItemGroup>
3232
</Project>

Pipeline/Build.MutationTests.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace Build;
2222

2323
partial class Build
2424
{
25-
private static bool DisableMutationTests = true;
25+
private static readonly bool DisableMutationTests = true;
2626
static string MutationCommentBody = "";
2727

2828
Target MutationTests => _ => _
@@ -60,6 +60,7 @@ partial class Build
6060
branchName = "release/" + version;
6161
Log.Information("Use release branch analysis for '{BranchName}'", branchName);
6262
}
63+
6364
File.WriteAllText(ArtifactsDirectory / "BranchName.txt", branchName);
6465

6566
string configText = $$"""
@@ -129,7 +130,8 @@ partial class Build
129130
File.WriteAllText(ArtifactsDirectory / "PR_Comment.md", body);
130131

131132
if (prId != null)
132-
{ File.WriteAllText(ArtifactsDirectory / "PR.txt", prId.Value.ToString());
133+
{
134+
File.WriteAllText(ArtifactsDirectory / "PR.txt", prId.Value.ToString());
133135
}
134136
});
135137

@@ -191,7 +193,8 @@ await client.PutAsync(
191193
else
192194
{
193195
Log.Information($"Update comment:\n{body}");
194-
await gitHubClient.Issue.Comment.Update("aweXpect", "aweXpect.Mockolate", commentId.Value, body);
196+
await gitHubClient.Issue.Comment.Update("aweXpect", "aweXpect.Mockolate", commentId.Value,
197+
body);
195198
}
196199
}
197200
}

Pipeline/Build.Pack.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ partial class Build
3232
$"[![Changelog](https://img.shields.io/badge/Changelog-v{version}-blue)](https://github.com/aweXpect/aweXpect.Mockolate/releases/tag/v{version})");
3333
foreach (string line in lines.Skip(1))
3434
{
35-
if (line.StartsWith("[![Build](https://github.com/aweXpect/aweXpect.Mockolate/actions/workflows/build.yml") ||
35+
if (line.StartsWith(
36+
"[![Build](https://github.com/aweXpect/aweXpect.Mockolate/actions/workflows/build.yml") ||
3637
line.StartsWith("[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure"))
3738
{
3839
continue;

Source/aweXpect.Mockolate/Helpers/MyDescribableSubject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using aweXpect.Core;
1+
using aweXpect.Core;
22
using Mockolate;
33

44
namespace aweXpect.Helpers;

Source/aweXpect.Mockolate/Helpers/Polyfills/CallerArgumentExpressionAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if !NET8_0_OR_GREATER
1+
#if !NET8_0_OR_GREATER
22
using System.Diagnostics.CodeAnalysis;
33

44
// Licensed to the .NET Foundation under one or more agreements.

Source/aweXpect.Mockolate/Helpers/ThatExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Diagnostics.CodeAnalysis;
33
using aweXpect.Core;
44

0 commit comments

Comments
 (0)