Skip to content

Commit

Permalink
what is going on?!?
Browse files Browse the repository at this point in the history
  • Loading branch information
david-driscoll committed Dec 30, 2024
1 parent 3502e6e commit fb34932
Show file tree
Hide file tree
Showing 22 changed files with 103 additions and 226 deletions.
4 changes: 2 additions & 2 deletions .build/Build.CI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static RocketSurgeonGitHubActionsConfiguration CiMiddleware(RocketSurgeon
.ExcludeRepositoryConfigurationFiles()
.Jobs.OfType<RocketSurgeonsGithubActionsJob>()
.First(z => z.Name.Equals("build", StringComparison.OrdinalIgnoreCase));
_ = job
job
.UseDotNetSdks("8.0", "9.0")
.ConfigureStep<CheckoutStep>(step => step.FetchDepth = 0)
.PublishLogs<Pipeline>();
Expand All @@ -73,7 +73,7 @@ public static RocketSurgeonGitHubActionsConfiguration CiMiddleware(RocketSurgeon

public static RocketSurgeonGitHubActionsConfiguration LintStagedMiddleware(RocketSurgeonGitHubActionsConfiguration configuration)
{
_ = configuration
configuration
.Jobs.OfType<RocketSurgeonsGithubActionsJob>()
.First(z => z.Name.Equals("Build", StringComparison.OrdinalIgnoreCase))
.UseDotNetSdks("8.0", "9.0");
Expand Down
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2577,7 +2577,7 @@ roslynator_trailing_comma_style = omit_when_single_line
roslynator_unity_code_analysis.enabled = false
# Applicable to: rcs1169, rcs1213

roslynator_use_anonymous_function_or_method_group = anonymous_function
roslynator_use_anonymous_function_or_method_group = method_group
# Applicable to: rcs1207

roslynator_use_block_body_when_declaration_spans_over_multiple_lines = true
Expand Down Expand Up @@ -4575,7 +4575,7 @@ resharper_braces_redundant = true
resharper_break_template_declaration = line_break
resharper_builtin_type_apply_to_native_integer = false
resharper_can_use_global_alias = true
resharper_configure_await_analysis_mode = disabled
resharper_configure_await_analysis_mode = enabled
resharper_constructor_or_destructor_body = block_body
resharper_continuous_indent_multiplier = 1
resharper_continuous_line_indent = single
Expand Down
6 changes: 3 additions & 3 deletions sample/Sample.BlazorServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

if (builder.Environment.IsDevelopment())
{
_ = app.UseDeveloperExceptionPage();
app.UseDeveloperExceptionPage();
}
else
{
_ = app.UseExceptionHandler("/Error");
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
_ = app.UseHsts();
app.UseHsts();
}

app.UseHttpsRedirection();
Expand Down
26 changes: 6 additions & 20 deletions sample/Sample.BlazorWasm/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,45 +15,31 @@

public static class TestHandler
{
[System.Diagnostics.DebuggerDisplay("{DebuggerDisplay,nq}")]

public record Request : IRequest<Response>
{
public string FirstName { get; set; } = null!;
public string LastName { get; set; } = null!;

[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private string DebuggerDisplay
{
get
{
return ToString();
}
}

}

[System.Diagnostics.DebuggerDisplay("{DebuggerDisplay,nq}")]

public record Response(string FullName)
{
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private string DebuggerDisplay
{
get
{
return ToString();
}
}

}

[UsedImplicitly]
private class RequestValidator : AbstractValidator<Request>
{
public RequestValidator()
{
_ = RuleFor(x => x.FirstName)
RuleFor(x => x.FirstName)
.NotEmpty()
.MinimumLength(1)
.MaximumLength(20);
_ = RuleFor(x => x.LastName)
RuleFor(x => x.LastName)
.NotEmpty()
.MinimumLength(1)
.MaximumLength(50);
Expand Down
31 changes: 3 additions & 28 deletions sample/Sample.Command/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,17 @@
);
await host.RunAsync();

[System.Diagnostics.DebuggerDisplay("{DebuggerDisplay,nq}")]

public class InstanceThing
{
public string From => "DryIoc";

[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private string DebuggerDisplay
{
get
{
return ToString();
}
}
}

[System.Diagnostics.DebuggerDisplay("{DebuggerDisplay,nq}")]
[System.Diagnostics.DebuggerDisplay("{DebuggerDisplay,nq}")]


public class Dump(IConfiguration configuration, ILogger<Dump> logger, InstanceThing instanceThing)
: Command<AppSettings>
{
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private string DebuggerDisplay
{
get
{
return ToString();
}
}

public override int Execute([NotNull] CommandContext context, [NotNull] AppSettings settings)
{
Expand All @@ -72,14 +55,6 @@ public override int Execute([NotNull] CommandContext context, [NotNull] AppSetti

public class DefaultCommand(ILogger<DefaultCommand> logger) : Command<AppSettings>
{
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private string DebuggerDisplay
{
get
{
return ToString();
}
}

public override int Execute([NotNull] CommandContext context, [NotNull] AppSettings settings)
{
Expand Down
6 changes: 3 additions & 3 deletions sample/Sample.Pages/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

if (builder.Environment.IsDevelopment())
{
_ = app.UseDeveloperExceptionPage();
app.UseDeveloperExceptionPage();
}
else
{
_ = app.UseExceptionHandler("/Error");
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
_ = app.UseHsts();
app.UseHsts();
}

app.UseHttpsRedirection();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sample/Sample.Restful/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ internal class CustomHostedService(IOptions<CustomHostedServiceOptions> options)
protected override Task ExecuteAsync(CancellationToken stoppingToken)
{
// ReSharper disable once UnusedVariable
_ = options.Value.A;
options.Value.A;
return Task.CompletedTask;
}
}
4 changes: 4 additions & 0 deletions src/Analyzers.roslyn4.6/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[*]
dotnet_style_prefer_collection_expression = false
roslynator_use_collection_expression = false
resharper_use_collection_expression_highlighting = none
4 changes: 4 additions & 0 deletions src/Analyzers/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[*]
dotnet_style_prefer_collection_expression = false
roslynator_use_collection_expression = false
resharper_use_collection_expression_highlighting = none
20 changes: 6 additions & 14 deletions src/Analyzers/InheritFromGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,13 @@ namespace Rocket.Surgery.LaunchPad.Analyzers;
/// A generator that is used to copy properties, fields and methods from one type onto another.
/// </summary>
[Generator]
[System.Diagnostics.DebuggerDisplay("{DebuggerDisplay,nq}")]

public class InheritFromGenerator : IIncrementalGenerator
{
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private string DebuggerDisplay
{
get
{
return ToString();
}
}

internal static ImmutableHashSet<string> GetExcludedMembers(INamedTypeSymbol targetSymbol, AttributeData attribute)
{
_ = targetSymbol
targetSymbol
.GetMembers()
.Where(z => z.GetAttribute("ExcludeFromGenerationAttribute") is { } || z.GetAttribute("GenerationIgnoreAttribute") is { });

Expand All @@ -37,7 +29,7 @@ internal static ImmutableHashSet<string> GetExcludedMembers(INamedTypeSymbol tar
.GetMembers()
.Where(z => z.GetAttribute("ExcludeFromGenerationAttribute") is { } || z.GetAttribute("GenerationIgnoreAttribute") is { }))
{
_ = builder.Add(item.Name);
builder.Add(item.Name);
}

return builder.ToImmutable();
Expand All @@ -58,8 +50,8 @@ internal static ImmutableArray<IPropertySymbol> GetInheritableMemberSymbols(INam
.GetAttributes()
.Where(z => z.AttributeClass?.Name is "InheritFromAttribute")
.Select(
attribute => ( GetInheritingSymbol(attribute) is not { } inheritFromSymbol )
? []
attribute => GetInheritingSymbol(attribute) is not { } inheritFromSymbol
? ImmutableArray<IPropertySymbol>.Empty
: GetInheritableMemberSymbols(attribute, inheritFromSymbol, excludedProperties)
)
.Aggregate(
Expand Down Expand Up @@ -127,7 +119,7 @@ HashSet<string> excludedProperties
var excludeMembers = GetExcludedMembers(inheritFromSymbol, attribute);
foreach (var excludedProperty in excludeMembers)
{
_ = excludedProperties.Add(excludedProperty);
excludedProperties.Add(excludedProperty);
}

return inheritFromSymbol
Expand Down
26 changes: 8 additions & 18 deletions src/AspNetCore/Conventions/AspNetCoreConvention.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Rocket.Surgery.LaunchPad.AspNetCore.Conventions;
[PublicAPI]
[ExportConvention]
[ConventionCategory(ConventionCategory.Application)]
[System.Diagnostics.DebuggerDisplay("{DebuggerDisplay,nq}")]

public class AspNetCoreConvention(AspNetCoreOptions? options = null) : IServiceConvention
{
internal static void PopulateDefaultParts(
Expand Down Expand Up @@ -90,28 +90,18 @@ private static IEnumerable<Assembly> GetAssemblyClosure(Assembly assembly)

private readonly AspNetCoreOptions _options = options ?? new AspNetCoreOptions();

[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private string DebuggerDisplay
{
get
{
return ToString();
}
}

/// <summary>
/// Registers the specified context.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="configuration"></param>
/// <param name="services"></param>
/// TODO Edit XML Comment Template for Register
[RequiresUnreferencedCode()]
public void Register(IConventionContext context, IConfiguration configuration, IServiceCollection services)
{
ArgumentNullException.ThrowIfNull(context);

_ = services
services
.AddEndpointsApiExplorer()
.AddMvcCore()
.AddApiExplorer();
Expand All @@ -124,14 +114,14 @@ public void Register(IConventionContext context, IConfiguration configuration, I
.SelectMany(f => GetApplicationPartAssemblies(f))
);

_ = services.Configure<MvcOptions>(
services.Configure<MvcOptions>(
options =>
{
_ = options.Filters.Add<NotFoundExceptionFilter>();
_ = options.Filters.Add<NotAuthorizedExceptionFilter>();
_ = options.Filters.Add<RequestFailedExceptionFilter>();
_ = options.Filters.Add<SerilogLoggingActionFilter>(0);
_ = options.Filters.Add<SerilogLoggingPageFilter>(0);
options.Filters.Add<NotFoundExceptionFilter>();
options.Filters.Add<NotAuthorizedExceptionFilter>();
options.Filters.Add<RequestFailedExceptionFilter>();
options.Filters.Add<SerilogLoggingActionFilter>(0);
options.Filters.Add<SerilogLoggingPageFilter>(0);
}
);
}
Expand Down
14 changes: 3 additions & 11 deletions src/Foundation/Conventions/DefaultConvention.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,9 @@ namespace Rocket.Surgery.LaunchPad.Foundation.Conventions;
[PublicAPI]
[ExportConvention]
[ConventionCategory(ConventionCategory.Core)]
[System.Diagnostics.DebuggerDisplay("{DebuggerDisplay,nq}")]

public class DefaultConvention : IServiceConvention, ISetupConvention
{
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private string DebuggerDisplay
{
get
{
return ToString();
}
}

/// <summary>
/// Registers the specified context.
Expand All @@ -36,12 +28,12 @@ private string DebuggerDisplay
/// <param name="services"></param>
public void Register(IConventionContext context, IConfiguration configuration, IServiceCollection services)
{
_ = services
services
.AddOptions()
.AddLogging()
.AddExecuteScopedServices();

_ = services.AddCompiledServiceRegistrations(context.Assembly.GetCompiledTypeProvider());
services.AddCompiledServiceRegistrations(context.Assembly.GetCompiledTypeProvider());
}

void ISetupConvention.Register(IConventionContext context) => context.AddIfMissing("ExecutingAssembly", context.Require<LoadConventions>().Method.Module.Assembly);
Expand Down
Loading

0 comments on commit fb34932

Please sign in to comment.