Skip to content

Commit

Permalink
Change SettingsValidator method to static
Browse files Browse the repository at this point in the history
The Validate method in SettingsValidator class got changed from an instance method to a static method. This was done to avoid creating unnecessary instances of SettingsValidator when validating settings in GenerateCommand.cs. The related call in GenerateCommand has been modified accordingly.
  • Loading branch information
christianhelle committed Oct 27, 2023
1 parent 6f70d56 commit 67ffe12
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Refitter/GenerateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public override ValidationResult Validate(CommandContext context, Settings setti
if (!settings.NoLogging)
Analytics.Configure();

return new SettingsValidator().Validate(settings);
return SettingsValidator.Validate(settings);
}

public override async Task<int> ExecuteAsync(CommandContext context, Settings settings)
Expand Down
4 changes: 2 additions & 2 deletions src/Refitter/SettingsValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Refitter;

public class SettingsValidator
public static class SettingsValidator
{
public ValidationResult Validate(Settings settings)
public static ValidationResult Validate(Settings settings)
{
if (BothSettingsFilesAreEmpty(settings) || BothSettingsFilesArePresent(settings))
{
Expand Down

0 comments on commit 67ffe12

Please sign in to comment.