Skip to content
Merged
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
24 changes: 24 additions & 0 deletions TryPattern.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
Comment thread
Chris-Wolfgang marked this conversation as resolved.
<!--
Team-shared InspectCode / ReSharper severity profile.

Scope: SOLUTION-WIDE overrides only. Anything scoped to a single folder
(tests, benchmarks, examples) lives in that folder's `.editorconfig`
instead — see tests/.editorconfig, benchmarks/.editorconfig,
examples/VB.DotNet462.Example/VB.DotNet462.Example.vbproj <NoWarn>.

Only src/-facing suppressions belong here.
-->

<!-- CheckNamespace: src/Wolfgang.TryPattern/NotNullAttribute.cs
deliberately declares `internal sealed class NotNullAttribute`
inside `namespace System.Diagnostics.CodeAnalysis` so the compiler
treats it as the runtime polyfill on TFMs that lack the type
(net462 / netstandard2.0). Renaming the namespace would break the
polyfill. This is the only src/ file where CheckNamespace is a
false positive; the finding is silenced globally rather than
per-file because R# .DotSettings does not support file-scoped
severity overrides. -->
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=CheckNamespace/@EntryIndexedValue">DO_NOT_SHOW</s:String>

</wpf:ResourceDictionary>
8 changes: 8 additions & 0 deletions benchmarks/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ dotnet_diagnostic.CA2007.severity = none # .NET: ConfigureAwait
# (Thread.Sleep, etc.) that may be on the banned list.
dotnet_diagnostic.RS0030.severity = none

# RS0016 / RS0037: PublicApiAnalyzer — the analyzer is opt-in per project
# via <AdditionalFiles Condition="Exists('PublicAPI.Shipped.txt')" /> in
# Directory.Build.props. Benchmark projects have no PublicAPI.Shipped.txt.
# MSBuild honors the Condition; InspectCode doesn't, so we silence
# explicitly here.
dotnet_diagnostic.RS0016.severity = none
dotnet_diagnostic.RS0037.severity = none

# Naming — BenchmarkDotNet method names follow Underscore_Style for chart
# readability, conflicting with the usual PascalCase rule set.
dotnet_diagnostic.SA1300.severity = none
Expand Down
2 changes: 2 additions & 0 deletions benchmarks/Wolfgang.TryPattern.Benchmarks/TryBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<!-- ImplicitUsings intentionally NOT enabled — see src csproj. -->
</PropertyGroup>

<ItemGroup>
Expand Down
18 changes: 16 additions & 2 deletions examples/VB.DotNet462.Example/VB.DotNet462.Example.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>VB.DotNet462.Example.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<!--
RS0030 (BannedApiAnalyzers) suppressed here only: the example demonstrates
Try.Run wrapping sync IO (File.ReadAllText) which is on the src-side banned
list, but net462 has no async equivalent (no File.ReadAllTextAsync). The
library src still has RS0030 fully active — this suppression is scoped to
the one example project that cannot avoid the sync API.
-->
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,RS0030</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -33,7 +40,14 @@
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>VB.DotNet462.Example.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<!--
RS0030 (BannedApiAnalyzers) suppressed here only: the example demonstrates
Try.Run wrapping sync IO (File.ReadAllText) which is on the src-side banned
list, but net462 has no async equivalent (no File.ReadAllTextAsync). The
library src still has RS0030 fully active — this suppression is scoped to
the one example project that cannot avoid the sync API.
-->
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,RS0030</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
Expand Down
2 changes: 0 additions & 2 deletions src/Wolfgang.TryPattern/NotNullAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
// runtime-provided types on newer TFMs.
#if !NET5_0_OR_GREATER && !NETSTANDARD2_1_OR_GREATER

using System;

