Skip to content

Commit

Permalink
Add tasks for TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanKilleen committed Nov 26, 2022
1 parent 3bf0bb0 commit 3eb8cd2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/TFWhatsUp.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public static bool IsSemanticallyGreaterThan(this string currentVersionNumber, s

public static SemVersion ToSemVer(this string versionNumber)
{
// TODO: Move to TryParse here rather than assuming they'll be parseable. If they're not, show a warning.
// https://github.com/SeanKilleen/tf-whatsup/issues/46

return SemVersion.Parse(versionNumber, SemVersionStyles.Any);
}
}
Expand Down Expand Up @@ -62,6 +65,7 @@ public override async Task<int> ExecuteAsync([NotNull] CommandContext context, [
var StartDirectory = settings.TerraformFilesPath ?? Directory.GetCurrentDirectory();

// TODO: Wrap API calls in methods that detect API rate limits and write messages that suggest using a token
// https://github.com/SeanKilleen/tf-whatsup/issues/44
var apiClient = CreateOctokitApiClient(settings.GitHubApiToken ?? string.Empty);

var lockfileLocation = Path.Combine(StartDirectory, ".terraform.lock.hcl");
Expand Down Expand Up @@ -90,7 +94,7 @@ public override async Task<int> ExecuteAsync([NotNull] CommandContext context, [
AnsiConsole.Write(providerTable);

AnsiConsole.WriteLine("Concatenating TF files");
var totalTypes = await ExtractResourcesFromFiles(allTerraformFiles);
var totalTypes = await ExtractResourcesFromFiles(allTerraformFiles);

var resourceTypesTable = GenerateResourceTypesTable(totalTypes);
AnsiConsole.Write(resourceTypesTable);
Expand All @@ -109,6 +113,7 @@ await AnsiConsole.Status()


// TODO: Split this into a function that returns the data, to hide behind a spinner. Then format the table as applicable once it's done.
// https://github.com/SeanKilleen/tf-whatsup/issues/45
foreach (var provider in providersWithGitHubInfo)
{
var allReleases = await apiClient.Repository.Release.GetAll(provider.GitHubOrg, provider.GitHubRepo);
Expand All @@ -125,7 +130,7 @@ await AnsiConsole.Status()
{
continue;
}

AnsiConsole.Confirm("Show next provider?");
}
else
Expand Down Expand Up @@ -227,7 +232,6 @@ private string ProcessBodyForHighlights(string releaseBody, List<string> totalTy

private List<ReleaseInfoWithBody> GetApplicableReleases(string versionNumber, IReadOnlyList<Release> allReleases)
{
// TODO: Move to TryParse here rather than assuming they'll be parseable. If they're not, show a warning.
// TODO: Parse semver earlier so we're not repeating ourselves as much
var greaterSemverReleases = allReleases
.Where(x => x.TagName.IsSemanticallyGreaterThan(versionNumber))
Expand Down Expand Up @@ -267,7 +271,6 @@ private Table GenerateGitHubUrlTable(List<ProviderInfo> providersWithGitHubInfo)

private async Task<List<ProviderInfo>> GetGithubUrlsForProviders(List<ProviderInfo> providerInfoList)
{
// TODO: If GitHub Url isn't found or isn't valid, show a warning here and don't add the provider to the final list. No sense in setting us up for failure later.
List<ProviderInfo> providersWithGitHubInfo = new();
using var httpClient = new HttpClient();
foreach (var provider in providerInfoList)
Expand Down

0 comments on commit 3eb8cd2

Please sign in to comment.