From 3c26b6febbe3af13b4850e31ef4cc5c9ed5527b1 Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Sat, 29 Feb 2020 13:50:12 -0800 Subject: [PATCH] Add/use dotnet-format --- .config/dotnet-tools.json | 12 +++++ .github/workflows/format.yml | 30 +++++++++++ .vscode/tasks.json | 50 +++++++++++++++++++ build/dotnet-format-problem-matcher.json | 17 +++++++ .../DiagnosticsCollector.cs | 2 +- .../Logging/LogObject.cs | 2 +- .../Logging/LogValuesFormatter.cs | 2 +- .../Micronetes.Hosting.Runtime/StartupHook.cs | 2 +- .../Micronetes.Hosting/MicronetesHost.cs | 2 +- src/opulence/Opulence/ApplicationGlobals.cs | 4 +- src/opulence/Opulence/ContainerRegistry.cs | 4 +- src/opulence/Opulence/DeploymentKind.cs | 4 +- src/opulence/Opulence/DockerImage.cs | 4 +- src/opulence/Opulence/EnvironmentAttribute.cs | 4 +- src/opulence/Opulence/Environments.cs | 4 +- src/opulence/Opulence/Framework.cs | 4 +- src/opulence/Opulence/FrameworkCollection.cs | 4 +- src/opulence/Opulence/GeneratedAssets.cs | 4 +- src/opulence/Opulence/HelmChartStep.cs | 4 +- src/opulence/Opulence/Pipeline.cs | 8 +-- src/opulence/Opulence/PipelineHolder.cs | 4 +- src/opulence/Opulence/Project.cs | 4 +- src/opulence/Opulence/Secret.cs | 4 +- src/opulence/Opulence/Service.cs | 8 +-- src/opulence/Opulence/ServiceBinding.cs | 4 +- src/opulence/Opulence/Source.cs | 4 +- src/opulence/Opulence/Step.cs | 4 +- src/opulence/dotnet-opulence/Application.cs | 12 ++--- .../dotnet-opulence/ApplicationFactory.cs | 6 +-- .../dotnet-opulence/ApplicationYamlWriter.cs | 4 +- .../dotnet-opulence/BuildDockerImageStep.cs | 6 +-- src/opulence/dotnet-opulence/CombineStep.cs | 2 +- .../dotnet-opulence/CommandException.cs | 10 ++-- .../dotnet-opulence/ConsoleExtensions.cs | 10 ++-- .../dotnet-opulence/CustomizationPipeline.cs | 12 ++--- src/opulence/dotnet-opulence/DeployCommand.cs | 4 +- .../dotnet-opulence/DeployServiceYamlStep.cs | 2 +- src/opulence/dotnet-opulence/DirectoryCopy.cs | 8 +-- .../dotnet-opulence/DirectorySearch.cs | 12 ++--- .../dotnet-opulence/DockerContainerBuilder.cs | 6 +-- src/opulence/dotnet-opulence/DockerPush.cs | 4 +- .../dotnet-opulence/DockerfileGenerator.cs | 6 +-- .../dotnet-opulence/GenerateCommand.cs | 6 +-- .../dotnet-opulence/GenerateDockerfileStep.cs | 4 +- .../dotnet-opulence/GenerateHelmChartStep.cs | 4 +- .../GenerateKubernetesManifestStep.cs | 4 +- .../GenerateOamComponentStep.cs | 4 +- .../dotnet-opulence/HelmChartBuilder.cs | 6 +-- .../dotnet-opulence/HelmChartGenerator.cs | 4 +- src/opulence/dotnet-opulence/HelmPush.cs | 4 +- .../dotnet-opulence/IYamlManifestOutput.cs | 4 +- src/opulence/dotnet-opulence/InitCommand.cs | 14 +++--- .../KubernetesDeploymentOutput.cs | 4 +- .../KubernetesManifestGenerator.cs | 4 +- .../KubernetesServiceOutput.cs | 4 +- src/opulence/dotnet-opulence/Names.cs | 4 +- .../OamApplicationGenerator.cs | 4 +- .../dotnet-opulence/OamComponentGenerator.cs | 8 +-- .../dotnet-opulence/OamComponentOutput.cs | 4 +- src/opulence/dotnet-opulence/OutputContext.cs | 14 +++--- .../dotnet-opulence/PackageCommand.cs | 2 +- src/opulence/dotnet-opulence/Program.cs | 6 +-- src/opulence/dotnet-opulence/ProjectReader.cs | 4 +- src/opulence/dotnet-opulence/PushCommand.cs | 2 +- .../dotnet-opulence/PushDockerImageStep.cs | 4 +- src/opulence/dotnet-opulence/ScriptRunner.cs | 18 +++---- .../dotnet-opulence/ServiceExecutor.cs | 6 +-- .../dotnet-opulence/StandardOptions.cs | 14 +++--- src/opulence/dotnet-opulence/StepView.cs | 4 +- .../dotnet-opulence/TargetInstaller.cs | 2 +- src/opulence/dotnet-opulence/TempDirectory.cs | 4 +- src/opulence/dotnet-opulence/TempFile.cs | 4 +- src/opulence/dotnet-opulence/Templates.cs | 4 +- src/opulence/dotnet-opulence/Verbosity.cs | 4 +- .../dotnet-opulence/WriteServiceYamlStep.cs | 4 +- test/E2ETest/UnitTest1.cs | 2 +- 76 files changed, 298 insertions(+), 189 deletions(-) create mode 100644 .config/dotnet-tools.json create mode 100644 .github/workflows/format.yml create mode 100644 build/dotnet-format-problem-matcher.json diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 00000000..ce5ccf96 --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-format": { + "version": "3.3.111304", + "commands": [ + "dotnet-format" + ] + } + } +} \ No newline at end of file diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 00000000..502d4718 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,30 @@ +name: Format + +on: + pull_request: + branches: + - master + - release/* + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + - name: Setup .NET Core SDK + uses: actions/setup-dotnet@v1.0.0 + with: + version: 3.1.100 + + - name: dotnet tool restore + run: dotnet tool restore + + - name: add dotnet format problem matcher + run: echo "::add-matcher::build/dotnet-format-problem-matcher.json" + + - name: dotnet format + run: dotnet format -w tye.sln --check --dry-run -v diag + diff --git a/.vscode/tasks.json b/.vscode/tasks.json index bdceb1d4..e8a7a0a8 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -12,6 +12,56 @@ "/consoleloggerparameters:NoSummary" ], "problemMatcher": "$msCompile" + }, + { + "label": "format", + "command": "dotnet", + "type": "process", + "args": [ + "dotnet-format", + "-w ${workspaceFolder}/tye.sln" + ], + "problemMatcher": { + "fileLocation": [ + "relative", + "${workspaceFolder}" + ], + "severity": "warning", + "source": "dotnet format", + "pattern": { + "regexp": "^\\s+(.*)\\((\\d+),(\\d+)\\):\\s+(.*)$", + "file": 1, + "line": 2, + "column": 3, + "message": 4, + } + } + } + { + "label": "format-check", + "command": "dotnet", + "type": "process", + "args": [ + "dotnet-format", + "-w ${workspaceFolder}/tye.sln", + "--check", + "--dry-run" + ], + "problemMatcher": { + "fileLocation": [ + "relative", + "${workspaceFolder}" + ], + "severity": "warning", + "source": "dotnet format", + "pattern": { + "regexp": "^\\s+(.*)\\((\\d+),(\\d+)\\):\\s+(.*)$", + "file": 1, + "line": 2, + "column": 3, + "message": 4, + } + } } ] } \ No newline at end of file diff --git a/build/dotnet-format-problem-matcher.json b/build/dotnet-format-problem-matcher.json new file mode 100644 index 00000000..38ecee70 --- /dev/null +++ b/build/dotnet-format-problem-matcher.json @@ -0,0 +1,17 @@ +{ + "problemMatcher": [ + { + "owner": "dotnet-format", + "severity": "warning", + "pattern": [ + { + "regexp": "^\\s+(.*)\\((\\d+),(\\d+)\\):\\s+(.*)$", + "file": 1, + "line": 2, + "column": 3, + "message": 4 + } + ] + } + ] +} \ No newline at end of file diff --git a/src/micronetes/Micronetes.Hosting.Diagnostics/DiagnosticsCollector.cs b/src/micronetes/Micronetes.Hosting.Diagnostics/DiagnosticsCollector.cs index e622c108..09c1d613 100644 --- a/src/micronetes/Micronetes.Hosting.Diagnostics/DiagnosticsCollector.cs +++ b/src/micronetes/Micronetes.Hosting.Diagnostics/DiagnosticsCollector.cs @@ -849,5 +849,5 @@ namespace Micronetes.Hosting.Diagnostics public const EventKeywords JsonMessage = (EventKeywords)8; } } - } + } } diff --git a/src/micronetes/Micronetes.Hosting.Diagnostics/Logging/LogObject.cs b/src/micronetes/Micronetes.Hosting.Diagnostics/Logging/LogObject.cs index e3c85f73..844438b8 100644 --- a/src/micronetes/Micronetes.Hosting.Diagnostics/Logging/LogObject.cs +++ b/src/micronetes/Micronetes.Hosting.Diagnostics/Logging/LogObject.cs @@ -64,4 +64,4 @@ namespace Micronetes.Hosting.Diagnostics.Logging return _formattedMessage ?? string.Empty; } } -} \ No newline at end of file +} diff --git a/src/micronetes/Micronetes.Hosting.Diagnostics/Logging/LogValuesFormatter.cs b/src/micronetes/Micronetes.Hosting.Diagnostics/Logging/LogValuesFormatter.cs index 45a54d30..3ee937b9 100644 --- a/src/micronetes/Micronetes.Hosting.Diagnostics/Logging/LogValuesFormatter.cs +++ b/src/micronetes/Micronetes.Hosting.Diagnostics/Logging/LogValuesFormatter.cs @@ -197,4 +197,4 @@ namespace Micronetes.Hosting.Diagnostics.Logging } } -} \ No newline at end of file +} diff --git a/src/micronetes/Micronetes.Hosting.Runtime/StartupHook.cs b/src/micronetes/Micronetes.Hosting.Runtime/StartupHook.cs index 6ae57ccf..073b5687 100644 --- a/src/micronetes/Micronetes.Hosting.Runtime/StartupHook.cs +++ b/src/micronetes/Micronetes.Hosting.Runtime/StartupHook.cs @@ -21,4 +21,4 @@ internal class StartupHook Thread.Sleep(1000); } } -} \ No newline at end of file +} diff --git a/src/micronetes/Micronetes.Hosting/MicronetesHost.cs b/src/micronetes/Micronetes.Hosting/MicronetesHost.cs index df6cea57..64698dd7 100644 --- a/src/micronetes/Micronetes.Hosting/MicronetesHost.cs +++ b/src/micronetes/Micronetes.Hosting/MicronetesHost.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Threading.Tasks; using Micronetes.Hosting.Diagnostics; diff --git a/src/opulence/Opulence/ApplicationGlobals.cs b/src/opulence/Opulence/ApplicationGlobals.cs index f417f32d..65809ce3 100644 --- a/src/opulence/Opulence/ApplicationGlobals.cs +++ b/src/opulence/Opulence/ApplicationGlobals.cs @@ -1,4 +1,4 @@ -namespace Opulence +namespace Opulence { public sealed class ApplicationGlobals { @@ -8,4 +8,4 @@ namespace Opulence public ContainerRegistry? Registry { get; set; } } -} \ No newline at end of file +} diff --git a/src/opulence/Opulence/ContainerRegistry.cs b/src/opulence/Opulence/ContainerRegistry.cs index 1a50be7e..22350c3c 100644 --- a/src/opulence/Opulence/ContainerRegistry.cs +++ b/src/opulence/Opulence/ContainerRegistry.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Opulence { @@ -16,4 +16,4 @@ namespace Opulence public string Hostname { get; } } -} \ No newline at end of file +} diff --git a/src/opulence/Opulence/DeploymentKind.cs b/src/opulence/Opulence/DeploymentKind.cs index 8137238f..4b7a7144 100644 --- a/src/opulence/Opulence/DeploymentKind.cs +++ b/src/opulence/Opulence/DeploymentKind.cs @@ -1,4 +1,4 @@ -namespace Opulence +namespace Opulence { public enum DeploymentKind { @@ -6,4 +6,4 @@ namespace Opulence Kubernetes, Oam, } -} \ No newline at end of file +} diff --git a/src/opulence/Opulence/DockerImage.cs b/src/opulence/Opulence/DockerImage.cs index d023c1ec..0bbd0674 100644 --- a/src/opulence/Opulence/DockerImage.cs +++ b/src/opulence/Opulence/DockerImage.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Opulence { @@ -16,4 +16,4 @@ namespace Opulence public string Image { get; } } -} \ No newline at end of file +} diff --git a/src/opulence/Opulence/EnvironmentAttribute.cs b/src/opulence/Opulence/EnvironmentAttribute.cs index c4238588..9ee217e1 100644 --- a/src/opulence/Opulence/EnvironmentAttribute.cs +++ b/src/opulence/Opulence/EnvironmentAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Opulence { @@ -16,4 +16,4 @@ namespace Opulence public string EnvironmentName { get; } } -} \ No newline at end of file +} diff --git a/src/opulence/Opulence/Environments.cs b/src/opulence/Opulence/Environments.cs index a89a9a95..3e82304a 100644 --- a/src/opulence/Opulence/Environments.cs +++ b/src/opulence/Opulence/Environments.cs @@ -1,4 +1,4 @@ -namespace Opulence +namespace Opulence { public static class Environments { @@ -6,4 +6,4 @@ namespace Opulence public const string Production = "Production"; } -} \ No newline at end of file +} diff --git a/src/opulence/Opulence/Framework.cs b/src/opulence/Opulence/Framework.cs index e5c4d11d..f99e43c3 100644 --- a/src/opulence/Opulence/Framework.cs +++ b/src/opulence/Opulence/Framework.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Opulence { @@ -16,4 +16,4 @@ namespace Opulence public string Name { get; } } -} \ No newline at end of file +} diff --git a/src/opulence/Opulence/FrameworkCollection.cs b/src/opulence/Opulence/FrameworkCollection.cs index 522cf077..09e36c6a 100644 --- a/src/opulence/Opulence/FrameworkCollection.cs +++ b/src/opulence/Opulence/FrameworkCollection.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -19,4 +19,4 @@ namespace Opulence } } } -} \ No newline at end of file +} diff --git a/src/opulence/Opulence/GeneratedAssets.cs b/src/opulence/Opulence/GeneratedAssets.cs index 07822fbc..90f287d1 100644 --- a/src/opulence/Opulence/GeneratedAssets.cs +++ b/src/opulence/Opulence/GeneratedAssets.cs @@ -1,7 +1,7 @@ -namespace Opulence +namespace Opulence { public sealed class GeneratedAssets { public ContainerInfo? Container { get; set; } } -} \ No newline at end of file +} diff --git a/src/opulence/Opulence/HelmChartStep.cs b/src/opulence/Opulence/HelmChartStep.cs index 1ee05666..2cf2c8a6 100644 --- a/src/opulence/Opulence/HelmChartStep.cs +++ b/src/opulence/Opulence/HelmChartStep.cs @@ -1,4 +1,4 @@ -namespace Opulence +namespace Opulence { public sealed class HelmChartStep : Step { @@ -6,4 +6,4 @@ namespace Opulence public string ChartName { get; set; } = default!; } -} \ No newline at end of file +} diff --git a/src/opulence/Opulence/Pipeline.cs b/src/opulence/Opulence/Pipeline.cs index cf07fd95..77147659 100644 --- a/src/opulence/Opulence/Pipeline.cs +++ b/src/opulence/Opulence/Pipeline.cs @@ -1,11 +1,11 @@ -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; namespace Opulence { public abstract class Pipeline - { + { private static readonly Dictionary> callbacks = new Dictionary>(); public static void Configure(Action callback) @@ -39,7 +39,7 @@ namespace Opulence var method = pipeline.GetType().GetMethod("Register").MakeGenericMethod(type); for (var i = 0; i < delegates.Count; i++) { - method.Invoke(pipeline, new[]{ delegates[i], }); + method.Invoke(pipeline, new[] { delegates[i], }); } } @@ -50,4 +50,4 @@ namespace Opulence public abstract Task ExecuteAsync(); } -} \ No newline at end of file +} diff --git a/src/opulence/Opulence/PipelineHolder.cs b/src/opulence/Opulence/PipelineHolder.cs index 0b0165e7..e6a71374 100644 --- a/src/opulence/Opulence/PipelineHolder.cs +++ b/src/opulence/Opulence/PipelineHolder.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Opulence { @@ -16,4 +16,4 @@ namespace Opulence public Pipeline __Pipeline { get; } } -} \ No newline at end of file +} diff --git a/src/opulence/Opulence/Project.cs b/src/opulence/Opulence/Project.cs index 8ed0a94a..f63778fb 100644 --- a/src/opulence/Opulence/Project.cs +++ b/src/opulence/Opulence/Project.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Opulence { @@ -22,4 +22,4 @@ namespace Opulence public string Version { get; set; } = default!; } -} \ No newline at end of file +} diff --git a/src/opulence/Opulence/Secret.cs b/src/opulence/Opulence/Secret.cs index 0c821ceb..bd379921 100644 --- a/src/opulence/Opulence/Secret.cs +++ b/src/opulence/Opulence/Secret.cs @@ -1,7 +1,7 @@ -namespace Opulence +namespace Opulence { public class Secret { public string? Name { get; set; } } -} \ No newline at end of file +} diff --git a/src/opulence/Opulence/Service.cs b/src/opulence/Opulence/Service.cs index 5549902e..77d89d45 100644 --- a/src/opulence/Opulence/Service.cs +++ b/src/opulence/Opulence/Service.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; namespace Opulence @@ -20,7 +20,7 @@ namespace Opulence public GeneratedAssets GeneratedAssets { get; } = new GeneratedAssets(); public int? Port { get; set; } - + public string? Protocol { get; set; } public Source? Source { get; set; } @@ -28,7 +28,7 @@ namespace Opulence public Dictionary Environment { get; set; } = new Dictionary(); public int Replicas { get; set; } = 1; - + public List Bindings { get; } = new List(); } -} \ No newline at end of file +} diff --git a/src/opulence/Opulence/ServiceBinding.cs b/src/opulence/Opulence/ServiceBinding.cs index 94773df8..a34e1edc 100644 --- a/src/opulence/Opulence/ServiceBinding.cs +++ b/src/opulence/Opulence/ServiceBinding.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Opulence { @@ -32,4 +32,4 @@ namespace Opulence public int? Port { get; set; } public Secret? ConnectionString { get; set; } } -} \ No newline at end of file +} diff --git a/src/opulence/Opulence/Source.cs b/src/opulence/Opulence/Source.cs index c353af29..8af402b7 100644 --- a/src/opulence/Opulence/Source.cs +++ b/src/opulence/Opulence/Source.cs @@ -1,4 +1,4 @@ -namespace Opulence +namespace Opulence { public abstract class Source { @@ -6,4 +6,4 @@ namespace Opulence { } } -} \ No newline at end of file +} diff --git a/src/opulence/Opulence/Step.cs b/src/opulence/Opulence/Step.cs index 7629aab9..8275d112 100644 --- a/src/opulence/Opulence/Step.cs +++ b/src/opulence/Opulence/Step.cs @@ -1,7 +1,7 @@ -namespace Opulence +namespace Opulence { public abstract class Step { public abstract string DisplayName { get; } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/Application.cs b/src/opulence/dotnet-opulence/Application.cs index d609defe..b5dac790 100644 --- a/src/opulence/dotnet-opulence/Application.cs +++ b/src/opulence/dotnet-opulence/Application.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -60,7 +60,7 @@ namespace Opulence throw new ArgumentNullException(nameof(environment)); } - return Environments.Count == 0 || Environments.Contains(environment, StringComparer.OrdinalIgnoreCase); + return Environments.Count == 0 || Environments.Contains(environment, StringComparer.OrdinalIgnoreCase); } internal bool IsMatchForProject(Application application, FileInfo projectFile) @@ -80,7 +80,7 @@ namespace Opulence return true; } - if (Service.Source is Project project && + if (Service.Source is Project project && string.Equals(application.GetProjectDirectory(project), projectFile.DirectoryName, StringComparison.Ordinal)) { return true; @@ -111,7 +111,7 @@ namespace Opulence ImageName = imageName; ImageTag = imageTag; } - + public string ImageName { get; } public string ImageTag { get; } @@ -140,7 +140,7 @@ namespace Opulence RootDirectory = rootDirectory; } - public override ApplicationGlobals Globals + public override ApplicationGlobals Globals { get { @@ -224,4 +224,4 @@ namespace Opulence public override IReadOnlyList Services { get; } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/ApplicationFactory.cs b/src/opulence/dotnet-opulence/ApplicationFactory.cs index edccf541..6f437d3b 100644 --- a/src/opulence/dotnet-opulence/ApplicationFactory.cs +++ b/src/opulence/dotnet-opulence/ApplicationFactory.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; @@ -129,7 +129,7 @@ namespace Opulence } } - var application = new GroveledApplication(globals, solutionFile.DirectoryName, services); + var application = new GroveledApplication(globals, solutionFile.DirectoryName, services); foreach (var service in application.Services) { @@ -139,4 +139,4 @@ namespace Opulence return application; } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/ApplicationYamlWriter.cs b/src/opulence/dotnet-opulence/ApplicationYamlWriter.cs index e3d3a19c..61626a7a 100644 --- a/src/opulence/dotnet-opulence/ApplicationYamlWriter.cs +++ b/src/opulence/dotnet-opulence/ApplicationYamlWriter.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -23,4 +23,4 @@ namespace Opulence return Task.CompletedTask; } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/BuildDockerImageStep.cs b/src/opulence/dotnet-opulence/BuildDockerImageStep.cs index 20379af1..3d1ef9d8 100644 --- a/src/opulence/dotnet-opulence/BuildDockerImageStep.cs +++ b/src/opulence/dotnet-opulence/BuildDockerImageStep.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; namespace Opulence { @@ -7,7 +7,7 @@ namespace Opulence public override string DisplayText => "Building Docker Image..."; public string Environment { get; set; } = "production"; - + public override async Task ExecuteAsync(OutputContext output, Application application, ServiceEntry service) { if (SkipWithoutProject(output, service, out var project)) @@ -28,4 +28,4 @@ namespace Opulence await DockerContainerBuilder.BuildContainerImageAsync(output, application, service, project, container); } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/CombineStep.cs b/src/opulence/dotnet-opulence/CombineStep.cs index 07a9a447..9317131d 100644 --- a/src/opulence/dotnet-opulence/CombineStep.cs +++ b/src/opulence/dotnet-opulence/CombineStep.cs @@ -1,4 +1,4 @@ -using System.CommandLine.Invocation; +using System.CommandLine.Invocation; using System.IO; using System.Linq; using System.Text; diff --git a/src/opulence/dotnet-opulence/CommandException.cs b/src/opulence/dotnet-opulence/CommandException.cs index 41b64c9c..de6cf96c 100644 --- a/src/opulence/dotnet-opulence/CommandException.cs +++ b/src/opulence/dotnet-opulence/CommandException.cs @@ -1,15 +1,15 @@ -using System; +using System; namespace Opulence { internal class CommandException : Exception { - public CommandException(string message) + public CommandException(string message) : base(message) { } - - public CommandException(string message, Exception inner) + + public CommandException(string message, Exception inner) : base(message, inner) { } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/ConsoleExtensions.cs b/src/opulence/dotnet-opulence/ConsoleExtensions.cs index 832aeae7..07748638 100644 --- a/src/opulence/dotnet-opulence/ConsoleExtensions.cs +++ b/src/opulence/dotnet-opulence/ConsoleExtensions.cs @@ -1,10 +1,10 @@ -using System.Linq; +using System.Linq; namespace System.CommandLine { internal static class ConsoleExtensions { - private static bool? _isConsoleRedirectionCheckSupported; + private static bool? _isConsoleRedirectionCheckSupported; private static bool IsConsoleRedirectionCheckSupported { @@ -35,7 +35,7 @@ namespace System.CommandLine ((dynamic)console).ForegroundColor = color; } - if (IsConsoleRedirectionCheckSupported && + if (IsConsoleRedirectionCheckSupported && !Console.IsOutputRedirected) { Console.ForegroundColor = color; @@ -53,7 +53,7 @@ namespace System.CommandLine ((dynamic)console).ForegroundColor = ConsoleColor.Red; } - if (IsConsoleRedirectionCheckSupported && + if (IsConsoleRedirectionCheckSupported && !Console.IsOutputRedirected) { Console.ResetColor(); @@ -64,4 +64,4 @@ namespace System.CommandLine } } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/CustomizationPipeline.cs b/src/opulence/dotnet-opulence/CustomizationPipeline.cs index 2a2d14b2..e4f5e1af 100644 --- a/src/opulence/dotnet-opulence/CustomizationPipeline.cs +++ b/src/opulence/dotnet-opulence/CustomizationPipeline.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -74,7 +74,7 @@ namespace Opulence string? projectFilePath = null; if (solution != null) { - var project = FindProjectInSolution(solution, service.FriendlyName); + var project = FindProjectInSolution(solution, service.FriendlyName); if (project == null) { output.WriteDebugLine($"Could not find project for service '{service.FriendlyName}'."); @@ -97,12 +97,12 @@ namespace Opulence projectRelativeFilePath = projectFile.FullName; projectFilePath = projectFile.FullName; } - + if (projectFilePath != null) { var project = new Project(projectRelativeFilePath!); await ProjectReader.ReadProjectDetailsAsync(output, new FileInfo(projectFilePath), project); - + service.Service.Source = project; // Apply defaults to everything that has a project. @@ -146,7 +146,7 @@ namespace Opulence var project = solution.ProjectsInOrder[i]; var normalized = Names.NormalizeToFriendly(project.ProjectName); - if (string.Equals(normalized, projectName, StringComparison.Ordinal) && + if (string.Equals(normalized, projectName, StringComparison.Ordinal) && project.AbsolutePath.EndsWith(".csproj", StringComparison.Ordinal)) { return project; @@ -156,4 +156,4 @@ namespace Opulence return null; } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/DeployCommand.cs b/src/opulence/dotnet-opulence/DeployCommand.cs index 1cb71de5..197770f3 100644 --- a/src/opulence/dotnet-opulence/DeployCommand.cs +++ b/src/opulence/dotnet-opulence/DeployCommand.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.CommandLine; using System.CommandLine.Invocation; @@ -133,4 +133,4 @@ namespace Opulence step.MarkComplete(); } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/DeployServiceYamlStep.cs b/src/opulence/dotnet-opulence/DeployServiceYamlStep.cs index 111bcb82..cd5b5b9f 100644 --- a/src/opulence/dotnet-opulence/DeployServiceYamlStep.cs +++ b/src/opulence/dotnet-opulence/DeployServiceYamlStep.cs @@ -1,4 +1,4 @@ -using System.CommandLine.Invocation; +using System.CommandLine.Invocation; using System.IO; using System.Linq; using System.Text; diff --git a/src/opulence/dotnet-opulence/DirectoryCopy.cs b/src/opulence/dotnet-opulence/DirectoryCopy.cs index ba3abc5f..21d071d6 100644 --- a/src/opulence/dotnet-opulence/DirectoryCopy.cs +++ b/src/opulence/dotnet-opulence/DirectoryCopy.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; namespace Opulence { @@ -12,12 +12,12 @@ namespace Opulence private static void CopyCore(DirectoryInfo source, DirectoryInfo destination) { Directory.CreateDirectory(destination.FullName); - + foreach (var file in source.GetFiles()) { file.CopyTo(Path.Combine(destination.FullName, file.Name), true); } - + foreach (var nextSource in source.GetDirectories()) { var nextDestination = destination.CreateSubdirectory(nextSource.Name); @@ -25,4 +25,4 @@ namespace Opulence } } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/DirectorySearch.cs b/src/opulence/dotnet-opulence/DirectorySearch.cs index e6e47f75..759c2eb3 100644 --- a/src/opulence/dotnet-opulence/DirectorySearch.cs +++ b/src/opulence/dotnet-opulence/DirectorySearch.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -20,7 +20,7 @@ namespace Opulence } var directory = new DirectoryInfo(directoryPath); - + while (true) { var filePath = Path.Combine(directory.FullName, fileName); @@ -33,7 +33,7 @@ namespace Opulence { return null; } - + if (directory.Parent == null) { return null; @@ -56,7 +56,7 @@ namespace Opulence } var directory = new DirectoryInfo(directoryPath); - + while (true) { if (directory.EnumerateFiles(searchPattern).Any()) @@ -68,7 +68,7 @@ namespace Opulence { return Array.Empty(); } - + if (directory.Parent == null) { return Array.Empty(); @@ -78,4 +78,4 @@ namespace Opulence } } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/DockerContainerBuilder.cs b/src/opulence/dotnet-opulence/DockerContainerBuilder.cs index 15fd604d..fe9b87bc 100644 --- a/src/opulence/dotnet-opulence/DockerContainerBuilder.cs +++ b/src/opulence/dotnet-opulence/DockerContainerBuilder.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.CommandLine.Invocation; using System.IO; using System.Threading.Tasks; @@ -35,7 +35,7 @@ namespace Opulence } using var tempFile = TempFile.Create(); - + var dockerFilePath = Path.Combine(application.GetProjectDirectory(project), Path.GetDirectoryName(project.RelativeFilePath)!, "Dockerfile"); if (File.Exists(dockerFilePath)) { @@ -67,4 +67,4 @@ namespace Opulence service.Outputs.Add(new DockerImageOutput(container.ImageName!, container.ImageTag!)); } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/DockerPush.cs b/src/opulence/dotnet-opulence/DockerPush.cs index 1f6f6f2f..da1782ba 100644 --- a/src/opulence/dotnet-opulence/DockerPush.cs +++ b/src/opulence/dotnet-opulence/DockerPush.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.CommandLine.Invocation; using System.Threading.Tasks; @@ -39,4 +39,4 @@ namespace Opulence } } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/DockerfileGenerator.cs b/src/opulence/dotnet-opulence/DockerfileGenerator.cs index 8603f82a..9d60c87c 100644 --- a/src/opulence/dotnet-opulence/DockerfileGenerator.cs +++ b/src/opulence/dotnet-opulence/DockerfileGenerator.cs @@ -42,7 +42,7 @@ namespace Opulence using var stream = File.OpenWrite(filePath); using var writer = new StreamWriter(stream, encoding: Encoding.UTF8, leaveOpen: true); - + var entryPoint = Path.GetFileNameWithoutExtension(project.RelativeFilePath); output.WriteDebugLine($"Writing dockerfile to '{filePath}'."); if (container.UseMultiphaseDockerfile ?? true) @@ -98,7 +98,7 @@ namespace Opulence throw new ArgumentNullException(nameof(container)); } - if (container.BaseImageName == null && + if (container.BaseImageName == null && project.Frameworks.Any(f => f.Name == "Microsoft.AspNetCore.App")) { container.BaseImageName = "mcr.microsoft.com/dotnet/core/aspnet"; @@ -135,7 +135,7 @@ namespace Opulence { container.ImageName ??= $"{application.Globals.Registry?.Hostname}/{service.Service.Name.ToLowerInvariant()}"; } - + container.ImageTag ??= project.Version.Replace("+", "-"); } } diff --git a/src/opulence/dotnet-opulence/GenerateCommand.cs b/src/opulence/dotnet-opulence/GenerateCommand.cs index 1d18ec3b..b8ccf62c 100644 --- a/src/opulence/dotnet-opulence/GenerateCommand.cs +++ b/src/opulence/dotnet-opulence/GenerateCommand.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.CommandLine; using System.CommandLine.Invocation; @@ -38,7 +38,7 @@ namespace Opulence if (outputs.Count == 0 || outputs.Contains("container")) { - steps.Add(new GenerateDockerfileStep(){ Force = force, }); + steps.Add(new GenerateDockerfileStep() { Force = force, }); } if (outputs.Count == 0 || outputs.Contains("chart")) @@ -56,4 +56,4 @@ namespace Opulence } } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/GenerateDockerfileStep.cs b/src/opulence/dotnet-opulence/GenerateDockerfileStep.cs index 38df052b..4dec6b99 100644 --- a/src/opulence/dotnet-opulence/GenerateDockerfileStep.cs +++ b/src/opulence/dotnet-opulence/GenerateDockerfileStep.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Threading.Tasks; namespace Opulence @@ -40,4 +40,4 @@ namespace Opulence output.WriteInfoLine($"Generated Dockerfile at '{dockerFilePath}'."); } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/GenerateHelmChartStep.cs b/src/opulence/dotnet-opulence/GenerateHelmChartStep.cs index 7cb2f68a..6cb985aa 100644 --- a/src/opulence/dotnet-opulence/GenerateHelmChartStep.cs +++ b/src/opulence/dotnet-opulence/GenerateHelmChartStep.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Threading.Tasks; namespace Opulence @@ -44,4 +44,4 @@ namespace Opulence } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/GenerateKubernetesManifestStep.cs b/src/opulence/dotnet-opulence/GenerateKubernetesManifestStep.cs index f52fdb44..b71cc62f 100644 --- a/src/opulence/dotnet-opulence/GenerateKubernetesManifestStep.cs +++ b/src/opulence/dotnet-opulence/GenerateKubernetesManifestStep.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; namespace Opulence { @@ -26,4 +26,4 @@ namespace Opulence return Task.CompletedTask; } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/GenerateOamComponentStep.cs b/src/opulence/dotnet-opulence/GenerateOamComponentStep.cs index 6ab09322..9812d1a2 100644 --- a/src/opulence/dotnet-opulence/GenerateOamComponentStep.cs +++ b/src/opulence/dotnet-opulence/GenerateOamComponentStep.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; namespace Opulence { @@ -26,4 +26,4 @@ namespace Opulence return Task.CompletedTask; } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/HelmChartBuilder.cs b/src/opulence/dotnet-opulence/HelmChartBuilder.cs index d4481c2c..cccd44df 100644 --- a/src/opulence/dotnet-opulence/HelmChartBuilder.cs +++ b/src/opulence/dotnet-opulence/HelmChartBuilder.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.CommandLine.Invocation; using System.IO; using System.Threading.Tasks; @@ -42,7 +42,7 @@ namespace Opulence var projectDirectory = Path.Combine(application.RootDirectory, Path.GetDirectoryName(project.RelativeFilePath)!); var outputDirectoryPath = Path.Combine(projectDirectory, "bin"); using var tempDirectory = TempDirectory.Create(); - + HelmChartGenerator.ApplyHelmChartDefaults(application, service, container, chart); var chartRoot = Path.Combine(projectDirectory, "charts"); @@ -80,4 +80,4 @@ namespace Opulence output.WriteInfoLine($"Created Helm Chart: {Path.Combine(outputDirectoryPath, chart.ChartName + "-" + project.Version.Replace('+', '-') + ".tgz")}"); } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/HelmChartGenerator.cs b/src/opulence/dotnet-opulence/HelmChartGenerator.cs index e6243107..53836406 100644 --- a/src/opulence/dotnet-opulence/HelmChartGenerator.cs +++ b/src/opulence/dotnet-opulence/HelmChartGenerator.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Threading.Tasks; @@ -108,4 +108,4 @@ namespace Opulence chart.ChartName ??= service.Service.Name.ToLowerInvariant(); } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/HelmPush.cs b/src/opulence/dotnet-opulence/HelmPush.cs index caed5a61..bdd128cd 100644 --- a/src/opulence/dotnet-opulence/HelmPush.cs +++ b/src/opulence/dotnet-opulence/HelmPush.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.CommandLine.Invocation; using System.Threading.Tasks; @@ -49,4 +49,4 @@ namespace Opulence } } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/IYamlManifestOutput.cs b/src/opulence/dotnet-opulence/IYamlManifestOutput.cs index cb08a4e0..8bf26193 100644 --- a/src/opulence/dotnet-opulence/IYamlManifestOutput.cs +++ b/src/opulence/dotnet-opulence/IYamlManifestOutput.cs @@ -1,4 +1,4 @@ -using YamlDotNet.RepresentationModel; +using YamlDotNet.RepresentationModel; namespace Opulence { @@ -6,4 +6,4 @@ namespace Opulence { YamlDocument Yaml { get; } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/InitCommand.cs b/src/opulence/dotnet-opulence/InitCommand.cs index e5485964..b5174e91 100644 --- a/src/opulence/dotnet-opulence/InitCommand.cs +++ b/src/opulence/dotnet-opulence/InitCommand.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.CommandLine; using System.CommandLine.Builder; @@ -62,21 +62,21 @@ namespace Opulence using (var step = output.BeginStep("Looking For .sln File...")) { solutionFilePath = DirectorySearch.AscendingWildcardSearch(directory.FullName, "*.sln").FirstOrDefault()?.FullName; - if (opulenceFilePath == null && - solutionFilePath != null && + if (opulenceFilePath == null && + solutionFilePath != null && output.Confirm($"Use '{Path.GetDirectoryName(solutionFilePath)}' as Root?")) { opulenceFilePath = Path.Combine(Path.GetDirectoryName(solutionFilePath)!, "Opulence.csx"); step.MarkComplete(); } - else + else { output.WriteInfoLine("Not Found."); step.MarkComplete(); } } - if (opulenceFilePath == null && + if (opulenceFilePath == null && Path.GetFullPath(directory.FullName) != Path.GetFullPath(Environment.CurrentDirectory)) { // User specified a directory other than the current one @@ -188,6 +188,6 @@ namespace Opulence await writer.WriteLineAsync($"{{"); await writer.WriteLineAsync($" // Configure your service bindings here with code."); await writer.WriteLineAsync($"}});"); - } + } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/KubernetesDeploymentOutput.cs b/src/opulence/dotnet-opulence/KubernetesDeploymentOutput.cs index 079ead27..bbf99584 100644 --- a/src/opulence/dotnet-opulence/KubernetesDeploymentOutput.cs +++ b/src/opulence/dotnet-opulence/KubernetesDeploymentOutput.cs @@ -1,4 +1,4 @@ -using System; +using System; using YamlDotNet.RepresentationModel; namespace Opulence @@ -24,4 +24,4 @@ namespace Opulence public string Name { get; } public YamlDocument Yaml { get; } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/KubernetesManifestGenerator.cs b/src/opulence/dotnet-opulence/KubernetesManifestGenerator.cs index 2bb1c06b..18cac5c8 100644 --- a/src/opulence/dotnet-opulence/KubernetesManifestGenerator.cs +++ b/src/opulence/dotnet-opulence/KubernetesManifestGenerator.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using YamlDotNet.RepresentationModel; @@ -193,4 +193,4 @@ namespace Opulence return new KubernetesDeploymentOutput(service.Service.Name, new YamlDocument(root)); } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/KubernetesServiceOutput.cs b/src/opulence/dotnet-opulence/KubernetesServiceOutput.cs index af4e4660..4c8edc19 100644 --- a/src/opulence/dotnet-opulence/KubernetesServiceOutput.cs +++ b/src/opulence/dotnet-opulence/KubernetesServiceOutput.cs @@ -1,4 +1,4 @@ -using System; +using System; using YamlDotNet.RepresentationModel; namespace Opulence @@ -24,4 +24,4 @@ namespace Opulence public string Name { get; } public YamlDocument Yaml { get; } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/Names.cs b/src/opulence/dotnet-opulence/Names.cs index 7f4f79a6..8d89ab67 100644 --- a/src/opulence/dotnet-opulence/Names.cs +++ b/src/opulence/dotnet-opulence/Names.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Opulence { @@ -29,4 +29,4 @@ namespace Opulence return name; } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/OamApplicationGenerator.cs b/src/opulence/dotnet-opulence/OamApplicationGenerator.cs index 842f898b..482397df 100644 --- a/src/opulence/dotnet-opulence/OamApplicationGenerator.cs +++ b/src/opulence/dotnet-opulence/OamApplicationGenerator.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -81,4 +81,4 @@ namespace Opulence return Task.CompletedTask; } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/OamComponentGenerator.cs b/src/opulence/dotnet-opulence/OamComponentGenerator.cs index 07b1169f..fae20881 100644 --- a/src/opulence/dotnet-opulence/OamComponentGenerator.cs +++ b/src/opulence/dotnet-opulence/OamComponentGenerator.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using YamlDotNet.RepresentationModel; @@ -32,10 +32,10 @@ namespace Opulence root.Add("metadata", metadata); metadata.Add("name", service.Service.Name); - var spec = new YamlMappingNode(); + var spec = new YamlMappingNode(); root.Add("spec", spec); spec.Add("workloadType", "core.oam.dev/v1alpha1.Server"); - + var containers = new YamlSequenceNode(); spec.Add("containers", containers); @@ -51,4 +51,4 @@ namespace Opulence return new OamComponentOutput(service.Service.Name, new YamlDocument(root)); } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/OamComponentOutput.cs b/src/opulence/dotnet-opulence/OamComponentOutput.cs index 71382e45..714223e3 100644 --- a/src/opulence/dotnet-opulence/OamComponentOutput.cs +++ b/src/opulence/dotnet-opulence/OamComponentOutput.cs @@ -1,4 +1,4 @@ -using System; +using System; using YamlDotNet.RepresentationModel; namespace Opulence @@ -24,4 +24,4 @@ namespace Opulence public string Name { get; } public YamlDocument Yaml { get; } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/OutputContext.cs b/src/opulence/dotnet-opulence/OutputContext.cs index 165d34ff..0fd20c60 100644 --- a/src/opulence/dotnet-opulence/OutputContext.cs +++ b/src/opulence/dotnet-opulence/OutputContext.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.CommandLine; using System.CommandLine.IO; @@ -109,7 +109,7 @@ namespace Opulence public void WriteCommandLine(string process, string args) { - WriteDebugLine($"> {process} {args}"); + WriteDebugLine($"> {process} {args}"); } public bool Confirm(string prompt) @@ -149,7 +149,7 @@ namespace Opulence } } -// + // public void WriteBanner() @@ -202,7 +202,7 @@ namespace Opulence if (output.Verbosity >= Verbosity.Info) { output.Console.SetTerminalForegroundColor(ConsoleColor.Red); - output.Console.Out.WriteLine(new string(' ', output.indent + IndentAmount)+ line); + output.Console.Out.WriteLine(new string(' ', output.indent + IndentAmount) + line); output.Console.ResetTerminalForegroundColor(); } } @@ -232,7 +232,7 @@ namespace Opulence } public bool Completed => message != null; - + public string? Message => message; public string Title => title; @@ -247,10 +247,10 @@ namespace Opulence { return; } - + output.EndStep(this); disposed = true; } } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/PackageCommand.cs b/src/opulence/dotnet-opulence/PackageCommand.cs index 39036b5b..eb85bacd 100644 --- a/src/opulence/dotnet-opulence/PackageCommand.cs +++ b/src/opulence/dotnet-opulence/PackageCommand.cs @@ -68,7 +68,7 @@ namespace Opulence // for just the project. We won't run the "application package" part. if (!string.Equals(".sln", projectFile.Extension, StringComparison.Ordinal)) { - steps.Add(new WriteServiceYamlStep(){ OutputDirectory = outputDirectory, Force = force, }); + steps.Add(new WriteServiceYamlStep() { OutputDirectory = outputDirectory, Force = force, }); } var executor = new ServiceExecutor(output, application, steps); diff --git a/src/opulence/dotnet-opulence/Program.cs b/src/opulence/dotnet-opulence/Program.cs index f3b2a877..03dd35f6 100644 --- a/src/opulence/dotnet-opulence/Program.cs +++ b/src/opulence/dotnet-opulence/Program.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.CommandLine; using System.CommandLine.Builder; using System.CommandLine.Help; @@ -36,14 +36,14 @@ namespace Opulence builder.UseDebugDirective(); builder.UseParseErrorReporting(); builder.ParseResponseFileAs(ResponseFileHandling.ParseArgsAsSpaceSeparated); - builder.UsePrefixes(new []{ "-", "--", }); // disable garbage windows conventions + builder.UsePrefixes(new[] { "-", "--", }); // disable garbage windows conventions builder.CancelOnProcessTermination(); builder.UseExceptionHandler(HandleException); // Allow fancy drawing. builder.UseAnsiTerminalWhenAvailable(); - + var parser = builder.Build(); return await parser.InvokeAsync(args); } diff --git a/src/opulence/dotnet-opulence/ProjectReader.cs b/src/opulence/dotnet-opulence/ProjectReader.cs index 35104484..637f86cb 100644 --- a/src/opulence/dotnet-opulence/ProjectReader.cs +++ b/src/opulence/dotnet-opulence/ProjectReader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.CommandLine.Invocation; using System.IO; using System.Linq; @@ -115,4 +115,4 @@ namespace Opulence } } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/PushCommand.cs b/src/opulence/dotnet-opulence/PushCommand.cs index 91f3ca53..7135eb18 100644 --- a/src/opulence/dotnet-opulence/PushCommand.cs +++ b/src/opulence/dotnet-opulence/PushCommand.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.CommandLine; using System.CommandLine.Invocation; using System.IO; diff --git a/src/opulence/dotnet-opulence/PushDockerImageStep.cs b/src/opulence/dotnet-opulence/PushDockerImageStep.cs index f60f8fd6..8bc120dc 100644 --- a/src/opulence/dotnet-opulence/PushDockerImageStep.cs +++ b/src/opulence/dotnet-opulence/PushDockerImageStep.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System.Threading.Tasks; namespace Opulence @@ -33,4 +33,4 @@ namespace Opulence } } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/ScriptRunner.cs b/src/opulence/dotnet-opulence/ScriptRunner.cs index 15fc73ae..7e45a63a 100644 --- a/src/opulence/dotnet-opulence/ScriptRunner.cs +++ b/src/opulence/dotnet-opulence/ScriptRunner.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Text; using System.Threading.Tasks; @@ -34,7 +34,7 @@ namespace Opulence var code = File.ReadAllText(scriptFilePath); var script = CSharpScript.Create( code, - options: ScriptOptions.Default.WithImports(new []{ "System", "System.Collections.Generic", }), + options: ScriptOptions.Default.WithImports(new[] { "System", "System.Collections.Generic", }), globalsType: typeof(PipelineHolder), assemblyLoader: null); script = script.ContinueWith(@"return await Pipeline.ExecuteAsync(__Pipeline);", options: ScriptOptions.Default); @@ -58,10 +58,10 @@ namespace Opulence output.WriteDebugLine($"Done compiling {Path.GetFileName(scriptFilePath)}'."); var pipeline = new CustomizationPipeline( - output, + output, rootDirectory: Path.GetDirectoryName(scriptFilePath)!, name: Names.NormalizeToDns(Path.GetFileNameWithoutExtension(projectFile.Name)), - solution: null, + solution: null, projectFile); var holder = new PipelineHolder(pipeline); @@ -115,7 +115,7 @@ namespace Opulence var code = File.ReadAllText(scriptFilePath); var script = CSharpScript.Create( code, - options: ScriptOptions.Default.WithImports(new []{ "System", "System.Collections.Generic", }), + options: ScriptOptions.Default.WithImports(new[] { "System", "System.Collections.Generic", }), globalsType: typeof(PipelineHolder), assemblyLoader: null); script = script.ContinueWith(@"return await Pipeline.ExecuteAsync(__Pipeline);", options: ScriptOptions.Default); @@ -139,10 +139,10 @@ namespace Opulence output.WriteDebugLine($"Done compiling {Path.GetFileName(scriptFilePath)}'."); var pipeline = new CustomizationPipeline( - output, - rootDirectory: Path.GetDirectoryName(scriptFilePath)!, + output, + rootDirectory: Path.GetDirectoryName(scriptFilePath)!, name: Names.NormalizeToDns(Path.GetFileNameWithoutExtension(solutionFile.Name)), - solution, + solution, projectFile: null); var holder = new PipelineHolder(pipeline); @@ -163,4 +163,4 @@ namespace Opulence } } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/ServiceExecutor.cs b/src/opulence/dotnet-opulence/ServiceExecutor.cs index 4069f313..9cc9c1f5 100644 --- a/src/opulence/dotnet-opulence/ServiceExecutor.cs +++ b/src/opulence/dotnet-opulence/ServiceExecutor.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.IO; @@ -77,7 +77,7 @@ namespace Opulence { throw new ArgumentNullException(nameof(service)); } - + if (service.Service.Source is Project p) { project = p; @@ -134,4 +134,4 @@ namespace Opulence } } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/StandardOptions.cs b/src/opulence/dotnet-opulence/StandardOptions.cs index 53b66c78..a1ef5f93 100644 --- a/src/opulence/dotnet-opulence/StandardOptions.cs +++ b/src/opulence/dotnet-opulence/StandardOptions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.CommandLine; using System.CommandLine.Parsing; @@ -15,7 +15,7 @@ namespace Opulence { get { - return new Option(new []{ "-e", "--environment" }, "Environemnt") + return new Option(new[] { "-e", "--environment" }, "Environemnt") { Argument = new Argument("environment", () => "production") { @@ -48,7 +48,7 @@ namespace Opulence argument.AddSuggestions(AllOutputs); argument.SetDefaultValue(new List(AllOutputs)); - return new Option(new[]{ "-o", "--outputs" }, "Outputs to generate") + return new Option(new[] { "-o", "--outputs" }, "Outputs to generate") { Argument = argument, }; @@ -85,7 +85,7 @@ namespace Opulence Name = "project-file or solution-file or directory", }; - return new Option(new [] { "-p", "--project", }, "Project file, Solution file or directory") + return new Option(new[] { "-p", "--project", }, "Project file, Solution file or directory") { Argument = argument, }; @@ -165,12 +165,12 @@ namespace Opulence } } } - + public static Option Verbosity { get { - return new Option(new [] { "-v", "--verbosity" }, "Output verbostiy") + return new Option(new[] { "-v", "--verbosity" }, "Output verbostiy") { Argument = new Argument("one of: quiet|info|debug", () => Opulence.Verbosity.Info) { @@ -181,4 +181,4 @@ namespace Opulence } } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/StepView.cs b/src/opulence/dotnet-opulence/StepView.cs index cea611c6..2fda2e55 100644 --- a/src/opulence/dotnet-opulence/StepView.cs +++ b/src/opulence/dotnet-opulence/StepView.cs @@ -1,7 +1,7 @@ -namespace Opulence +namespace Opulence { internal class StepView { } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/TargetInstaller.cs b/src/opulence/dotnet-opulence/TargetInstaller.cs index 9a7f0a0b..27a87ec2 100644 --- a/src/opulence/dotnet-opulence/TargetInstaller.cs +++ b/src/opulence/dotnet-opulence/TargetInstaller.cs @@ -28,7 +28,7 @@ namespace Opulence { return; } - + var toolType = typeof(TargetInstaller); var toolAssembly = toolType.GetTypeInfo().Assembly; var toolImportTargetsResourceName = $"Opulence.Resources.Imports.targets"; diff --git a/src/opulence/dotnet-opulence/TempDirectory.cs b/src/opulence/dotnet-opulence/TempDirectory.cs index 7b9c5241..75f1bdeb 100644 --- a/src/opulence/dotnet-opulence/TempDirectory.cs +++ b/src/opulence/dotnet-opulence/TempDirectory.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; namespace Opulence @@ -24,4 +24,4 @@ namespace Opulence Directory.Delete(DirectoryPath, recursive: true); } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/TempFile.cs b/src/opulence/dotnet-opulence/TempFile.cs index 626738ef..c5b0dd86 100644 --- a/src/opulence/dotnet-opulence/TempFile.cs +++ b/src/opulence/dotnet-opulence/TempFile.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; namespace Opulence @@ -23,4 +23,4 @@ namespace Opulence public string FilePath { get; } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/Templates.cs b/src/opulence/dotnet-opulence/Templates.cs index 6b9c9194..dfcacdc5 100644 --- a/src/opulence/dotnet-opulence/Templates.cs +++ b/src/opulence/dotnet-opulence/Templates.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; namespace Opulence { @@ -22,4 +22,4 @@ namespace Opulence } } } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/Verbosity.cs b/src/opulence/dotnet-opulence/Verbosity.cs index 0c73b42a..967cdcbb 100644 --- a/src/opulence/dotnet-opulence/Verbosity.cs +++ b/src/opulence/dotnet-opulence/Verbosity.cs @@ -1,4 +1,4 @@ -namespace Opulence +namespace Opulence { internal enum Verbosity { @@ -6,4 +6,4 @@ namespace Opulence Info, Debug, } -} \ No newline at end of file +} diff --git a/src/opulence/dotnet-opulence/WriteServiceYamlStep.cs b/src/opulence/dotnet-opulence/WriteServiceYamlStep.cs index b6db69f4..4d1476d9 100644 --- a/src/opulence/dotnet-opulence/WriteServiceYamlStep.cs +++ b/src/opulence/dotnet-opulence/WriteServiceYamlStep.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -40,4 +40,4 @@ namespace Opulence return Task.CompletedTask; } } -} \ No newline at end of file +} diff --git a/test/E2ETest/UnitTest1.cs b/test/E2ETest/UnitTest1.cs index 0934e2d9..86299013 100644 --- a/test/E2ETest/UnitTest1.cs +++ b/test/E2ETest/UnitTest1.cs @@ -1,4 +1,4 @@ -using System; +using System; using Xunit; namespace E2ETest