namespace System.Diagnostics.CodeAnalysis
{
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Wolfgang.TryPattern/Result.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public static bool AllSucceeded([NotNull] params Result[]? results)
/// Commonly produced by <see cref="Try.Run{T}(Func{T})"/>, but also useful directly as a return type
/// from repository, service, or validation code that wants to surface a value-or-error outcome.
/// </remarks>
[System.Diagnostics.CodeAnalysis.SuppressMessage(
[SuppressMessage(
"Design",
"CA1000:Do not declare static members on generic types",
Justification = "Result<T>.Failure / Result<T>.Success are factory methods central to the public API; consumers explicitly specify T at the call site by design.")]
Expand Down
13 changes: 7 additions & 6 deletions src/Wolfgang.TryPattern/Wolfgang.TryPattern.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>

<PropertyGroup Condition="
'$(TargetFramework)' == 'net8.0' OR
'$(TargetFramework)' == 'net10.0'
">
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<!--
ImplicitUsings intentionally NOT enabled. Every source file declares its
own `using` directives explicitly so the compiler treats them as required
on ALL target frameworks (rather than "redundant" on TFMs where the SDK
would have provided them implicitly). Removes RedundantUsingDirective
noise from InspectCode without needing to silence it in .DotSettings.
-->

<ItemGroup>
<None Include="..\..\asset\icon.png">
Expand Down
62 changes: 62 additions & 0 deletions tests/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,65 @@ dotnet_diagnostic.S1144.severity = none

# xUnit2013: Use Assert.Single instead of Assert.Equal for collection size
dotnet_diagnostic.xUnit2013.severity = none

# -----------------------------------------------------------------------
# InspectCode-only suppressions (rules already NoWarn'd in the tests csproj
# but InspectCode doesn't read csproj <NoWarn>). Duplicating here so both
# MSBuild-time analyzers and InspectCode agree on the test scope.
# -----------------------------------------------------------------------

# S1481: Unused local — the `unused` variable is intentional in the
# "does not throw" test pattern; renaming would mask the test's purpose.
dotnet_diagnostic.S1481.severity = none

# S2190: Loop without break — false positive on tests that throw to exit
# their loop (see cancellation-token tests).
dotnet_diagnostic.S2190.severity = none

# S2930: IDisposables should be disposed — CTS instances in tests are
# short-lived and scoped inside the test method.
dotnet_diagnostic.S2930.severity = none

# S3928: More meaningful exception message — test fixture exceptions
# are illustrative, not user-facing.
dotnet_diagnostic.S3928.severity = none

# MA0012: NullReferenceException reserved — tests intentionally throw
# NRE to verify Try's exception-handling behavior.
dotnet_diagnostic.MA0012.severity = none

# MA0015: paramName in ArgumentException — same rationale as S3928;
# test-side illustration only.
dotnet_diagnostic.MA0015.severity = none

# VSTHRD003: Awaiting Task started outside context — common test pattern
# (Assert.ThrowsAsync captures the task before await).
dotnet_diagnostic.VSTHRD003.severity = none

# RS0016 / RS0037: PublicApiAnalyzer — the analyzer is opt-in per project
# via <AdditionalFiles Condition="Exists('PublicAPI.Shipped.txt')" /> in
# Directory.Build.props. Test projects have no PublicAPI.Shipped.txt and
# should not be tracked as a public surface. MSBuild honors the Condition;
# InspectCode doesn't, so we silence explicitly here.
dotnet_diagnostic.RS0016.severity = none
dotnet_diagnostic.RS0037.severity = none

# -----------------------------------------------------------------------
# ReSharper-native inspections (no dotnet_diagnostic ID). These fire from
# R#'s own rule engine, not from a Roslyn analyzer package, so they take
# the `resharper_<snake_rule>_highlighting` form.
# -----------------------------------------------------------------------

# AccessToDisposedClosure: cancellation-token tests capture a CTS in a
# local function that is guaranteed to complete before the `using` block
# exits. R# can't see that ordering; the finding is a false positive.
resharper_access_to_disposed_closure_highlighting = none

# RedundantSuppressNullableWarningExpression: cosmetic; test code
# occasionally uses `!` after `Assert.NotNull` for chaining and R# flags
# it once flow analysis kicks in.
resharper_redundant_suppress_nullable_warning_expression_highlighting = none

# ReturnTypeCanBeNotNullable: style suggestion. Some test helpers
# deliberately return nullable to exercise the wrapped pattern.
resharper_return_type_can_be_not_nullable_highlighting = none
2 changes: 2 additions & 0 deletions tests/Wolfgang.TryPattern.Tests.Unit/ResultOfTTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;

namespace Wolfgang.TryPattern.Tests.Unit;

public class ResultOfTTests
Expand Down
2 changes: 2 additions & 0 deletions tests/Wolfgang.TryPattern.Tests.Unit/ResultTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;

namespace Wolfgang.TryPattern.Tests.Unit;

public class ResultTests
Expand Down
3 changes: 1 addition & 2 deletions tests/Wolfgang.TryPattern.Tests.Unit/RunActionTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#if !NET6_0_OR_GREATER
using System;
#endif

namespace Wolfgang.TryPattern.Tests.Unit;

public class RunActionTests
Expand Down
4 changes: 2 additions & 2 deletions tests/Wolfgang.TryPattern.Tests.Unit/RunAsyncActionTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#if !NET6_0_OR_GREATER
using System;
using System.Threading;
using System.Threading.Tasks;
#endif

namespace Wolfgang.TryPattern.Tests.Unit;

public class RunAsyncActionTests
Expand Down
4 changes: 2 additions & 2 deletions tests/Wolfgang.TryPattern.Tests.Unit/RunAsyncFuncTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#if !NET6_0_OR_GREATER
using System;
using System.Threading;
using System.Threading.Tasks;
#endif

namespace Wolfgang.TryPattern.Tests.Unit;

public class RunAsyncFuncTests
Expand Down
3 changes: 1 addition & 2 deletions tests/Wolfgang.TryPattern.Tests.Unit/RunFuncTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#if !NET6_0_OR_GREATER
using System;
#endif

namespace Wolfgang.TryPattern.Tests.Unit;

public class RunFuncTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
<PropertyGroup>
<TargetFrameworks>net462;net472;net48;net481;net5.0;net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<!-- ImplicitUsings intentionally NOT enabled: test files declare
`using` directives explicitly on all TFMs (net462 through
net10.0) so InspectCode doesn't report them as redundant on
TFMs where the SDK would have provided them implicitly. -->
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<Copyright>Copyright 2025 Chris Wolfgang</Copyright>
Expand Down
Loading