-
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.
Replace .editorconfig with DotnetConfig
- Loading branch information
Showing
63 changed files
with
905 additions
and
899 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
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,10 +1,10 @@ | ||
using Kysect.Configuin.CodeStyleDoc.Models; | ||
using Kysect.Configuin.EditorConfig.DocumentModel.Nodes; | ||
using Kysect.Configuin.DotnetConfig.Syntax.Nodes; | ||
using Kysect.Configuin.RoslynModels; | ||
|
||
namespace Kysect.Configuin.CodeStyleDoc; | ||
|
||
public interface ICodeStyleGenerator | ||
{ | ||
CodeStyle Generate(EditorConfigDocument editorConfigDocument, RoslynRules roslynRules); | ||
CodeStyle Generate(DotnetConfigDocument dotnetConfigDocument, RoslynRules roslynRules); | ||
} |
2 changes: 1 addition & 1 deletion
2
Sources/Kysect.Configuin.CodeStyleDoc/Kysect.Configuin.CodeStyleDoc.csproj
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,6 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Kysect.Configuin.EditorConfig\Kysect.Configuin.EditorConfig.csproj" /> | ||
<ProjectReference Include="..\Kysect.Configuin.DotnetConfig\Kysect.Configuin.DotnetConfig.csproj" /> | ||
<ProjectReference Include="..\Kysect.Configuin.RoslynModels\Kysect.Configuin.RoslynModels.csproj" /> | ||
</ItemGroup> | ||
</Project> |
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
55 changes: 55 additions & 0 deletions
55
Sources/Kysect.Configuin.Console/Commands/AnalyzeDotnetConfigCommand.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,55 @@ | ||
using Kysect.CommonLib.BaseTypes.Extensions; | ||
using Kysect.Configuin.DotnetConfig.Analyzing; | ||
using Kysect.Configuin.DotnetConfig.Syntax; | ||
using Kysect.Configuin.DotnetConfig.Syntax.Nodes; | ||
using Kysect.Configuin.Learn.Abstraction; | ||
using Kysect.Configuin.RoslynModels; | ||
using Microsoft.Extensions.Logging; | ||
using Spectre.Console.Cli; | ||
using System.ComponentModel; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace Kysect.Configuin.Console.Commands; | ||
|
||
internal sealed class AnalyzeDotnetConfigCommand( | ||
IRoslynRuleDocumentationParser roslynRuleDocumentationParser, | ||
DotnetConfigDocumentParser dotnetConfigDocumentParser, | ||
ILogger logger | ||
) : Command<AnalyzeDotnetConfigCommand.Settings> | ||
{ | ||
public sealed class Settings : CommandSettings | ||
{ | ||
[Description("Path to dotnet config file.")] | ||
[CommandArgument(0, "[dotnet config path]")] | ||
public string? DotnetConfigPath { get; init; } | ||
|
||
[Description("Path to cloned MS Learn repository.")] | ||
[CommandOption("-d|--documentation")] | ||
public string? MsLearnRepositoryPath { get; init; } | ||
} | ||
|
||
public override int Execute([NotNull] CommandContext context, [NotNull] Settings settings) | ||
{ | ||
settings.DotnetConfigPath.ThrowIfNull(); | ||
|
||
DotnetConfigDocumentAnalyzer dotnetConfigDocumentAnalyzer = new DotnetConfigDocumentAnalyzer(); | ||
IDotnetConfigAnalyzeReporter reporter = new DotnetConfigAnalyzeLogReporter(logger); | ||
|
||
RoslynRules roslynRules = settings.MsLearnRepositoryPath is null | ||
? RoslynRuleDocumentationCache.ReadFromCache() | ||
: roslynRuleDocumentationParser.Parse(settings.MsLearnRepositoryPath); | ||
|
||
string editorConfigContent = File.ReadAllText(settings.DotnetConfigPath); | ||
DotnetConfigDocument dotnetConfigDocument = dotnetConfigDocumentParser.Parse(editorConfigContent); | ||
|
||
DotnetConfigMissedConfiguration dotnetConfigMissedConfiguration = dotnetConfigDocumentAnalyzer.GetMissedConfigurations(dotnetConfigDocument, roslynRules); | ||
IReadOnlyCollection<DotnetConfigInvalidOptionValue> incorrectOptionValues = dotnetConfigDocumentAnalyzer.GetIncorrectOptionValues(dotnetConfigDocument, roslynRules); | ||
IReadOnlyCollection<RoslynRuleId> incorrectOptionSeverity = dotnetConfigDocumentAnalyzer.GetIncorrectOptionSeverity(dotnetConfigDocument, roslynRules); | ||
|
||
reporter.ReportMissedConfigurations(dotnetConfigMissedConfiguration); | ||
reporter.ReportIncorrectOptionValues(incorrectOptionValues); | ||
reporter.ReportIncorrectOptionSeverity(incorrectOptionSeverity); | ||
|
||
return 0; | ||
} | ||
} |
55 changes: 0 additions & 55 deletions
55
Sources/Kysect.Configuin.Console/Commands/AnalyzeEditorConfigCommand.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.