From 13c9c5fcf7d148022112983518d9ad233374d746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20St=C3=BChmer?= Date: Mon, 23 Mar 2026 21:57:04 +0100 Subject: [PATCH 1/2] feat: Replace Argument.ThrowIfNull with ArgumentNullException.ThrowIfNull for built-in null checking - Remove NetEvolve.Arguments using directives where no longer needed - Remove coverlet.collector from Directory.Packages.props and test project - Clean up unused using directives in several files --- .csharpierignore | 6 ++-- .editorconfig | 31 +++++++++---------- Directory.Packages.props | 1 - .../Constraints/ConstraintBase.cs | 1 - .../Constraints/DefaultConstraint.cs | 1 - .../Constraints/ParenthesisConstraint.cs | 5 ++- .../Operators/AndOperator.cs | 5 ++- .../Operators/NotOperator.cs | 3 +- .../Operators/OrOperator.cs | 5 ++- .../Operators/XorOperator.cs | 5 ++- .../NetEvolve.FluentValue.Tests.Unit.csproj | 4 --- .../TypeExtensionsTests.cs | 3 -- 12 files changed, 27 insertions(+), 43 deletions(-) diff --git a/.csharpierignore b/.csharpierignore index 7e3489e..cf72dd9 100644 --- a/.csharpierignore +++ b/.csharpierignore @@ -1,3 +1,3 @@ -**/nuget.config -**/_snapshots/ -**/_snapshot/ +**/[Nn]u[Gg]et.config +**/*.verified.* +**/*.received.* diff --git a/.editorconfig b/.editorconfig index 175c36f..93483f4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -44,18 +44,22 @@ generated_code = true # XML project files [*.{slnx,csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,nativeproj,locproj}] indent_size = 2 +max_line_length = 200 # Xml build files [*.builds] indent_size = 2 +max_line_length = 200 # Xml files [*.{xml,stylecop,resx,ruleset}] indent_size = 2 +max_line_length = 200 # XML config files [*.{props,targets,ruleset,config,nuspec,vsixmanifest,vsct}] indent_size = 2 +max_line_length = 200 # JSON files [*.json] @@ -86,10 +90,6 @@ insert_final_newline = false [*.sln] indent_style = tab -[*.{received,verified}.txt] -insert_final_newline = false -trim_trailing_whitespace = false - [*.{cs,csx,vb,vbx}] # .NET Code Style Settings # See https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference @@ -266,19 +266,18 @@ dotnet_diagnostic.IDE0290.severity = sugges # [CSharpier] Incompatible rules deactivated # https://csharpier.com/docs/IntegratingWithLinters#code-analysis-rules dotnet_diagnostic.IDE0055.severity = none -dotnet_diagnostic.SA1000.severity = none -dotnet_diagnostic.SA1009.severity = none -dotnet_diagnostic.SA1111.severity = none -dotnet_diagnostic.SA1118.severity = none -dotnet_diagnostic.SA1137.severity = none -dotnet_diagnostic.SA1413.severity = none -dotnet_diagnostic.SA1500.severity = none -dotnet_diagnostic.SA1501.severity = none -dotnet_diagnostic.SA1502.severity = none -dotnet_diagnostic.SA1504.severity = none -dotnet_diagnostic.SA1515.severity = none -dotnet_diagnostic.SA1516.severity = none # Support for NetEvolve.Arguments Methods # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1062#null-check-validation-methods dotnet_code_quality.CA1062.null_check_validation_methods = M:NetEvolve.Arguments.Argument.ThrowIfNull(System.Object,System.String)|M:NetEvolve.Arguments.Argument.ThrowIfNull(System.Void*,System.String)|M:NetEvolve.Arguments.Argument.ThrowIfNullOrEmpty(System.String,System.String)|M:NetEvolve.Arguments.Argument.ThrowIfNullOrEmpty``1(System.Collections.Generic.IEnumerable{``0},System.String)|M:NetEvolve.Arguments.Argument.ThrowIfNullOrWhiteSpace(System.String,System.String) + +# Disable all style rules for generated code +[*.{received,verified}.*] +generated_code = true +# Disable all style rules for migrations +dotnet_analyzer_diagnostic.severity = none + +[**/Migrations/*.{cs,csx,vb,vbx}] +generated_code = true +# Disable all style rules for migrations +dotnet_analyzer_diagnostic.severity = none diff --git a/Directory.Packages.props b/Directory.Packages.props index cd106c0..f0a11ed 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -13,7 +13,6 @@ - diff --git a/src/NetEvolve.FluentValue/Constraints/ConstraintBase.cs b/src/NetEvolve.FluentValue/Constraints/ConstraintBase.cs index d59d957..f5b94e5 100644 --- a/src/NetEvolve.FluentValue/Constraints/ConstraintBase.cs +++ b/src/NetEvolve.FluentValue/Constraints/ConstraintBase.cs @@ -1,7 +1,6 @@ namespace NetEvolve.FluentValue.Constraints; using System; -using System.Collections; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; diff --git a/src/NetEvolve.FluentValue/Constraints/DefaultConstraint.cs b/src/NetEvolve.FluentValue/Constraints/DefaultConstraint.cs index 0619ea3..24d0d01 100644 --- a/src/NetEvolve.FluentValue/Constraints/DefaultConstraint.cs +++ b/src/NetEvolve.FluentValue/Constraints/DefaultConstraint.cs @@ -1,6 +1,5 @@ namespace NetEvolve.FluentValue.Constraints; -using System; using System.Text; using NetEvolve.FluentValue; diff --git a/src/NetEvolve.FluentValue/Constraints/ParenthesisConstraint.cs b/src/NetEvolve.FluentValue/Constraints/ParenthesisConstraint.cs index cb13e62..ab10d7a 100644 --- a/src/NetEvolve.FluentValue/Constraints/ParenthesisConstraint.cs +++ b/src/NetEvolve.FluentValue/Constraints/ParenthesisConstraint.cs @@ -1,7 +1,6 @@ namespace NetEvolve.FluentValue.Constraints; using System.Text; -using NetEvolve.Arguments; using NetEvolve.FluentValue; internal sealed class ParenthesisConstraint : ConstraintBase @@ -10,14 +9,14 @@ internal sealed class ParenthesisConstraint : ConstraintBase internal ParenthesisConstraint(IConstraint constraint) { - Argument.ThrowIfNull(constraint); + ArgumentNullException.ThrowIfNull(constraint); _constraint = (ConstraintBase)constraint; } public override bool IsSatisfiedBy(object? value) { - Argument.ThrowIfNull(_constraint); + ArgumentNullException.ThrowIfNull(_constraint); return _constraint.IsSatisfiedBy(value); } diff --git a/src/NetEvolve.FluentValue/Operators/AndOperator.cs b/src/NetEvolve.FluentValue/Operators/AndOperator.cs index 893e9a6..2cddd44 100644 --- a/src/NetEvolve.FluentValue/Operators/AndOperator.cs +++ b/src/NetEvolve.FluentValue/Operators/AndOperator.cs @@ -2,7 +2,6 @@ using System; using System.Text; -using NetEvolve.Arguments; using NetEvolve.FluentValue; using NetEvolve.FluentValue.Constraints; @@ -13,7 +12,7 @@ internal sealed class AndOperator : ConstraintBase, IOperator internal AndOperator(IConstraint left) { - Argument.ThrowIfNull(left); + ArgumentNullException.ThrowIfNull(left); _left = left; } @@ -30,7 +29,7 @@ public override bool IsSatisfiedBy(object? value) public IConstraint SetConstraint(IConstraint constraint) { - Argument.ThrowIfNull(constraint); + ArgumentNullException.ThrowIfNull(constraint); if (_right is NotOperator notOperator) { diff --git a/src/NetEvolve.FluentValue/Operators/NotOperator.cs b/src/NetEvolve.FluentValue/Operators/NotOperator.cs index 582d824..698dba1 100644 --- a/src/NetEvolve.FluentValue/Operators/NotOperator.cs +++ b/src/NetEvolve.FluentValue/Operators/NotOperator.cs @@ -2,7 +2,6 @@ using System; using System.Text; -using NetEvolve.Arguments; using NetEvolve.FluentValue; using NetEvolve.FluentValue.Constraints; @@ -24,7 +23,7 @@ public override bool IsSatisfiedBy(object? value) public IConstraint SetConstraint(IConstraint constraint) { - Argument.ThrowIfNull(constraint); + ArgumentNullException.ThrowIfNull(constraint); _constraint = constraint; diff --git a/src/NetEvolve.FluentValue/Operators/OrOperator.cs b/src/NetEvolve.FluentValue/Operators/OrOperator.cs index 365b263..423b510 100644 --- a/src/NetEvolve.FluentValue/Operators/OrOperator.cs +++ b/src/NetEvolve.FluentValue/Operators/OrOperator.cs @@ -2,7 +2,6 @@ using System; using System.Text; -using NetEvolve.Arguments; using NetEvolve.FluentValue; using NetEvolve.FluentValue.Constraints; @@ -13,7 +12,7 @@ internal sealed class OrOperator : ConstraintBase, IOperator internal OrOperator(IConstraint left) { - Argument.ThrowIfNull(left); + ArgumentNullException.ThrowIfNull(left); _left = left; } @@ -30,7 +29,7 @@ public override bool IsSatisfiedBy(object? value) public IConstraint SetConstraint(IConstraint constraint) { - Argument.ThrowIfNull(constraint); + ArgumentNullException.ThrowIfNull(constraint); if (_right is NotOperator notOperator) { diff --git a/src/NetEvolve.FluentValue/Operators/XorOperator.cs b/src/NetEvolve.FluentValue/Operators/XorOperator.cs index 805b4bb..a96bea8 100644 --- a/src/NetEvolve.FluentValue/Operators/XorOperator.cs +++ b/src/NetEvolve.FluentValue/Operators/XorOperator.cs @@ -2,7 +2,6 @@ using System; using System.Text; -using NetEvolve.Arguments; using NetEvolve.FluentValue; using NetEvolve.FluentValue.Constraints; @@ -13,7 +12,7 @@ internal sealed class XorOperator : ConstraintBase, IOperator internal XorOperator(IConstraint left) { - Argument.ThrowIfNull(left); + ArgumentNullException.ThrowIfNull(left); _left = left; } @@ -30,7 +29,7 @@ public override bool IsSatisfiedBy(object? value) public IConstraint SetConstraint(IConstraint constraint) { - Argument.ThrowIfNull(constraint); + ArgumentNullException.ThrowIfNull(constraint); if (_right is NotOperator notOperator) { diff --git a/tests/NetEvolve.FluentValue.Tests.Unit/NetEvolve.FluentValue.Tests.Unit.csproj b/tests/NetEvolve.FluentValue.Tests.Unit/NetEvolve.FluentValue.Tests.Unit.csproj index 37d80fa..b1ec266 100644 --- a/tests/NetEvolve.FluentValue.Tests.Unit/NetEvolve.FluentValue.Tests.Unit.csproj +++ b/tests/NetEvolve.FluentValue.Tests.Unit/NetEvolve.FluentValue.Tests.Unit.csproj @@ -4,10 +4,6 @@ $(NetEvolve_TestTargetFrameworks) - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - diff --git a/tests/NetEvolve.FluentValue.Tests.Unit/TypeExtensionsTests.cs b/tests/NetEvolve.FluentValue.Tests.Unit/TypeExtensionsTests.cs index 71d5d3b..1bb5a55 100644 --- a/tests/NetEvolve.FluentValue.Tests.Unit/TypeExtensionsTests.cs +++ b/tests/NetEvolve.FluentValue.Tests.Unit/TypeExtensionsTests.cs @@ -1,9 +1,6 @@ namespace NetEvolve.FluentValue.Tests.Unit; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; public class TypeExtensionsTests From 355d22de281c4d3b8f88211fb5ab555fb734471f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20St=C3=BChmer?= Date: Mon, 23 Mar 2026 21:58:40 +0100 Subject: [PATCH 2/2] fix: Add permissions section to CI workflow for enhanced access control --- .github/workflows/cicd.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 9a5a559..980f6cd 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -18,6 +18,12 @@ on: - detailed - diagnostic +permissions: + actions: read + contents: write + pull-requests: write + security-events: write + jobs: all: if: github.run_id != 1