mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
refactor(services): ♻ downgrade CA1062 since app is fully nullable reference type enabled
This commit is contained in:
parent
350334ddde
commit
8cabf0f725
26 changed files with 18 additions and 69 deletions
|
|
@ -127,5 +127,6 @@ visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public
|
|||
|
||||
# FilterLists Services custom pairs
|
||||
[*.cs]
|
||||
dotnet_diagnostic.CA1062.severity = suggestion
|
||||
dotnet_diagnostic.CA1812.severity = suggestion
|
||||
dotnet_diagnostic.CA2007.severity = none
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
@ -48,7 +47,6 @@ public Handler(
|
|||
|
||||
public async Task<Unit> Handle(Command request, CancellationToken cancellationToken)
|
||||
{
|
||||
_ = request ?? throw new ArgumentNullException(nameof(request));
|
||||
_logger.LogInformation("Archiving list {ListId}", request.ListId);
|
||||
|
||||
var segmentUrls = (await GetSegmentUrlsAsync(request.ListId, cancellationToken)).ToList();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using FilterLists.Archival.Application.Commands;
|
||||
using FilterLists.Archival.Application.Commands;
|
||||
using FilterLists.Archival.Infrastructure;
|
||||
using FilterLists.Archival.Infrastructure.Scheduling;
|
||||
using MediatR;
|
||||
|
|
@ -31,8 +30,6 @@ public static void UseApplication(this IApplicationBuilder app)
|
|||
|
||||
private static void ScheduleArchival(this IApplicationBuilder app)
|
||||
{
|
||||
_ = app ?? throw new ArgumentNullException(nameof(app));
|
||||
|
||||
#if DEBUG
|
||||
new EnqueueArchiveAllLists.Command().EnqueueBackgroundJob();
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace FilterLists.Archival.Domain.SeedWork
|
||||
|
|
@ -8,8 +7,6 @@ public abstract class ValueObject
|
|||
{
|
||||
protected static bool EqualOperator(ValueObject left, ValueObject right)
|
||||
{
|
||||
_ = left ?? throw new ArgumentNullException(nameof(left));
|
||||
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using FilterLists.Archival.Infrastructure.Clients;
|
||||
using FilterLists.Archival.Infrastructure.Clients;
|
||||
using FilterLists.Archival.Infrastructure.Persistence;
|
||||
using FilterLists.Archival.Infrastructure.Scheduling;
|
||||
using FilterLists.Directory.Api.Contracts;
|
||||
|
|
@ -20,8 +19,6 @@ public static IHostBuilder UseInfrastructure(this IHostBuilder hostBuilder)
|
|||
|
||||
public static void AddInfrastructureServices(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
_ = configuration ?? throw new ArgumentNullException(nameof(configuration));
|
||||
|
||||
services.AddSharedKernelLogging(configuration);
|
||||
services.AddSchedulingServices(configuration);
|
||||
services.AddDirectoryApiClient(configuration);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using FilterLists.Archival.Domain.Lists;
|
||||
|
||||
|
|
@ -9,8 +8,6 @@ internal class PlainText : IStreamToPlainTextConversionStrategy
|
|||
{
|
||||
public Stream Convert(ListArchiveSegment listArchiveSegment, CancellationToken cancellationToken)
|
||||
{
|
||||
_ = listArchiveSegment ?? throw new ArgumentNullException(nameof(listArchiveSegment));
|
||||
|
||||
return listArchiveSegment.Content;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@ public override Task<int> SaveChangesAsync(
|
|||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
_ = modelBuilder ?? throw new ArgumentNullException(nameof(modelBuilder));
|
||||
|
||||
modelBuilder.ApplyConfigurationsFromAssembly(GetType().Assembly);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
||||
|
|
@ -16,7 +15,6 @@ internal class DependentTypeConfiguration : IEntityTypeConfiguration<Dependent>
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<Dependent> builder)
|
||||
{
|
||||
_ = builder ?? throw new ArgumentNullException(nameof(builder));
|
||||
builder.ToTable(nameof(Dependent) + "s");
|
||||
builder.HasKey(d => new {d.DependencyFilterListId, d.DependentFilterListId});
|
||||
builder.HasOne(d => d.DependencyFilterList)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ internal class FilterListTypeConfiguration : IEntityTypeConfiguration<FilterList
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<FilterList> builder)
|
||||
{
|
||||
_ = builder ?? throw new ArgumentNullException(nameof(builder));
|
||||
builder.HasDataJsonFile<FilterList>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
||||
|
|
@ -16,7 +15,6 @@ internal class FilterListLanguageTypeConfiguration : IEntityTypeConfiguration<Fi
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<FilterListLanguage> builder)
|
||||
{
|
||||
_ = builder ?? throw new ArgumentNullException(nameof(builder));
|
||||
builder.ToTable(nameof(FilterListLanguage) + "s");
|
||||
builder.HasKey(fll => new {fll.FilterListId, fll.Iso6391});
|
||||
builder.HasDataJsonFile<FilterListLanguage>();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
||||
|
|
@ -16,7 +15,6 @@ internal class FilterListMaintainerTypeConfiguration : IEntityTypeConfiguration<
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<FilterListMaintainer> builder)
|
||||
{
|
||||
_ = builder ?? throw new ArgumentNullException(nameof(builder));
|
||||
builder.ToTable(nameof(FilterListMaintainer) + "s");
|
||||
builder.HasKey(flm => new {flm.FilterListId, flm.MaintainerId});
|
||||
builder.HasDataJsonFile<FilterListMaintainer>();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
||||
|
|
@ -16,7 +15,6 @@ internal class FilterListSyntaxTypeConfiguration : IEntityTypeConfiguration<Filt
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<FilterListSyntax> builder)
|
||||
{
|
||||
_ = builder ?? throw new ArgumentNullException(nameof(builder));
|
||||
builder.ToTable(nameof(FilterListSyntax) + "es");
|
||||
builder.HasKey(fls => new {fls.FilterListId, fls.SyntaxId});
|
||||
builder.HasDataJsonFile<FilterListSyntax>();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
||||
|
|
@ -16,7 +15,6 @@ internal class FilterListTagTypeConfiguration : IEntityTypeConfiguration<FilterL
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<FilterListTag> builder)
|
||||
{
|
||||
_ = builder ?? throw new ArgumentNullException(nameof(builder));
|
||||
builder.ToTable(nameof(FilterListTag) + "s");
|
||||
builder.HasKey(flt => new {flt.FilterListId, flt.TagId});
|
||||
builder.HasDataJsonFile<FilterListTag>();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ internal class FilterListViewUrlConfiguration : IEntityTypeConfiguration<FilterL
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<FilterListViewUrl> builder)
|
||||
{
|
||||
_ = builder ?? throw new ArgumentNullException(nameof(builder));
|
||||
builder.ToTable(nameof(FilterListViewUrl) + "s");
|
||||
builder.Property(u => u.SegmentNumber).HasDefaultValue(1);
|
||||
builder.Property(u => u.Primariness).HasDefaultValue(1);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
||||
|
|
@ -16,7 +15,6 @@ internal class ForkTypeConfiguration : IEntityTypeConfiguration<Fork>
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<Fork> builder)
|
||||
{
|
||||
_ = builder ?? throw new ArgumentNullException(nameof(builder));
|
||||
builder.ToTable(nameof(Fork) + "s");
|
||||
builder.HasKey(f => new {f.UpstreamFilterListId, f.ForkFilterListId});
|
||||
builder.HasOne(f => f.UpstreamFilterList)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
|
|
@ -16,7 +15,6 @@ internal class LanguageTypeConfiguration : IEntityTypeConfiguration<Language>
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<Language> builder)
|
||||
{
|
||||
_ = builder ?? throw new ArgumentNullException(nameof(builder));
|
||||
builder.HasKey(l => l.Iso6391);
|
||||
builder.Property(l => l.Iso6391)
|
||||
.IsFixedLength()
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ internal class LicenseTypeConfiguration : IEntityTypeConfiguration<License>
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<License> builder)
|
||||
{
|
||||
_ = builder ?? throw new ArgumentNullException(nameof(builder));
|
||||
builder.HasDataJsonFile<License>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ internal class MaintainerTypeConfiguration : IEntityTypeConfiguration<Maintainer
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<Maintainer> builder)
|
||||
{
|
||||
_ = builder ?? throw new ArgumentNullException(nameof(builder));
|
||||
builder.HasDataJsonFile<Maintainer>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
||||
|
|
@ -16,7 +15,6 @@ internal class MergeTypeConfiguration : IEntityTypeConfiguration<Merge>
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<Merge> builder)
|
||||
{
|
||||
_ = builder ?? throw new ArgumentNullException(nameof(builder));
|
||||
builder.ToTable(nameof(Merge) + "s");
|
||||
builder.HasKey(m => new {m.IncludedInFilterListId, m.IncludesFilterListId});
|
||||
builder.HasOne(m => m.IncludedInFilterList)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ internal class SoftwareTypeConfiguration : IEntityTypeConfiguration<Software>
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<Software> builder)
|
||||
{
|
||||
_ = builder ?? throw new ArgumentNullException(nameof(builder));
|
||||
builder.HasDataJsonFile<Software>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
||||
|
|
@ -16,7 +15,6 @@ internal class SoftwareSyntaxTypeConfiguration : IEntityTypeConfiguration<Softwa
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<SoftwareSyntax> builder)
|
||||
{
|
||||
_ = builder ?? throw new ArgumentNullException(nameof(builder));
|
||||
builder.ToTable(nameof(SoftwareSyntax) + "es");
|
||||
builder.HasKey(ss => new {ss.SoftwareId, ss.SyntaxId});
|
||||
builder.HasDataJsonFile<SoftwareSyntax>();
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ internal class SyntaxTypeConfiguration : IEntityTypeConfiguration<Syntax>
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<Syntax> builder)
|
||||
{
|
||||
_ = builder ?? throw new ArgumentNullException(nameof(builder));
|
||||
builder.HasDataJsonFile<Syntax>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
|
|
@ -17,7 +16,6 @@ internal class TagTypeConfiguration : IEntityTypeConfiguration<Tag>
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<Tag> builder)
|
||||
{
|
||||
_ = builder ?? throw new ArgumentNullException(nameof(builder));
|
||||
builder.HasDataJsonFile<Tag>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -15,8 +14,6 @@ public static class SeedExtension
|
|||
{
|
||||
public static async Task MigrateAsync(this IHost host)
|
||||
{
|
||||
_ = host ?? throw new ArgumentNullException(nameof(host));
|
||||
|
||||
using var scope = host.Services.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<QueryDbContext>();
|
||||
await db.Database.MigrateAsync();
|
||||
|
|
@ -27,8 +24,6 @@ internal static class SeedConfigurationExtension
|
|||
{
|
||||
public static void HasDataJsonFile<TEntity>(this EntityTypeBuilder entityTypeBuilder)
|
||||
{
|
||||
_ = entityTypeBuilder ?? throw new ArgumentNullException(nameof(entityTypeBuilder));
|
||||
|
||||
var path = Path.Combine("../data", $"{typeof(TEntity).Name}.json");
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using FilterLists.SharedKernel.Logging.Options;
|
||||
using FilterLists.SharedKernel.Logging.Options;
|
||||
using Microsoft.ApplicationInsights.Channel;
|
||||
using Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
|
|
@ -19,8 +18,6 @@ public static IHostBuilder UseLogging(this IHostBuilder hostBuilder)
|
|||
|
||||
public static void AddSharedKernelLogging(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
_ = configuration ?? throw new ArgumentNullException(nameof(configuration));
|
||||
|
||||
using var serverTelemetryChannel = new ServerTelemetryChannel
|
||||
{
|
||||
StorageFolder = configuration.GetSection(ApplicationInsightsOptions.Key)
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@ public static class HostRunner
|
|||
{
|
||||
public static async Task TryRunWithLoggingAsync(this IHost host, Func<Task>? runPreHostAsync = default)
|
||||
{
|
||||
_ = host ?? throw new ArgumentNullException(nameof(host));
|
||||
|
||||
Log.Logger = ConfigurationBuilder.BaseLoggerConfiguration
|
||||
.WriteTo.ApplicationInsights(
|
||||
host.Services.GetRequiredService<TelemetryConfiguration>(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue