Skip to content

Commit

Permalink
attempt to minimize the total number of warnings (#1239)
Browse files Browse the repository at this point in the history
* attempt to minimize the total number of warnings

* Update dependency Rocket.Surgery.Nuke to v1.7.2

* wip

* Updated docs generation

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
david-driscoll and renovate[bot] authored Oct 29, 2023
1 parent a9c2912 commit 5104f36
Show file tree
Hide file tree
Showing 106 changed files with 633 additions and 523 deletions.
1 change: 0 additions & 1 deletion .build/.build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<PackageReference Include="Nuke.Common" />
<PackageReference Include="GitVersion.Tool" ExcludeAssets="All" />
<PackageReference Include="ReportGenerator" ExcludeAssets="All" />
<PackageReference Include="docfx.console" ExcludeAssets="All" />
<PackageReference Include="Rocket.Surgery.Nuke" />
</ItemGroup>

Expand Down
3 changes: 3 additions & 0 deletions .build/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*]
#### .NET Coding Conventions ####
resharper_all_underscore_local_parameter_name_highlighting = none
2 changes: 1 addition & 1 deletion .build/Build.CI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static RocketSurgeonGitHubActionsConfiguration CiMiddleware(RocketSurgeon
.ExcludeRepositoryConfigurationFiles()
.AddNugetPublish()
.Jobs.OfType<RocketSurgeonsGithubActionsJob>()
.First(z => z.Name == "Build")
.First(z => z.Name.Equals("build", StringComparison.OrdinalIgnoreCase) )
.UseDotNetSdks("6.0", "7.0")
.AddNuGetCache()
// .ConfigureForGitVersion()
Expand Down
6 changes: 6 additions & 0 deletions .build/Build.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
using System.Collections.Immutable;
using System.Text.Json;
using Nuke.Common;
using Nuke.Common.CI;
using Nuke.Common.Execution;
using Nuke.Common.Git;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tooling;
using Nuke.Common.Tools.DocFX;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.GitVersion;
using Nuke.Common.Tools.MSBuild;
Expand Down Expand Up @@ -44,6 +49,7 @@ public static int Main()
}

private Target Default => _ => _
// ReSharper restore AllUnderscoreLocalParameterName
.DependsOn(Restore)
.DependsOn(Build)
.DependsOn(Test)
Expand Down
4 changes: 4 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
"nukeeper": {
"version": "0.35.0",
"commands": ["nukeeper"]
},
"docfx": {
"version": "2.72.0",
"commands": ["docfx"]
}
}
}
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,7 @@ dotnet_diagnostic.ca2007.severity = none

# RS0027: Public API with optional parameter(s) should have the most parameters amongst its public overloads.
# dotnet_diagnostic.RS0027.severity = warning
dotnet_diagnostic.cs0436.severity = none

# ReSharper properties
resharper_align_linq_query = true
Expand Down Expand Up @@ -1039,6 +1040,9 @@ dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds =
dotnet_naming_symbols.unity_serialized_field_symbols.resharper_applicable_kinds = unity_serialised_field
dotnet_naming_symbols.unity_serialized_field_symbols.resharper_required_modifiers = instance

# not general purpose
dotnet_diagnostic.ca1711.severity = none

[*.{appxmanifest,asax,ascx,aspx,axaml,build,cg,cginc,compute,dtd,fs,fsi,fsscript,fsx,hlsl,hlsli,hlslinc,master,ml,mli,nuspec,paml,resw,resx,shader,skin,usf,ush,vb,xaml,xamlx,xoml,xsd}]
indent_style = space
indent_size = 4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-ignore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ on:
- '.github/renovate.json'

jobs:
Build:
build:
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ on:
- '.github/renovate.json'

