Skip to content

Commit

Permalink
Add/use dotnet-format
Browse files Browse the repository at this point in the history
  • Loading branch information
rynowak committed Feb 29, 2020
1 parent b5472d8 commit 3c26b6f
Show file tree
Hide file tree
Showing 76 changed files with 298 additions and 189 deletions.
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-format": {
"version": "3.3.111304",
"commands": [
"dotnet-format"
]
}
}
}
30 changes: 30 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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

50 changes: 50 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
}
]
}
17 changes: 17 additions & 0 deletions build/dotnet-format-problem-matcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "dotnet-format",
"severity": "warning",
"pattern": [
{
"regexp": "^\\s+(.*)\\((\\d+),(\\d+)\\):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"message": 4
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -849,5 +849,5 @@ public static class Keywords
public const EventKeywords JsonMessage = (EventKeywords)8;
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ public override string ToString()
return _formattedMessage ?? string.Empty;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,4 @@ private object FormatArgument(object value)
}

}
}
}
2 changes: 1 addition & 1 deletion src/micronetes/Micronetes.Hosting.Runtime/StartupHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ public static void Initialize()
Thread.Sleep(1000);
}
}
}
}
2 changes: 1 addition & 1 deletion src/micronetes/Micronetes.Hosting/MicronetesHost.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using System.Threading.Tasks;
using Micronetes.Hosting.Diagnostics;
Expand Down
4 changes: 2 additions & 2 deletions src/opulence/Opulence/ApplicationGlobals.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Opulence
namespace Opulence
{
public sealed class ApplicationGlobals
{
Expand All @@ -8,4 +8,4 @@ public sealed class ApplicationGlobals

public ContainerRegistry? Registry { get; set; }
}
}
}
4 changes: 2 additions & 2 deletions src/opulence/Opulence/ContainerRegistry.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Opulence
{
Expand All @@ -16,4 +16,4 @@ public ContainerRegistry(string hostname)

public string Hostname { get; }
}
}
}
4 changes: 2 additions & 2 deletions src/opulence/Opulence/DeploymentKind.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace Opulence
namespace Opulence
{
public enum DeploymentKind
{
None,
Kubernetes,
Oam,
}
}
}
4 changes: 2 additions & 2 deletions src/opulence/Opulence/DockerImage.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Opulence
{
Expand All @@ -16,4 +16,4 @@ public DockerImage(string image)

public string Image { get; }
}
}
}
4 changes: 2 additions & 2 deletions src/opulence/Opulence/EnvironmentAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Opulence
{
Expand All @@ -16,4 +16,4 @@ public EnvironmentAttribute(string environmentName)

public string EnvironmentName { get; }
}
}
}
4 changes: 2 additions & 2 deletions src/opulence/Opulence/Environments.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace Opulence
namespace Opulence
{
public static class Environments
{
public const string Development = "Development";

public const string Production = "Production";
}
}
}
4 changes: 2 additions & 2 deletions src/opulence/Opulence/Framework.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Opulence
{
Expand All @@ -16,4 +16,4 @@ public Framework(string name)

public string Name { get; }
}
}
}
4 changes: 2 additions & 2 deletions src/opulence/Opulence/FrameworkCollection.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

Expand All @@ -19,4 +19,4 @@ public void AddRange(IEnumerable<Framework> items)
}
}
}
}
}
4 changes: 2 additions & 2 deletions src/opulence/Opulence/GeneratedAssets.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Opulence
namespace Opulence
{
public sealed class GeneratedAssets
{
public ContainerInfo? Container { get; set; }
}
}
}
4 changes: 2 additions & 2 deletions src/opulence/Opulence/HelmChartStep.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace Opulence
namespace Opulence
{
public sealed class HelmChartStep : Step
{
public override string DisplayName => "Building Helm Chart...";

public string ChartName { get; set; } = default!;
}
}
}
8 changes: 4 additions & 4 deletions src/opulence/Opulence/Pipeline.cs
Original file line number Diff line number Diff line change
@@ -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<Type, List<MulticastDelegate>> callbacks = new Dictionary<Type, List<MulticastDelegate>>();

public static void Configure<TApplication>(Action<TApplication> callback)
Expand Down Expand Up @@ -39,7 +39,7 @@ public static void Configure<TApplication>(Action<TApplication> callback)
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], });
}
}

Expand All @@ -50,4 +50,4 @@ public static void Configure<TApplication>(Action<TApplication> callback)

public abstract Task<object?> ExecuteAsync();
}
}
}
4 changes: 2 additions & 2 deletions src/opulence/Opulence/PipelineHolder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Opulence
{
Expand All @@ -16,4 +16,4 @@ public PipelineHolder(Pipeline pipeline)

public Pipeline __Pipeline { get; }
}
}
}
4 changes: 2 additions & 2 deletions src/opulence/Opulence/Project.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Opulence
{
Expand All @@ -22,4 +22,4 @@ public Project(string relativeFilePath)

public string Version { get; set; } = default!;
}
}
}
4 changes: 2 additions & 2 deletions src/opulence/Opulence/Secret.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Opulence
namespace Opulence
{
public class Secret
{
public string? Name { get; set; }
}
}
}
8 changes: 4 additions & 4 deletions src/opulence/Opulence/Service.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;

namespace Opulence
Expand All @@ -20,15 +20,15 @@ public Service(string name)
public GeneratedAssets GeneratedAssets { get; } = new GeneratedAssets();

public int? Port { get; set; }

public string? Protocol { get; set; }

public Source? Source { get; set; }

public Dictionary<string, object> Environment { get; set; } = new Dictionary<string, object>();

public int Replicas { get; set; } = 1;

public List<ServiceBinding> Bindings { get; } = new List<ServiceBinding>();
}
}
}
4 changes: 2 additions & 2 deletions src/opulence/Opulence/ServiceBinding.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Opulence
{
Expand Down Expand Up @@ -32,4 +32,4 @@ public ServiceBinding(Service service)
public int? Port { get; set; }
public Secret? ConnectionString { get; set; }
}
}
}
Loading

0 comments on commit 3c26b6f

Please sign in to comment.