Reduced nullability error verbosity in editorconfig

This commit is contained in:
Justin Swanson 2020-06-26 12:33:38 -05:00
parent 761f8aeb56
commit 8548c0c618
5 changed files with 19 additions and 69 deletions

View File

@ -115,79 +115,22 @@ csharp_space_between_method_call_empty_parameter_list_parentheses = false
# Wrapping preferences
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true
###############################
# C# Async Rules #
###############################
# CS4014: Task not awaited
dotnet_diagnostic.CS4014.severity = error
# CS1998: Async function does not contain await
dotnet_diagnostic.CS1998.severity = silent
###############################
# C# Nullability #
# Other #
###############################
# CS8602: Dereference of a possibly null reference.
dotnet_diagnostic.CS8602.severity = error
# CS8600: Converting null literal or possible null value to non-nullable type.
dotnet_diagnostic.CS8600.severity = error
# CS1591: Missing XML comment for publicly visible type or member
dotnet_diagnostic.CS1591.severity = silent
# CS8619: Nullability of reference types in value doesn't match target type.
dotnet_diagnostic.CS8619.severity = error
# CS8603: Possible null reference return.
dotnet_diagnostic.CS8603.severity = error
# CS8625: Cannot convert null literal to non-nullable reference type.
dotnet_diagnostic.CS8625.severity = error
# CS8653: A default expression introduces a null value for a type parameter.
dotnet_diagnostic.CS8653.severity = silent
# CS8601: Possible null reference assignment.
dotnet_diagnostic.CS8601.severity = error
# CS8604: Possible null reference argument.
dotnet_diagnostic.CS8604.severity = error
# CS8622: Nullability of reference types in type of parameter doesn't match the target delegate.
dotnet_diagnostic.CS8622.severity = error
# CS8610: Nullability of reference types in type of parameter doesn't match overridden member.
dotnet_diagnostic.CS8610.severity = error
# CS8618: Non-nullable field is uninitialized. Consider declaring as nullable.
dotnet_diagnostic.CS8618.severity = error
# CS8629: Nullable value type may be null.
dotnet_diagnostic.CS8629.severity = error
# CS8620: Argument cannot be used for parameter due to differences in the nullability of reference types.
dotnet_diagnostic.CS8620.severity = error
# CS8614: Nullability of reference types in type of parameter doesn't match implicitly implemented member.
dotnet_diagnostic.CS8614.severity = error
# CS8617: Nullability of reference types in type of parameter doesn't match implemented member.
dotnet_diagnostic.CS8617.severity = error
# CS8611: Nullability of reference types in type of parameter doesn't match partial method declaration.
dotnet_diagnostic.CS8611.severity = error
# CS8597: Thrown value may be null.
dotnet_diagnostic.CS8597.severity = error
# CS8609: Nullability of reference types in return type doesn't match overridden member.
dotnet_diagnostic.CS8609.severity = error
# CS8714: The type cannot be used as type parameter in the generic type or method. Nullability of type argument doesn't match 'notnull' constraint.
dotnet_diagnostic.CS8714.severity = error
# CS8605: Unboxing a possibly null value.
dotnet_diagnostic.CS8605.severity = error
# CS8613: Nullability of reference types in return type doesn't match implicitly implemented member.
dotnet_diagnostic.CS8613.severity = error
# CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
dotnet_diagnostic.CS8632.severity = error
dotnet_diagnostic.CS1701.severity = silent
dotnet_diagnostic.CS1702.severity = silent

View File

@ -5,6 +5,8 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Platforms>x64</Platforms>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<Version>1.1</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DocumentationFile>Compression.BSA.xml</DocumentationFile>

5
Directory.Build.props Normal file
View File

@ -0,0 +1,5 @@
<Project>
<PropertyGroup>
<WarningsAsErrors>nullable</WarningsAsErrors>
</PropertyGroup>
</Project>

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
@ -244,14 +245,12 @@ namespace Wabbajack.Common
public class IPathConverter : JsonConverter<IPath>
{
public override void WriteJson(JsonWriter writer, IPath value, JsonSerializer serializer)
public override void WriteJson(JsonWriter writer, [AllowNull] IPath value, JsonSerializer serializer)
{
writer.WriteValue(Enum.GetName(typeof(Game), value));
}
public override IPath ReadJson(JsonReader reader, Type objectType, IPath existingValue,
bool hasExistingValue,
JsonSerializer serializer)
public override IPath ReadJson(JsonReader reader, Type objectType, [AllowNull] IPath existingValue, bool hasExistingValue, JsonSerializer serializer)
{
// Backwards compatibility support
var str = reader.Value?.ToString();
@ -260,7 +259,6 @@ namespace Wabbajack.Common
if (Path.IsPathRooted(str))
return (AbsolutePath)str;
return (RelativePath)str;
}
}

View File

@ -14,9 +14,11 @@
<PackageLicenseUrl>https://raw.githubusercontent.com/wabbajack-tools/wabbajack/master/LICENSE.txt</PackageLicenseUrl>
<PackageIconUrl>https://www.wabbajack.org/favicon.ico</PackageIconUrl>
<RepositoryUrl>https://github.com/wabbajack-tools/wabbajack</RepositoryUrl>
<Version>1.1</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DocumentationFile>Wabbajack.Common.xml</DocumentationFile>
<NoWarn></NoWarn>
</PropertyGroup>
<ItemGroup>
<None Remove="7z.dll.gz" />