jobs:
Build:
build:
env:
NUGET_PACKAGES: '${{ github.workspace }}/.nuget/packages'
strategy:
Expand Down Expand Up @@ -102,18 +102,23 @@ jobs:
run: |
dotnet tool restore
- name: 🎁 Restore
id: restore
run: |
dotnet nuke Restore --skip
- name: ⚙ Build
id: build
run: |
dotnet nuke Build --skip
- name: 🚦 Test
id: test
run: |
dotnet nuke Test TriggerCodeCoverageReports GenerateCodeCoverageReportCobertura GenerateCodeCoverageBadges GenerateCodeCoverageSummary GenerateCodeCoverageReport --skip
- name: Docs
id: docs
run: |
dotnet nuke Docs --skip
- name: 📦 Pack
id: pack
run: |
dotnet nuke Pack --skip
- name: 🏺 Publish coverage data
Expand Down Expand Up @@ -153,7 +158,7 @@ jobs:
Publish:
needs:
- Build
uses: RocketSurgeonsGuild/actions/.github/workflows/[email protected]
secrets:
RSG_NUGET_API_KEY: '${{ secrets.RSG_NUGET_API_KEY }}'
RSG_AZURE_DEVOPS: '${{ secrets.RSG_AZURE_DEVOPS }}'
uses: RocketSurgeonsGuild/actions/.github/workflows/[email protected]
2 changes: 2 additions & 0 deletions Conventions.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<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">
<s:Boolean x:Key="/Default/CodeEditing/SuppressUninitializedWarningFix/Enabled/@EntryValue">False</s:Boolean>

