Skip to content

Commit 507b1c5

Browse files
committed
stylecop reformatting
1 parent 6b90586 commit 507b1c5

File tree

8 files changed

+74
-22
lines changed

8 files changed

+74
-22
lines changed

src/.editorconfig

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# All files
44
[*]
55
indent_style = tab
6-
dotnet_diagnostic.xUnit2015.severity = silent
6+
dotnet_diagnostic.xUnit2015.severity = none
77
dotnet_diagnostic.NU1701.severity = silent
88

99
# Xml files
@@ -28,3 +28,15 @@ dotnet_naming_style.end_in_async.word_separator =
2828

2929
# CS0067: Das Ereignis "CloseOnEscapeBehavior.CanExecuteChanged" wird nie verwendet.
3030
dotnet_diagnostic.CS0067.severity = silent
31+
32+
# SA1200: Using directives should be placed correctly
33+
dotnet_diagnostic.SA1200.severity = suggestion
34+
35+
# SA1027: Use tabs correctly
36+
dotnet_diagnostic.SA1027.severity = silent
37+
38+
# SA1600: Elements should be documented
39+
dotnet_diagnostic.SA1600.severity = suggestion
40+
41+
# SA1633: File should have header
42+
dotnet_diagnostic.SA1633.severity = none

src/Generator.Client.CommandLine/ConsoleApplication.cs

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
using System;
1+
// Copyright (c) 2020 Andreas Müller
2+
// This file is a part of Amusoft.VisualStudio.TemplateGenerator and is licensed under Apache 2.0
3+
// See https://github.com/taori/Amusoft.VisualStudio.TemplateGenerator/blob/master/LICENSE for details
4+
5+
using System;
26
using System.Collections.Generic;
37
using System.Linq;
48
using System.Threading;
@@ -19,8 +23,7 @@ public class ConsoleApplication
1923

