-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement .editorconfig applying and result comparing
- Loading branch information
Showing
14 changed files
with
125 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
Sources/Kysect.Configuin.Console/Configuration/EditorConfigApplyConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace Kysect.Configuin.Console.Configuration; | ||
|
||
public class EditorConfigApplyConfiguration | ||
{ | ||
[Required] | ||
public string SolutionPath { get; init; } = null!; | ||
[Required] | ||
public string SourceEditorConfig { get; init; } = null!; | ||
[Required] | ||
public string NewEditorConfig { get; init; } = null!; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
Sources/Kysect.Configuin.Core/DotnetFormat/DotnetFormatWarningGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Kysect.CommonLib.BaseTypes.Extensions; | ||
using Microsoft.Extensions.Logging; | ||
using System.Text.Json; | ||
|
||
namespace Kysect.Configuin.Core.DotnetFormat; | ||
|
||
public class DotnetFormatWarningGenerator | ||
{ | ||
private readonly ILogger _logger; | ||
private readonly DotnetFormatCli _dotnetFormatCli; | ||
|
||
public DotnetFormatWarningGenerator(ILogger logger) | ||
{ | ||
_logger = logger; | ||
|
||
_dotnetFormatCli = new DotnetFormatCli(logger); | ||
} | ||
|
||
public IReadOnlyCollection<DotnetFormatFileReport> GenerateWarnings(string pathToSolution) | ||
{ | ||
string filePath = $"output-{Guid.NewGuid()}.json"; | ||
_logger.LogInformation("Generate dotnet format warnings for {path} will save to {output}", pathToSolution, filePath); | ||
_dotnetFormatCli.Format(pathToSolution, filePath); | ||
string warningFileContent = File.ReadAllText(filePath); | ||
_logger.LogInformation("Remove temp file {path}", filePath); | ||
File.Delete(filePath); | ||
return JsonSerializer.Deserialize<IReadOnlyCollection<DotnetFormatFileReport>>(warningFileContent).ThrowIfNull(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
Sources/Kysect.Configuin.Core/FileSystem/IFileMoveUndoOperation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
namespace Kysect.Configuin.Core.FileSystem; | ||
|
||
public interface IFileMoveUndoOperation | ||
public interface IFileMoveUndoOperation : IDisposable | ||
{ | ||
void Execute(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 9 additions & 7 deletions
16
Sources/Kysect.Configuin.Core/FileSystem/TemporaryFileReplacer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters