Skip to content

Commit 78db403

Browse files
Add implicit global usings and nullable reference types
1 parent 9842c73 commit 78db403

22 files changed

Lines changed: 27 additions & 53 deletions

src/App.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System;
21
using System.Security.Authentication;
3-
using System.Threading.Tasks;
42
using Octokit;
53

64
namespace GitHubLabelSync;
@@ -65,4 +63,4 @@ private async Task<Account> GetValidAccount(Settings settings)
6563

6664
return account;
6765
}
68-
}
66+
}

src/Command.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System;
2-
using System.Threading.Tasks;
31
using Spectre.Console;
42
using Spectre.Console.Cli;
53

@@ -31,4 +29,4 @@ private Func<StatusContext, Task> Run(Settings settings)
3129
=> await Factory
3230
.App(settings.APIKey, s => ctx.Status(s), s => _console.WriteLine(s))
3331
.Run(settings);
34-
}
32+
}

src/Factory.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Reflection;
32
using Octokit;
43

@@ -16,4 +15,4 @@ public static App App(string apiKey, Action<string> setStatus, Action<string> lo
1615
var sync = new Synchronizer(gitHub, setStatus, log);
1716
return new App(sync, setStatus, log);
1817
}
19-
}
18+
}

src/GitHub.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
51
using Octokit;
62

73
namespace GitHubLabelSync;
@@ -137,4 +133,4 @@ public async Task DeleteLabel(Repository repo, Label label)
137133
await _client.Issue.Labels.Delete(repo.Id, label.Name);
138134
_log($"Deleted {label.Name}");
139135
}
140-
}
136+
}

src/GitHubLabelSync.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
<PublishRepositoryUrl>true</PublishRepositoryUrl>
1818
<IncludeSymbols>true</IncludeSymbols>
1919
<EmbedUntrackedSources>true</EmbedUntrackedSources>
20+
<ImplicitUsings>enable</ImplicitUsings>
21+
<Nullable>enable</Nullable>
2022
</PropertyGroup>
2123
<ItemGroup>
2224
<PackageReference Include="Octokit" Version="0.50.0"/>

src/IGitHub.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System.Collections.Generic;
2-
using System.Threading.Tasks;
31
using Octokit;
42

53
namespace GitHubLabelSync;
@@ -23,4 +21,4 @@ public interface IGitHub
2321
Task AddLabel(Repository repo, Label label);
2422
Task EditLabel(Repository repo, Label label);
2523
Task DeleteLabel(Repository repo, Label label);
26-
}
24+
}

src/ISynchronizer.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System.Collections.Generic;
2-
using System.Threading.Tasks;
31
using Octokit;
42
using Spectre.Console;
53

@@ -15,4 +13,4 @@ public interface ISynchronizer
1513
Task<IReadOnlyList<Label>> GetAccountLabels(Account account);
1614

1715
Task SyncRepo(Repository repo, Settings settings, IReadOnlyList<Label> accountLabels);
18-
}
16+
}

src/Program.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System.Threading.Tasks;
21
using Spectre.Console.Cli;
32

43
namespace GitHubLabelSync;
@@ -7,4 +6,4 @@ public static class Program
76
{
87
public static async Task Main(string[] args)
98
=> await new CommandApp<Command>().RunAsync(args);
10-
}
9+
}

src/Settings.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ public class Settings : CommandSettings
88
{
99
[CommandArgument(0, "<org/username>")]
1010
[Description("The name of the GitHub organization or username to sync")]
11-
public string Name { get; init; }
11+
public string Name { get; init; } = null!;
1212

1313
[CommandOption("-k|--api-key")]
1414
[Description("GitHub API Key (Personal Access Token)")]
15-
public string APIKey { get; init; }
15+
public string APIKey { get; init; } = null!;
1616

1717
private readonly bool _noAdd;
1818

@@ -56,4 +56,4 @@ public override ValidationResult Validate()
5656
=> string.IsNullOrWhiteSpace(APIKey)
5757
? ValidationResult.Error("GitHub API Key (Personal Access Token) is required")
5858
: base.Validate();
59-
}
59+
}

src/Synchronizer.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
51
using Octokit;
62
using Spectre.Console;
73

@@ -183,4 +179,4 @@ private static bool NeedsUpdating(Label accountLabel, Label repoLabel)
183179
=> string.Equals(accountLabel.Name, repoLabel.Name, StringComparison.InvariantCultureIgnoreCase) &&
184180
(!string.Equals(accountLabel.Description, repoLabel.Description, StringComparison.InvariantCultureIgnoreCase)
185181
|| !string.Equals(accountLabel.Color, repoLabel.Color, StringComparison.InvariantCultureIgnoreCase));
186-
}
182+
}

0 commit comments

Comments
 (0)