2024
[ApplicationMetadata(
2125
Description = "Tries to build a template according the the specified configuration.",
22-
Syntax = "build [configName] [option: -s pathToStorage]"
23-
)]
26+
Syntax = "build [configName] [option: -s pathToStorage]")]
2427
public async Task<int> Build(
2528
[Argument(
2629
Name = "config",
@@ -30,11 +33,12 @@ public async Task<int> Build(
3033
Description = "Path to storage.",
3134
ShortName = "s",
3235
LongName = "storage")]
33-
string storage = null
34-
)
36+
string storage = null)
3537
{
3638
if (!ConsoleUtils.TryGetManager(storage, out var manager))
39+
{
3740
return 3;
41+
}
3842

3943
Log.Info($"Trying to build [{configurationId}].");
4044

@@ -54,7 +58,9 @@ public async Task<int> Build(
5458
try
5559
{
5660
Log.Info($"Executing build tool.");
57-
var result = await rewriteTool.ExecuteAsync(CancellationToken.None, new Progress<string>(message => Console.WriteLine(message)));
61+
var result = await rewriteTool.ExecuteAsync(
62+
CancellationToken.None,
63+
new Progress<string>(message => Console.WriteLine(message)));
5864
return result ? 0 : 4;
5965
}
6066
catch (Exception e)
@@ -63,7 +69,7 @@ public async Task<int> Build(
6369
return 1;
6470
}
6571
}
66-
72+
6773
[SubCommand]
6874
[ApplicationMetadata(Description = "Entry point for configurations")]
6975
public class Configuration
@@ -77,7 +83,10 @@ public async Task<int> GetAll(
7783
string storage = null)
7884
{
7985
if (!ConsoleUtils.TryGetManager(storage, out var manager))
86+
{
8087
return 1;
88+
}
89+
8190
var configurations = await manager.LoadStorageContentAsync();
8291
for (var index = 0; index < configurations.Length; index++)
8392
{
@@ -91,19 +100,23 @@ public async Task<int> GetAll(
91100
[ApplicationMetadata(Description = "Renames the configuration if it can be found through the given id.")]
92101
public async Task<int> Rename(
93102
[Argument(
94-
Description = "id of configuration which can be the position of the configuration, its guid, or the configuration name")]
95-
string id,
103+
Description =
104+
"id of configuration which can be the position of the configuration, its guid, or the configuration name")]
105+
string id,
96106
[Argument(
97107
Description = "new name of the configuration")]
98108
string newName,
99109
[Option(
100110
Description = "Path to storage.",
101-
ShortName = "s",
111+
ShortName = "s",
102112
LongName = "storage")]
103113
string storage = null)
104114
{
105115
if (!ConsoleUtils.TryGetManager(storage, out var manager))
116+
{
106117
return 1;
118+
}
119+
107120
try
108121
{
109122
var configuration = await manager.GetConfigurationByIdAsync(id);

src/Generator.Client.CommandLine/Dependencies/FileDialogService.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ namespace Generator.Client.CommandLine.Dependencies
66
public class FileDialogService : IFileDialogService
77
{
88
/// <inheritdoc />
9-
public bool OpenFileDialog(out string path, string filter, bool @readonly = false, bool multiSelect = false,
9+
public bool OpenFileDialog(
10+
out string path,
11+
string filter,
12+
bool @readonly = false,
13+
bool multiSelect = false,
1014
bool checkFileExists = false)
1115
{
1216
throw new System.NotImplementedException();

src/Generator.Client.CommandLine/Dependencies/ServiceLocatorInitializer.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-

1+
// Copyright 2020 Andreas Müller
2+
// This file is a part of Amusoft.VisualStudio.TemplateGenerator and is licensed under Apache 2.0
3+
// See https://github.com/taori/Amusoft.VisualStudio.TemplateGenerator/blob/master/LICENSE for details
4+
25
using Generator.Shared.DependencyInjection;
36
using Microsoft.Extensions.DependencyInjection;
47

src/Generator.Client.CommandLine/Dependencies/UIService.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-

1+
// Copyright 2020 Andreas Müller
2+
// This file is a part of Amusoft.VisualStudio.TemplateGenerator and is licensed under Apache 2.0
3+
// See https://github.com/taori/Amusoft.VisualStudio.TemplateGenerator/blob/master/LICENSE for details
4+
25
using System;
36
using System.Threading.Tasks;
47
using Generator.Shared.DependencyInjection;

src/Generator.Client.CommandLine/Generator.Client.CommandLine.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
<PackageReference Include="CommandDotNet" Version="2.8.2" />
3333
<PackageReference Include="JetBrains.Annotations" Version="2018.2.1" />
3434
<PackageReference Include="NLog" Version="4.6.8" />
35+
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
36+
<PrivateAssets>all</PrivateAssets>
37+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
38+
</PackageReference>
3539
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
3640
</ItemGroup>
3741

src/Generator.Client.CommandLine/Program.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
namespace Generator.Client.CommandLine
1313
{
14-
class Program
14+
public class Program
1515
{
16-
static int Main(string[] args)
16+
private static int Main(string[] args)
1717
{
1818
try
1919
{
@@ -28,13 +28,16 @@ static int Main(string[] args)
2828
Console.WriteLine("Waiting for user input.");
2929
input = Console.ReadLine();
3030
if (string.IsNullOrEmpty(input))
31+
{
3132
return 0;
33+
}
3234

3335
Console.Clear();
34-
var userArgs = input.Split(new []{' '}, StringSplitOptions.RemoveEmptyEntries);
36+
var userArgs = input.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
3537
var code = RunApplication(userArgs);
3638
Console.WriteLine(code);
37-
} while (input != "exit");
39+
}
40+
while (input != "exit");
3841

3942
return 0;
4043
}

src/Generator.Client.CommandLine/RunnerFactory.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1-
using CommandDotNet;
1+
// Copyright 2020 Andreas Müller
2+
// This file is a part of Amusoft.VisualStudio.TemplateGenerator and is licensed under Apache 2.0
3+
// See https://github.com/taori/Amusoft.VisualStudio.TemplateGenerator/blob/master/LICENSE for details
4+
5+
using CommandDotNet;
26
using CommandDotNet.Models;
37

48
namespace Generator.Client.CommandLine
59
{
6-
public static class RunnerFactory
10+
internal static class RunnerFactory
711
{
8-
public static AppRunner<TApplication> Create<TApplication>() where TApplication : class
12+
/// <summary>
13+
/// Creates App runner instance.
14+
/// </summary>
15+
/// <typeparam name="TApplication">Type of application.</typeparam>
16+
/// <returns>App runner instance.</returns>
17+
public static AppRunner<TApplication> Create<TApplication>()
18+
where TApplication : class
919
{
1020
var settings = new AppSettings();
1121
settings.Case = Case.LowerCase;
12-
settings.HelpTextStyle = HelpTextStyle.Detailed;
22+
settings.Help.TextStyle = HelpTextStyle.Detailed;
1323
var runner = new AppRunner<TApplication>(settings);
1424
return runner;
1525
}

0 commit comments

Comments
 (0)