From 3e43f6744a0a11deed6541dd9c4cad51eeedddb6 Mon Sep 17 00:00:00 2001 From: "Wenzel, Toni" Date: Wed, 15 Dec 2021 02:10:24 +0100 Subject: [PATCH 1/2] (GH-3479) Add DotNetFormat aliases * fixes #3479 --- .../Fixtures/Tools/DotNet/DotNetFixture.cs | 25 ++ .../DotNet/Format/DotNetFormatterFixture.cs | 21 ++ .../Tools/DotNetCore/DotNetCoreFixture.cs | 15 +- .../Tools/DotNet/Format/DotNetFormatTests.cs | 152 ++++++++++++ src/Cake.Common/Tools/DotNet/DotNetAliases.cs | 218 ++++++++++++++++++ .../DotNet/Format/DotNetFormatSettings.cs | 63 +++++ .../DotNet/Format/DotNetFormatSeverity.cs | 23 ++ .../Tools/DotNet/Format/DotNetFormatter.cs | 144 ++++++++++++ .../Tools/DotNet/DotNetAliases.cake | 12 + 9 files changed, 660 insertions(+), 13 deletions(-) create mode 100644 src/Cake.Common.Tests/Fixtures/Tools/DotNet/DotNetFixture.cs create mode 100644 src/Cake.Common.Tests/Fixtures/Tools/DotNet/Format/DotNetFormatterFixture.cs create mode 100644 src/Cake.Common.Tests/Unit/Tools/DotNet/Format/DotNetFormatTests.cs create mode 100644 src/Cake.Common/Tools/DotNet/Format/DotNetFormatSettings.cs create mode 100644 src/Cake.Common/Tools/DotNet/Format/DotNetFormatSeverity.cs create mode 100644 src/Cake.Common/Tools/DotNet/Format/DotNetFormatter.cs diff --git a/src/Cake.Common.Tests/Fixtures/Tools/DotNet/DotNetFixture.cs b/src/Cake.Common.Tests/Fixtures/Tools/DotNet/DotNetFixture.cs new file mode 100644 index 0000000000..3fa46ee699 --- /dev/null +++ b/src/Cake.Common.Tests/Fixtures/Tools/DotNet/DotNetFixture.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Cake.Common.Tools.DotNet; +using Cake.Core.IO; +using Cake.Testing.Fixtures; + +namespace Cake.Common.Tests.Fixtures.Tools.DotNet +{ + internal abstract class DotNetFixture : ToolFixture + where TSettings : DotNetSettings, new() + { + protected DotNetFixture() + : base("dotnet.exe") + { + ProcessRunner.Process.SetStandardOutput(new string[] { }); + } + + protected override ToolFixtureResult CreateResult(FilePath path, ProcessSettings process) + { + return new ToolFixtureResult(path, process); + } + } +} diff --git a/src/Cake.Common.Tests/Fixtures/Tools/DotNet/Format/DotNetFormatterFixture.cs b/src/Cake.Common.Tests/Fixtures/Tools/DotNet/Format/DotNetFormatterFixture.cs new file mode 100644 index 0000000000..f7d678036d --- /dev/null +++ b/src/Cake.Common.Tests/Fixtures/Tools/DotNet/Format/DotNetFormatterFixture.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Cake.Common.Tools.DotNet.Format; + +namespace Cake.Common.Tests.Fixtures.Tools.DotNet.Format +{ + internal sealed class DotNetFormatterFixture : DotNetFixture + { + public string Root { get; set; } + + public string Subcommand { get; set; } + + protected override void RunTool() + { + var tool = new DotNetFormatter(FileSystem, Environment, ProcessRunner, Tools); + tool.Format(Root, Subcommand, Settings); + } + } +} diff --git a/src/Cake.Common.Tests/Fixtures/Tools/DotNetCore/DotNetCoreFixture.cs b/src/Cake.Common.Tests/Fixtures/Tools/DotNetCore/DotNetCoreFixture.cs index 6f95302d4b..84b5075b37 100644 --- a/src/Cake.Common.Tests/Fixtures/Tools/DotNetCore/DotNetCoreFixture.cs +++ b/src/Cake.Common.Tests/Fixtures/Tools/DotNetCore/DotNetCoreFixture.cs @@ -2,24 +2,13 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using Cake.Common.Tests.Fixtures.Tools.DotNet; using Cake.Common.Tools.DotNet; -using Cake.Core.IO; -using Cake.Testing.Fixtures; namespace Cake.Common.Tests.Fixtures.Tools.DotNetCore { - internal abstract class DotNetCoreFixture : ToolFixture + internal abstract class DotNetCoreFixture : DotNetFixture where TSettings : DotNetSettings, new() { - protected DotNetCoreFixture() - : base("dotnet.exe") - { - ProcessRunner.Process.SetStandardOutput(new string[] { }); - } - - protected override ToolFixtureResult CreateResult(FilePath path, ProcessSettings process) - { - return new ToolFixtureResult(path, process); - } } } \ No newline at end of file diff --git a/src/Cake.Common.Tests/Unit/Tools/DotNet/Format/DotNetFormatTests.cs b/src/Cake.Common.Tests/Unit/Tools/DotNet/Format/DotNetFormatTests.cs new file mode 100644 index 0000000000..4921371013 --- /dev/null +++ b/src/Cake.Common.Tests/Unit/Tools/DotNet/Format/DotNetFormatTests.cs @@ -0,0 +1,152 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Cake.Common.Tests.Fixtures.Tools.DotNet.Format; +using Cake.Common.Tools.DotNet.Format; +using Cake.Testing; +using Xunit; + +namespace Cake.Common.Tests.Unit.Tools.DotNet.Format +{ + public sealed class DotNetFormatTests + { + public sealed class TheFormatMethod + { + [Fact] + public void Should_Throw_If_Settings_Are_Null() + { + // Given + var fixture = new DotNetFormatterFixture(); + fixture.Root = "./src/project"; + fixture.Settings = null; + fixture.GivenDefaultToolDoNotExist(); + + // When + var result = Record.Exception(() => fixture.Run()); + + // Then + AssertEx.IsArgumentNullException(result, "settings"); + } + + [Fact] + public void Should_Throw_If_Root_Is_Null() + { + // Given + var fixture = new DotNetFormatterFixture(); + fixture.Settings = new DotNetFormatSettings(); + fixture.GivenDefaultToolDoNotExist(); + + // When + var result = Record.Exception(() => fixture.Run()); + + // Then + AssertEx.IsArgumentNullException(result, "root"); + } + + [Fact] + public void Should_Throw_If_Process_Was_Not_Started() + { + // Given + var fixture = new DotNetFormatterFixture(); + fixture.Root = "./src/project"; + fixture.GivenProcessCannotStart(); + + // When + var result = Record.Exception(() => fixture.Run()); + + // Then + AssertEx.IsCakeException(result, ".NET CLI: Process was not started."); + } + + [Fact] + public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code() + { + // Given + var fixture = new DotNetFormatterFixture(); + fixture.Root = "./src/project"; + fixture.GivenProcessExitsWithCode(1); + + // When + var result = Record.Exception(() => fixture.Run()); + + // Then + AssertEx.IsCakeException(result, ".NET CLI: Process returned an error (exit code 1)."); + } + + [Fact] + public void Should_Add_Mandatory_Arguments() + { + // Given + var fixture = new DotNetFormatterFixture(); + fixture.Root = "./src/project"; + + // When + var result = fixture.Run(); + + // Then + Assert.Equal("format \"./src/project\"", result.Args); + } + + [Fact] + public void Should_Add_Additional_Arguments() + { + // Given + var fixture = new DotNetFormatterFixture(); + fixture.Settings.Diagnostics.Add("CS123"); + fixture.Settings.Diagnostics.Add("CA555"); + fixture.Settings.Severity = DotNetFormatSeverity.Warning; + fixture.Settings.NoRestore = true; + fixture.Settings.VerifyNoChanges = true; + fixture.Settings.Include.Add("./src/"); + fixture.Settings.Include.Add("./tests/"); + fixture.Settings.Exclude.Add("./src/submodule-a/"); + fixture.Settings.IncludeGenerated = true; + fixture.Settings.Verbosity = Common.Tools.DotNet.DotNetVerbosity.Diagnostic; + fixture.Settings.BinaryLog = "./temp/b.log"; + fixture.Settings.Report = "./temp/report.json"; + fixture.Root = "./src/project"; + + // When + var result = fixture.Run(); + + // Then + var expected = "format \"./src/project\" --diagnostics CS123 CA555 --severity warn --no-restore --verify-no-changes --include ./src/ ./tests/ --exclude ./src/submodule-a/ --include-generated"; + expected += " --binarylog \"/Working/temp/b.log\" --report \"/Working/temp/report.json\" --verbosity diagnostic"; + Assert.Equal(expected, result.Args); + } + + [Theory] + [InlineData("./src/project", "format \"./src/project\"")] + [InlineData("./src/cake build/", "format \"./src/cake build/\"")] + [InlineData("./src/cake build/cake cli", "format \"./src/cake build/cake cli\"")] + public void Should_Quote_Root_Path(string text, string expected) + { + // Given + var fixture = new DotNetFormatterFixture(); + fixture.Root = text; + + // When + var result = fixture.Run(); + + // Then + Assert.Equal(expected, result.Args); + } + + [Fact] + public void Should_Add_Subcommand() + { + // Given + var fixture = new DotNetFormatterFixture(); + fixture.Root = "./src/project"; + fixture.Subcommand = "style"; + + // When + var result = fixture.Run(); + + // Then + Assert.Equal("format style \"./src/project\"", result.Args); + } + } + } +} diff --git a/src/Cake.Common/Tools/DotNet/DotNetAliases.cs b/src/Cake.Common/Tools/DotNet/DotNetAliases.cs index 29b91eb793..660a5d9c5d 100644 --- a/src/Cake.Common/Tools/DotNet/DotNetAliases.cs +++ b/src/Cake.Common/Tools/DotNet/DotNetAliases.cs @@ -9,6 +9,7 @@ using Cake.Common.Tools.DotNet.BuildServer; using Cake.Common.Tools.DotNet.Clean; using Cake.Common.Tools.DotNet.Execute; +using Cake.Common.Tools.DotNet.Format; using Cake.Common.Tools.DotNet.MSBuild; using Cake.Common.Tools.DotNet.NuGet.Delete; using Cake.Common.Tools.DotNet.NuGet.Push; @@ -1603,5 +1604,222 @@ public static void DotNetBuildServerShutdown(this ICakeContext context, DotNetBu buildServer.Shutdown(settings ?? new DotNetBuildServerShutdownSettings()); } + + /// + /// Formats code to match editorconfig settings. + /// + /// The context. + /// The project or solution path. + /// + /// + /// DotNetFormat("./src/project"); + /// + /// + [CakeMethodAlias] + [CakeAliasCategory("Format")] + [CakeNamespaceImport("Cake.Common.Tools.DotNet.Format")] + public static void DotNetFormat(this ICakeContext context, string root) + { + context.DotNetFormat(root, null); + } + + /// + /// Formats code to match editorconfig settings. + /// + /// The context. + /// The project or solution path. + /// The settings. + /// + /// + /// var settings = new DotNetFormatSettings + /// { + /// NoRestore = true, + /// Include = "Program.cs Utility\Logging.cs", + /// Severity = DotNetFormatSeverity.Error + /// }; + /// + /// DotNetFormat("./src/project", settings); + /// + /// + [CakeMethodAlias] + [CakeAliasCategory("Format")] + [CakeNamespaceImport("Cake.Common.Tools.DotNet.Format")] + public static void DotNetFormat(this ICakeContext context, string root, DotNetFormatSettings settings) + { + if (context is null) + { + throw new ArgumentNullException(nameof(context)); + } + + if (settings is null) + { + settings = new DotNetFormatSettings(); + } + + var formatter = new DotNetFormatter(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools); + formatter.Format(root, null, settings); + } + + /// + /// Format code to match editorconfig settings for whitespace. + /// + /// The context. + /// The project or solution path. + /// + /// + /// DotNetFormatWhitespace("./src/*"); + /// + /// + [CakeMethodAlias] + [CakeAliasCategory("Format")] + [CakeNamespaceImport("Cake.Common.Tools.DotNet.Format")] + public static void DotNetFormatWhitespace(this ICakeContext context, string root) + { + context.DotNetFormatWhitespace(root, null); + } + + /// + /// Format code to match editorconfig settings for whitespace. + /// + /// The context. + /// The project or solution path. + /// The settings. + /// + /// + /// var settings = new DotNetFormatSettings + /// { + /// NoRestore = true, + /// Include = "Program.cs Utility\Logging.cs" + /// }; + /// + /// DotNetFormatWhitespace("./src/*", settings); + /// + /// + [CakeMethodAlias] + [CakeAliasCategory("Format")] + [CakeNamespaceImport("Cake.Common.Tools.DotNet.Format")] + public static void DotNetFormatWhitespace(this ICakeContext context, string root, DotNetFormatSettings settings) + { + if (context == null) + { + throw new ArgumentNullException(nameof(context)); + } + + if (settings == null) + { + settings = new DotNetFormatSettings(); + } + + var formater = new DotNetFormatter(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools); + formater.Format(root, "whitespace", settings); + } + + /// + /// Format code to match editorconfig settings for code style. + /// + /// The context. + /// The project or solution path. + /// + /// + /// DotNetFormatStyle("./src/*"); + /// + /// + [CakeMethodAlias] + [CakeAliasCategory("Format")] + [CakeNamespaceImport("Cake.Common.Tools.DotNet.Format")] + public static void DotNetFormatStyle(this ICakeContext context, string root) + { + context.DotNetFormatStyle(root, null); + } + + /// + /// Format code to match editorconfig settings for code style. + /// + /// The context. + /// The project or solution path. + /// The settings. + /// + /// + /// var settings = new DotNetFormatSettings + /// { + /// NoRestore = true, + /// Include = "Program.cs Utility\Logging.cs" + /// }; + /// + /// DotNetFormatStyle("./src/*", settings); + /// + /// + [CakeMethodAlias] + [CakeAliasCategory("Format")] + [CakeNamespaceImport("Cake.Common.Tools.DotNet.Format")] + public static void DotNetFormatStyle(this ICakeContext context, string root, DotNetFormatSettings settings) + { + if (context == null) + { + throw new ArgumentNullException(nameof(context)); + } + + if (settings == null) + { + settings = new DotNetFormatSettings(); + } + + var formater = new DotNetFormatter(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools); + formater.Format(root, "style", settings); + } + + /// + /// Format code to match editorconfig settings for analyzers. + /// + /// The context. + /// The project or solution path. + /// + /// + /// DotNetFormatAnalyzers("./src/*"); + /// + /// + [CakeMethodAlias] + [CakeAliasCategory("Format")] + [CakeNamespaceImport("Cake.Common.Tools.DotNet.Format")] + public static void DotNetFormatAnalyzers(this ICakeContext context, string project) + { + context.DotNetFormatAnalyzers(project, null); + } + + /// + /// Format code to match editorconfig settings for analyzers. + /// + /// The context. + /// The project or solution path. + /// The settings. + /// + /// + /// var settings = new DotNetFormatSettings + /// { + /// NoRestore = true, + /// Include = "Program.cs Utility\Logging.cs" + /// }; + /// + /// DotNetFormatAnalyzers("./src/*", settings); + /// + /// + [CakeMethodAlias] + [CakeAliasCategory("Format")] + [CakeNamespaceImport("Cake.Common.Tools.DotNet.Format")] + public static void DotNetFormatAnalyzers(this ICakeContext context, string root, DotNetFormatSettings settings) + { + if (context == null) + { + throw new ArgumentNullException(nameof(context)); + } + + if (settings == null) + { + settings = new DotNetFormatSettings(); + } + + var formater = new DotNetFormatter(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools); + formater.Format(root, "analzers", settings); + } } } diff --git a/src/Cake.Common/Tools/DotNet/Format/DotNetFormatSettings.cs b/src/Cake.Common/Tools/DotNet/Format/DotNetFormatSettings.cs new file mode 100644 index 0000000000..7bd4c4ed09 --- /dev/null +++ b/src/Cake.Common/Tools/DotNet/Format/DotNetFormatSettings.cs @@ -0,0 +1,63 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using Cake.Core.IO; + +namespace Cake.Common.Tools.DotNet.Format +{ + /// + /// Contains settings used by . + /// + public class DotNetFormatSettings : DotNetSettings + { + /// + /// Gets or sets a space-separated list of diagnostic IDs to use as a filter when fixing code style or third-party issues. + /// + public ICollection Diagnostics { get; set; } = new List(); + + /// + /// Gets or sets the minimum severity of diagnostics to fix. + /// + public DotNetFormatSeverity? Severity { get; set; } + + /// + /// Gets or sets a value indicating whether to not do implicit NuGet package restore. + /// This makes build faster, but requires restore to be done before build is executed. + /// + public bool NoRestore { get; set; } + + /// + /// Gets or sets a value indicating whether to verify that no formatting changes would be performed. + /// Terminates with a non zero exit code if any files would have been formatted. + /// + public bool VerifyNoChanges { get; set; } + + /// + /// Gets or sets a space-separated list of relative file or folder paths to include in formatting. + /// All files in the solution or project are formatted if empty. + /// + public ICollection Include { get; set; } = new List(); + + /// + /// Gets or sets a space-separated list of relative file or folder paths to exclude from formatting. The default is none. + /// + public ICollection Exclude { get; set; } = new List(); + + /// + /// Gets or sets a value indicating whether to format files generated by the SDK. + /// + public bool IncludeGenerated { get; set; } + + /// + /// Gets or sets a value indicating whether to log all project or solution load information to a binary log file. + /// + public FilePath BinaryLog { get; set; } + + /// + /// Gets or sets a path to a JSON report. + /// + public FilePath Report { get; set; } + } +} diff --git a/src/Cake.Common/Tools/DotNet/Format/DotNetFormatSeverity.cs b/src/Cake.Common/Tools/DotNet/Format/DotNetFormatSeverity.cs new file mode 100644 index 0000000000..b501c8ef71 --- /dev/null +++ b/src/Cake.Common/Tools/DotNet/Format/DotNetFormatSeverity.cs @@ -0,0 +1,23 @@ +namespace Cake.Common.Tools.DotNet.Format +{ + /// + /// Severity of dotnet format. + /// + public enum DotNetFormatSeverity + { + /// + /// Information + /// + Info, + + /// + /// Warning + /// + Warning, + + /// + /// Error + /// + Error + } +} diff --git a/src/Cake.Common/Tools/DotNet/Format/DotNetFormatter.cs b/src/Cake.Common/Tools/DotNet/Format/DotNetFormatter.cs new file mode 100644 index 0000000000..225893a7f0 --- /dev/null +++ b/src/Cake.Common/Tools/DotNet/Format/DotNetFormatter.cs @@ -0,0 +1,144 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Linq; +using Cake.Core; +using Cake.Core.IO; +using Cake.Core.Tooling; + +namespace Cake.Common.Tools.DotNet.Format +{ + /// + /// .NET project formatter. + /// + public sealed class DotNetFormatter : DotNetTool + { + private readonly ICakeEnvironment _environment; + + /// + /// Initializes a new instance of the class. + /// + /// The file system. + /// The environment. + /// The process runner. + /// The tool locator. + public DotNetFormatter( + IFileSystem fileSystem, + ICakeEnvironment environment, + IProcessRunner processRunner, + IToolLocator tools) : base(fileSystem, environment, processRunner, tools) + { + _environment = environment; + } + + /// + /// Format the project or solution using the specified path and settings. + /// + /// The target project or solution path. + /// The sub command. + /// The settings. + public void Format(string root, string subcommand, DotNetFormatSettings settings) + { + if (root == null) + { + throw new ArgumentNullException(nameof(root)); + } + + if (settings == null) + { + throw new ArgumentNullException(nameof(settings)); + } + + RunCommand(settings, GetArguments(root, subcommand, settings)); + } + + private ProcessArgumentBuilder GetArguments(string root, string subcommand, DotNetFormatSettings settings) + { + var builder = CreateArgumentBuilder(settings); + + builder.Append("format"); + + // Subcommand + if (!string.IsNullOrWhiteSpace(subcommand)) + { + builder.Append(subcommand); + } + + // Specific path? + if (root != null) + { + builder.AppendQuoted(root); + } + + // Diagnostics + if (settings.Diagnostics != null && settings.Diagnostics.Any()) + { + builder.AppendSwitch("--diagnostics", string.Join(" ", settings.Diagnostics)); + } + + // Severity + if (settings.Severity.HasValue) + { + builder.Append("--severity"); + builder.Append(GetSeverityValue(settings.Severity.Value)); + } + + // No Restore + if (settings.NoRestore) + { + builder.Append("--no-restore"); + } + + // Verify No Changes + if (settings.VerifyNoChanges) + { + builder.Append("--verify-no-changes"); + } + + // Include + if (settings.Include != null && settings.Include.Any()) + { + builder.AppendSwitch("--include", string.Join(" ", settings.Include)); + } + + // Exclude + if (settings.Exclude != null && settings.Exclude.Any()) + { + builder.AppendSwitch("--exclude", string.Join(" ", settings.Exclude)); + } + + // Include Generated + if (settings.IncludeGenerated) + { + builder.Append("--include-generated"); + } + + // Binary Log + if (settings.BinaryLog != null) + { + builder.AppendSwitchQuoted($"--binarylog", settings.BinaryLog.MakeAbsolute(_environment).FullPath); + } + + // Report + if (settings.Report != null) + { + builder.AppendSwitchQuoted($"--report", settings.Report.MakeAbsolute(_environment).FullPath); + } + + return builder; + } + + private static string GetSeverityValue(DotNetFormatSeverity value) + { + return value switch + { + DotNetFormatSeverity.Info => "info", + DotNetFormatSeverity.Warning => "warn", + DotNetFormatSeverity.Error => "error", + _ => throw new InvalidOperationException($"Unknown severity value '{value}'"), + }; + } + } +} diff --git a/tests/integration/Cake.Common/Tools/DotNet/DotNetAliases.cake b/tests/integration/Cake.Common/Tools/DotNet/DotNetAliases.cake index 1db1ed92d3..b6714090cf 100644 --- a/tests/integration/Cake.Common/Tools/DotNet/DotNetAliases.cake +++ b/tests/integration/Cake.Common/Tools/DotNet/DotNetAliases.cake @@ -242,6 +242,17 @@ Task("Cake.Common.Tools.DotNet.DotNetAliases.DotNetTest.Fail") Assert.Equal(exception.Message, ".NET CLI: Process returned an error (exit code 1)."); }); +Task("Cake.Common.Tools.DotNet.DotNetAliases.DotNetFormat") + .IsDependentOn("Cake.Common.Tools.DotNet.DotNetAliases.Setup") + .Does(() => +{ + // Given + var path = Paths.Temp.Combine("./Cake.Common/Tools/DotNet"); + var project = path.CombineWithFilePath("hwapp/hwapp.csproj"); + + // When + DotNetFormat(project.FullPath); +}); Task("Cake.Common.Tools.DotNet.DotNetAliases.DotNetBuildServerShutdown") .IsDependentOn("Cake.Common.Tools.DotNet.DotNetAliases.DotNetRestore") @@ -258,6 +269,7 @@ Task("Cake.Common.Tools.DotNet.DotNetAliases.DotNetBuildServerShutdown") .IsDependentOn("Cake.Common.Tools.DotNet.DotNetAliases.DotNetClean") .IsDependentOn("Cake.Common.Tools.DotNet.DotNetAliases.DotNetMSBuild") .IsDependentOn("Cake.Common.Tools.DotNet.DotNetAliases.DotNetTest.Fail") + .IsDependentOn("Cake.Common.Tools.DotNet.DotNetAliases.DotNetFormat") .Does(() => { // When From a4775b1183a73c13caead13ef7e6858f3c19cb62 Mon Sep 17 00:00:00 2001 From: "Wenzel, Toni" Date: Wed, 15 Dec 2021 07:51:41 +0100 Subject: [PATCH 2/2] Fix typos --- src/Cake.Common/Tools/DotNet/DotNetAliases.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Cake.Common/Tools/DotNet/DotNetAliases.cs b/src/Cake.Common/Tools/DotNet/DotNetAliases.cs index 660a5d9c5d..88f1e28a47 100644 --- a/src/Cake.Common/Tools/DotNet/DotNetAliases.cs +++ b/src/Cake.Common/Tools/DotNet/DotNetAliases.cs @@ -1710,8 +1710,8 @@ public static void DotNetFormatWhitespace(this ICakeContext context, string root settings = new DotNetFormatSettings(); } - var formater = new DotNetFormatter(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools); - formater.Format(root, "whitespace", settings); + var formatter = new DotNetFormatter(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools); + formatter.Format(root, "whitespace", settings); } /// @@ -1764,8 +1764,8 @@ public static void DotNetFormatStyle(this ICakeContext context, string root, Dot settings = new DotNetFormatSettings(); } - var formater = new DotNetFormatter(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools); - formater.Format(root, "style", settings); + var formatter = new DotNetFormatter(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools); + formatter.Format(root, "style", settings); } /// @@ -1818,8 +1818,8 @@ public static void DotNetFormatAnalyzers(this ICakeContext context, string root, settings = new DotNetFormatSettings(); } - var formater = new DotNetFormatter(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools); - formater.Format(root, "analzers", settings); + var formatter = new DotNetFormatter(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools); + formatter.Format(root, "analyzers", settings); } } }