Skip to content

Commit

Permalink
Merge pull request #339 from nblumhardt/final-2024.3
Browse files Browse the repository at this point in the history
Minor clean-up
  • Loading branch information
nblumhardt authored Apr 29, 2024
2 parents f4691dc + fd94db4 commit 522821e
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 17 deletions.
1 change: 0 additions & 1 deletion src/Roastery/Data/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using Serilog;
using Serilog.Events;
using SerilogTracing;
using SerilogTracing.Instrumentation;

namespace Roastery.Data;

Expand Down
1 change: 0 additions & 1 deletion src/Roastery/Web/RequestLoggingMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Serilog.Context;
using Serilog.Events;
using SerilogTracing;
using SerilogTracing.Instrumentation;

namespace Roastery.Web;

Expand Down
4 changes: 2 additions & 2 deletions src/SeqCli/Cli/CommandMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ namespace SeqCli.Cli;

public class CommandMetadata : ICommandMetadata
{
public string Name { get; set; } = null!;
public required string Name { get; set; }
public string? SubCommand { get; set; }
public string HelpText { get; set; } = null!;
public required string HelpText { get; set; }
public string? Example { get; set; }
}
2 changes: 1 addition & 1 deletion src/SeqCli/Cli/Commands/AppInstance/CreateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ bool ValidateSettingName(string settingName)

return 0;
}
}
}
4 changes: 2 additions & 2 deletions src/SeqCli/Cli/Commands/Bench/QueryBenchCase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace SeqCli.Cli.Commands.Bench;

class QueryBenchCase
{
public string Id { get; set; } = null!;
public string Query { get; set; } = null!;
public required string Id { get; set; }
public required string Query { get; set; }
public string? SignalExpression { get; set; }

// Not used programmatically at this time.
Expand Down
2 changes: 1 addition & 1 deletion src/SeqCli/Cli/Commands/LogCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected override async Task<int> Run()
continue;

var name = key.Trim();
if (name.StartsWith("@"))
if (name.StartsWith('@'))
name = $"@{name}";

payload[name] = new JValue(value);
Expand Down
1 change: 0 additions & 1 deletion src/SeqCli/Sample/Loader/Simulation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using Seq.Api;
using SeqCli.Ingestion;
using Serilog;
using SerilogTracing;

namespace SeqCli.Sample.Loader;

Expand Down
2 changes: 1 addition & 1 deletion src/SeqCli/Syntax/DurationMoniker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static TimeSpan ToTimeSpan(string duration)

// This is not at all robust; we could use a decent duration parser for use here in `seqcli`.

if (duration.EndsWith("ms"))
if (duration.EndsWith("ms", StringComparison.Ordinal))
return TimeSpan.FromMilliseconds(int.Parse(duration[..^2]));

var value = int.Parse(duration[..^1], CultureInfo.InvariantCulture);
Expand Down
3 changes: 2 additions & 1 deletion src/SeqCli/Templates/Import/TemplateSetImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ static class TemplateSetImporter
bool merge)
{
var ordering = new[] {"users", "signals", "apps", "appinstances",
"dashboards", "sqlqueries", "workspaces", "retentionpolicies", "alerts", "expressionindexes"}.ToList();
"dashboards", "sqlqueries", "workspaces", "retentionpolicies",
"alerts", "expressionindexes"}.ToList();

var sorted = templates.OrderBy(t => ordering.IndexOf(t.ResourceGroup));

Expand Down
12 changes: 6 additions & 6 deletions test/SeqCli.Tests/Cli/CommandLineHostTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public async Task CheckCommandLineHostPicksCorrectCommand()
{
new(
new Lazy<Command>(() => new ActionCommand(() => executed.Add("test"))),
new CommandMetadata {Name = "test"}),
new CommandMetadata {Name = "test", HelpText = "help"}),
new(
new Lazy<Command>(() => new ActionCommand(() => executed.Add("test2"))),
new CommandMetadata {Name = "test2"})
new CommandMetadata {Name = "test2", HelpText = "help"})
};
var commandLineHost = new CommandLineHost(availableCommands);
await commandLineHost.Run(new []{ "test"},new LoggingLevelSwitch());
Expand All @@ -40,10 +40,10 @@ public async Task WhenMoreThanOneSubcommandAndTheUserRunsWithSubcommandEnsurePic
{
new(
new Lazy<Command>(() => new ActionCommand(() => commandsRan.Add("test-subcommand1"))),
new CommandMetadata {Name = "test", SubCommand = "subcommand1"}),
new CommandMetadata {Name = "test", SubCommand = "subcommand1", HelpText = "help"}),
new(
new Lazy<Command>(() => new ActionCommand(() => commandsRan.Add("test-subcommand2"))),
new CommandMetadata {Name = "test", SubCommand = "subcommand2"})
new CommandMetadata {Name = "test", SubCommand = "subcommand2", HelpText = "help"})
};
var commandLineHost = new CommandLineHost(availableCommands);
await commandLineHost.Run(new[] { "test", "subcommand2" }, new LoggingLevelSwitch());
Expand All @@ -61,12 +61,12 @@ public async Task VerboseOptionSetsLoggingLevelToInformation()
{
new(
new Lazy<Command>(() => new ActionCommand(() => { })),
new CommandMetadata {Name = "test"})
new CommandMetadata {Name = "test", HelpText = "help"})
};

var commandLineHost = new CommandLineHost(availableCommands);

await commandLineHost.Run(new[] { "test", "--verbose" }, levelSwitch);
await commandLineHost.Run(["test", "--verbose"], levelSwitch);

Assert.Equal(LogEventLevel.Information, levelSwitch.MinimumLevel);
}
Expand Down

0 comments on commit 522821e

Please sign in to comment.