Skip to content

Commit

Permalink
Merge pull request #169 from Lombiq/issue/OSOE-470
Browse files Browse the repository at this point in the history
OSOE-470: Remove false entries (actual typos) from spell checking allow lists in Lombiq.GitHub.Actions
  • Loading branch information
BenedekFarkas authored Dec 5, 2022
2 parents a6ea11d + 8f03e88 commit 4de643c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace System;
public static class ServiceProviderExtensions
{
/// <summary>
/// Returns a <see cref="Lazy{T}"/> accessor for the service so you can access services with a shorter lifecyle in
/// Returns a <see cref="Lazy{T}"/> accessor for the service so you can access services with a shorter lifecycle in
/// your service implementation without storing a service provider which is an anti-pattern.
/// </summary>
/// <typeparam name="T">The type of the required service.</typeparam>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@ namespace System;
public static class IdStringExtensions
{
/// <summary>
/// Converts a string into a still valid Content Item ID by turning it into lower-case, removing any non-
/// alphanumeric characters, and finally padding the rest with zeroes so it has the expected length of 26
/// characters. This way <c>~Help: Popular Topics</c> can be used to get the ID <c>helppopulartopics000000000</c>,
/// which can be used in recipes without complication. (The example's leading tilde makes it easier to identify as
/// a potential ID even if it's not immediately passed to this method.)
/// Converts a string into a valid Content Item ID by turning it into lower-case, removing any non-alphanumeric
/// characters, and finally padding the rest with zeroes so it has the expected length of 26 characters. This way
/// <c>~Lombiq: Technologies</c> can be used to get the ID <c>lombiqtechnologies00000000</c>, which can be used in
/// recipes without complication. (The example's leading tilde makes it easier to identify as a potential ID even if
/// it's not immediately passed to this method.)
/// </summary>
/// <param name="text">The arbitrary string to convert. May include spaces, punctuation, etc.</param>
/// <returns>The valid 26 character long lower-case ContentItemId.</returns>
public static string ToContentItemId(this string text)
{
// We use lower case because that's how all ContentItem IDs are cased.
#pragma warning disable CA1308
var contentItemId = text
.ToLowerInvariant()
.RegexReplace(@"[^a-z0-9]+", string.Empty);
var contentItemId = text.ToLowerInvariant().RegexReplace(@"[^a-z0-9]+", string.Empty);
#pragma warning restore CA1308

if (contentItemId.Length < 26) contentItemId = contentItemId.PadRight(26, '0');
Expand Down

0 comments on commit 4de643c

Please sign in to comment.