<s:Boolean x:Key="/Default/CodeInspection/Highlighting/IncludeWarningsInSwea/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=AnnotateCanBeNullParameter/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=AnnotateCanBeNullTypeMember/@EntryIndexedValue">WARNING</s:String>
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<PackageVersion Include="docfx.console" Version="2.59.4" />
<PackageVersion Include="Nuke.Common" Version="7.0.6" />
<PackageVersion Include="ReportGenerator" Version="5.1.26" />
<PackageVersion Include="Rocket.Surgery.Nuke" Version="1.7.1" />
<PackageVersion Include="Rocket.Surgery.Nuke" Version="1.7.2" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Autofac" Version="7.1.0" />
Expand Down
103 changes: 40 additions & 63 deletions docs/docfx.json
Original file line number Diff line number Diff line change
@@ -1,68 +1,45 @@
{
"metadata": [
{
"src": [
"metadata": [
{
"src": "../",
"files": [
"src/**.csproj"
],
"exclude": [
"**/bin/**",
"**/obj/**",
"docs/**"
]
"src": [
{
"src": "../",
"files": ["src/**.csproj"],
"exclude": ["**/bin/**", "**/obj/**", "docs/**"]
}
],
"dest": "api"
}
],
"dest": "api"
}
],
"build": {
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
]
},
{
"files": [
"concepts/**.md",
"concepts/**/toc.yml",
"guides/**.md",
"guides/**/toc.yml",
"toc.yml",
"*.md"
]
}
],
"resource": [
{
"files": [
"images/**"
]
}
],
"overwrite": [
{
"files": [
"apidoc/**.md"
"build": {
"content": [
{
"files": ["api/**.yml", "api/index.md"]
},
{
"files": ["concepts/**.md", "concepts/**/toc.yml", "guides/**.md", "guides/**/toc.yml", "toc.yml", "*.md"]
}
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"dest": "docs",
"globalMetadataFiles": [],
"fileMetadataFiles": [],
"template": [ "default", "theme" ],
"postProcessors": [],
"markdownEngineName": "markdig",
"noLangKeyword": false,
"keepFileLink": false,
"cleanupCacheHistory": false,
"disableGitFeatures": false
}
}
"resource": [
{
"files": ["images/**"]
}
],
"overwrite": [
{
"files": ["apidoc/**.md"],
"exclude": ["obj/**", "_site/**"]
}
],
"dest": "../artifacts/docs",
"globalMetadataFiles": [],
"fileMetadataFiles": [],
"template": ["default", "theme"],
"postProcessors": [],
"markdownEngineName": "markdig",
"noLangKeyword": false,
"keepFileLink": false,
"cleanupCacheHistory": false,
"disableGitFeatures": false
}
}
1 change: 1 addition & 0 deletions docs/docs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>false</IsPackable>
<ImplicitUsings>false</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<None Remove="api/**/*.yml" />
Expand Down
2 changes: 1 addition & 1 deletion sample/Diagnostics/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ internal class Convention : ICommandLineConvention, IServiceConvention
public void Register(IConventionContext context, IConfigurator app)
{
app.AddDelegate(
"test", c => { return 1; }
"test", _ => 1
);
app.AddCommand<MyCommand>("dump");
}
Expand Down
3 changes: 2 additions & 1 deletion sample/Sample.Core/AService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace Sample.Core;

internal class AService : IService
[UsedImplicitly]
internal sealed class AService : IService
{
public string GetString()
{
Expand Down
12 changes: 3 additions & 9 deletions sample/Sample.Core/Databases/DatabaseConfigurator.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
namespace Sample.Core.Databases;

internal class DatabaseConfigurator : IDatabaseConfigurator
internal sealed class DatabaseConfigurator : IDatabaseConfigurator
{
public DatabaseConfigurator()
{
Tables = new List<string>();
Views = new List<string>();
}

public ICollection<string> Tables { get; }
public ICollection<string> Views { get; }
public ICollection<string> Tables { get; } = new List<string>();
public ICollection<string> Views { get; } = new List<string>();

public void AddTable(string name)
{
Expand Down
3 changes: 2 additions & 1 deletion sample/Sample.Core/TestService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace Sample.Core;

internal class TestService : IService
[UsedImplicitly]
internal sealed class TestService : IService
{
public string GetString()
{
Expand Down
4 changes: 1 addition & 3 deletions sample/Sample.DependencyOne/Class1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

namespace Sample.DependencyOne;

public class Class1 : IConvention
{
}
public class Class1 : IConvention;
4 changes: 1 addition & 3 deletions sample/Sample.DependencyTwo/Class2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

namespace Sample.DependencyTwo;

public class Class2 : IConvention
{
}
public class Class2 : IConvention;
14 changes: 5 additions & 9 deletions sample/Sample/DefaultCommand.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
using Sample.Core;
using Spectre.Console;
using Spectre.Console.Cli;

namespace Sample;

public class DefaultCommand : Command<AppSettings>
public class DefaultCommand(IService service) : Command<AppSettings>
{
private readonly IService _service;

public DefaultCommand(IService service)
{
_service = service;
}

#pragma warning disable CS8765 // Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes).
public override int Execute(CommandContext context, AppSettings settings)
#pragma warning restore CS8765 // Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes).
{
Console.WriteLine(_service.GetString());
AnsiConsole.WriteLine(service.GetString());
return 1;
}
}
2 changes: 2 additions & 0 deletions sample/Sample/Dump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public override Task<int> ExecuteAsync(CommandContext context, AppSettings setti
{
foreach (var item in _configuration.AsEnumerable().Reverse())
{
#pragma warning disable CA1848
_logger.LogInformation("{Key}: {Value}", item.Key, item.Value ?? string.Empty);
#pragma warning restore CA1848
}

return Task.FromResult(1);
Expand Down
16 changes: 12 additions & 4 deletions src/Conventions.Abstractions/ConventionContextBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
using Microsoft.Extensions.Logging;
using Rocket.Surgery.Conventions.Adapters;

#if NET7_0_OR_GREATER
using PropertiesType = System.Collections.Generic.IDictionary<object, object>;
using PropertiesDictionary = System.Collections.Generic.Dictionary<object, object>;
#else
using PropertiesType = System.Collections.Generic.IDictionary<object, object?>;
using PropertiesDictionary = System.Collections.Generic.Dictionary<object, object?>;
#endif

namespace Rocket.Surgery.Conventions;

/// <summary>
Expand All @@ -28,18 +36,18 @@ public class ConventionContextBuilder
/// </summary>
/// <param name="properties"></param>
/// <returns></returns>
public static ConventionContextBuilder Create(IDictionary<object, object?>? properties = null)
public static ConventionContextBuilder Create(PropertiesType? properties = null)
{
return new ConventionContextBuilder(properties ?? new Dictionary<object, object?>());
return new ConventionContextBuilder(properties ?? new PropertiesDictionary());
}

/// <summary>
/// Create a context builder with a set of properties
/// </summary>
/// <param name="properties"></param>
public ConventionContextBuilder(IDictionary<object, object?>? properties)
public ConventionContextBuilder(PropertiesType? properties)
{
Properties = new ServiceProviderDictionary(properties ?? new Dictionary<object, object?>());
Properties = new ServiceProviderDictionary(properties ?? new PropertiesDictionary());
}

/// <summary>
Expand Down
Loading

0 comments on commit 5104f36

Please sign in to comment.