Skip to content

Commit

Permalink
(maint) Update wording and handling of culture
Browse files Browse the repository at this point in the history
  • Loading branch information
gep13 committed Nov 10, 2023
1 parent fb645af commit 7d9fcd9
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/GitReleaseManager.Core/Commands/AddAssetsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task<int> ExecuteAsync(AddAssetSubOptions options)

if (vcsOptions?.Provider == Model.VcsProvider.GitLab)
{
_logger.Error("The addasset command is currently not supported when targetting GitLab.");
_logger.Error("The 'addasset' command is currently not supported when targeting GitLab.");
return 1;
}

Expand Down
6 changes: 3 additions & 3 deletions src/GitReleaseManager.Core/Commands/ExportCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ public ExportCommand(IVcsService vcsService, ILogger logger)

public async Task<int> ExecuteAsync(ExportSubOptions options)
{
if (string.IsNullOrEmpty(options.TagName))
if (string.IsNullOrWhiteSpace(options.TagName))
{
_logger.Information("Exporting all releases");
_logger.Information("Exporting all releases.");
}
else
{
_logger.Information("Exporting release {TagName}", options.TagName);
_logger.Information("Exporting release {TagName}.", options.TagName);
}

var releasesContent = await _vcsService.ExportReleasesAsync(options.RepositoryOwner, options.RepositoryName, options.TagName, options.SkipPrereleases).ConfigureAwait(false);
Expand Down
2 changes: 1 addition & 1 deletion src/GitReleaseManager.Core/Commands/LabelCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task<int> ExecuteAsync(LabelSubOptions options)

if (vcsOptions?.Provider == Model.VcsProvider.GitLab)
{
_logger.Error("The label command is currently not supported when targetting GitLab.");
_logger.Error("The label command is currently not supported when targeting GitLab.");
return 1;
}

Expand Down
4 changes: 2 additions & 2 deletions src/GitReleaseManager.Core/Extensions/MilestoneExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ public static Version Version(this Octokit.Milestone ver)
var nameWithoutPrerelease = ver.Title.Split('-')[0];
if (nameWithoutPrerelease.StartsWith("v", StringComparison.OrdinalIgnoreCase))
{
_logger.Debug("Removing version prefix from {Name}", ver.Title);
_logger.Debug("Removing version prefix from {Name}.", ver.Title);
nameWithoutPrerelease = nameWithoutPrerelease.Remove(0, 1);
}

if (!System.Version.TryParse(nameWithoutPrerelease, out Version parsedVersion))
{
_logger.Warning("No valid version was found on {Title}", ver.Title);
_logger.Warning("No valid version was found on {Title}.", ver.Title);
return new Version(0, 0);
}

Expand Down
3 changes: 2 additions & 1 deletion src/GitReleaseManager.Core/MappingProfiles/GitHubProfile.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using AutoMapper;
using GitReleaseManager.Core.Extensions;

Expand All @@ -10,7 +11,7 @@ public GitHubProfile()
CreateMap<Octokit.Issue, Model.Issue>()
.ForMember(dest => dest.PublicNumber, act => act.MapFrom(src => src.Number))
.ForMember(dest => dest.InternalNumber, act => act.MapFrom(src => src.Id))
.ForMember(dest => dest.IsPullRequest, act => act.MapFrom(src => src.HtmlUrl.Contains("/pull/")))
.ForMember(dest => dest.IsPullRequest, act => act.MapFrom(src => src.HtmlUrl.IndexOf("/pull/", StringComparison.OrdinalIgnoreCase) >= 0))
.ReverseMap();
CreateMap<Model.IssueComment, Octokit.IssueComment>().ReverseMap();
CreateMap<Model.ItemState, Octokit.ItemState>().ReverseMap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public async Task<string> BuildReleaseNotesAsync(string user, string repository,

if (issues.Count == 0)
{
var logMessage = string.Format(CultureInfo.InvariantCulture, "No closed issues have been found for milestone {0}, or all assigned issues are meant to be excluded from release notes, aborting creation of release.", _milestoneTitle);
var logMessage = string.Format(CultureInfo.CurrentCulture, "No closed issues have been found for milestone {0}, or all assigned issues are meant to be excluded from release notes, aborting release creation.", _milestoneTitle);
throw new InvalidOperationException(logMessage);
}

Expand Down
8 changes: 4 additions & 4 deletions src/GitReleaseManager.Core/VcsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private async Task AddAssetsAsync(string owner, string repository, string tagNam
{
if (!File.Exists(asset))
{
var message = string.Format(CultureInfo.InvariantCulture, "Requested asset to be uploaded doesn't exist: {0}", asset);
var message = string.Format(CultureInfo.CurrentCulture, "The requested asset to be uploaded doesn't exist: {0}", asset);
throw new FileNotFoundException(message);
}

Expand All @@ -155,7 +155,7 @@ private async Task AddAssetsAsync(string owner, string repository, string tagNam

if (_vcsProvider is GitLabProvider)
{
_logger.Error("Deleting of assets is not currently supported when targetting GitLab.");
_logger.Error("Deleting assets is not currently supported when targeting GitLab.");
}
else
{
Expand Down Expand Up @@ -186,7 +186,7 @@ private async Task AddAssetsAsync(string owner, string repository, string tagNam
if (!release.Body.Contains(_configuration.Create.ShaSectionHeading))
{
_logger.Debug("Creating SHA section header");
stringBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, "### {0}", _configuration.Create.ShaSectionHeading));
stringBuilder.AppendFormat(CultureInfo.InvariantCulture, "### {0}", _configuration.Create.ShaSectionHeading).AppendLine();
}

foreach (var asset in assets)
Expand Down Expand Up @@ -405,7 +405,7 @@ private async Task AddIssueCommentsAsync(string owner, string repository, Milest
}
catch (ForbiddenException)
{
_logger.Error("Unable to add comment to issue #{IssueNumber}. Insufficient permissions.", issue.PublicNumber);
_logger.Error("Unable to add a comment to issue #{IssueNumber}. Insufficient permissions.", issue.PublicNumber);
break;
}
}
Expand Down

0 comments on commit 7d9fcd9

Please sign in to comment.