CodeMD repository analysis · example report
An analysis of github.com/Humanizr/Humanizer as it was on 2026-11-13.
What the repository is and how it is built, written by AI from the analysis.
Humanizer is a .NET library that turns strings, enums, dates, times, durations, numbers, quantities, byte sizes and collections into human-friendly text. It is released under the MIT license and distributed through NuGet. A documentation site at humanizr.net/docs covers getting started, common scenarios, upgrade guides and an API reference. The current documentation describes the v4 previews, with migration guidance from earlier versions.
TryPluralize and TrySingularize, which use a culture's CLDR cardinal noun forms.HumanizeWithCase) for locales with verified support.NotSupportedException instead of falling back to English.The main library lives in src/Humanizer, with xUnit tests in tests/Humanizer.Tests.
src/Humanizer.Analyzers contains a Roslyn analyzer and code fix provider that helps with migration. It detects the old sub-namespaces (such as Humanizer.Bytes and Humanizer.Localisation) that were consolidated into the root Humanizer namespace, and it offers automatic fixes. It also helps with words-to-number API changes such as ToNumber now returning long. Fix All works across a document, project or solution. Analyzer assets are shipped per Roslyn version and are selected automatically by modern SDK and IDE hosts. The same package also carries the generated locale data, so there is no separate locale or analyzer package to manage.
For performance, the implementation uses source-generated regex, FrozenDictionary and SearchValues to reduce allocations on modern .NET. BenchmarkDotNet suites in src/Benchmarks cover these areas and run on .NET 10 and .NET 11. A manual GitHub Actions workflow compares a baseline NuGet version with the current source.
Contributions are welcome. Read the contribution guide first, and report bugs or request features through GitHub issues.
12 features found in the code and documentation.
Turns PascalCase, underscore_case and similar strings into readable text and converts between casings such as camelCase, kebab-case, Title Case and underscore_case.
Pluralizes and singularizes words, with TryPluralize and TrySingularize that use a culture's CLDR cardinal noun forms.
Turns dates, times and durations into human-friendly phrases, including case-aware duration phrases for locales with verified support.
Converts numbers to words and ordinals across many locales, and parses word forms such as "forty-two" back into numbers.
Converts integers to and from Roman numerals, and numbers to and from metric notation such as 1000 to "1k".
Formats, parses and composes byte sizes and rates, with legacy, decimal SI and binary IEC unit systems.
Turns enum values into readable text and parses that text back into enum values.
Formats collections of items as human-friendly text.
Produces locale-aware output for many cultures, and throws NotSupportedException instead of falling back to English where a locale lacks verified support.
Converts numbers to Chinese financial characters for zh-Hans and zh-Hant.
A Roslyn analyzer flags old Humanizer namespaces and words-to-number API changes, and offers automatic fixes across a document, project or solution.
Uses source-generated regex, FrozenDictionary and SearchValues for faster, lower-allocation humanizing on modern .NET.
Possible problems found without running the code.
| Kind | Signal | Where | Severity |
|---|---|---|---|
| Possible bugs | OS command execution API used `subprocess.run` executes an operating-system command. | .agents/skills/add-locale-batch/scripts/locale_batch_status.py:19 | medium |
| Possible bugs | Function has no error handling `unresolved_threads` has no try/except, logging call, or raised/returned error response. | .agents/skills/add-locale-batch/scripts/locale_batch_status.py:44 | medium |
| Possible bugs | Function has no error handling `checks_state` has no try/except, logging call, or raised/returned error response. | .agents/skills/add-locale-batch/scripts/locale_batch_status.py:64 | medium |
| Possible bugs | Function has no error handling `refresh_entry` has no try/except, logging call, or raised/returned error response. | .agents/skills/add-locale-batch/scripts/locale_batch_status.py:82 | medium |
| Possible bugs | Function has no error handling `main` has no try/except, logging call, or raised/returned error response. | .agents/skills/add-locale-batch/scripts/locale_batch_status.py:111 | medium |
| Structure | Import may be unused `annotations` is imported but not referenced in this file. | .agents/skills/add-locale-batch/scripts/locale_batch_status.py:4 | low |
| Structure | File has parsed code but no static links `Benchmarks/VocabularyBenchmarks.cs` contains 2 parsed code areas but none are connected in the static callgraph. | Benchmarks/VocabularyBenchmarks.cs | low |
| Structure | File has parsed code but no static links `Humanizer.SourceGenerators/Common/EngineContractModels.cs` contains 3 parsed code areas but none are connected in the static callgraph. | Humanizer.SourceGenerators/Common/EngineContractModels.cs | low |
| Structure | File has parsed code but no static links `Humanizer.SourceGenerators/Common/LocaleCoverageInput.cs` contains 6 parsed code areas but none are connected in the static callgraph. | Humanizer.SourceGenerators/Common/LocaleCoverageInput.cs | low |
| Structure | File has parsed code but no static links `Humanizer.SourceGenerators/Common/LocalePhraseModels.cs` contains 15 parsed code areas but none are connected in the static callgraph. | Humanizer.SourceGenerators/Common/LocalePhraseModels.cs | low |
| Structure | File has parsed code but no static links `Humanizer.SourceGenerators/Common/ProfileDefinitions.cs` contains 11 parsed code areas but none are connected in the static callgraph. | Humanizer.SourceGenerators/Common/ProfileDefinitions.cs | low |
| Structure | File has parsed code but no static links `Humanizer.SourceGenerators/Generators/ProfileCatalogs/HeadingTableCatalogInput.cs` contains 2 parsed code areas but none are connected in the static callgraph. | Humanizer.SourceGenerators/Generators/ProfileCatalogs/HeadingTableCatalogInput.cs | low |
| Structure | File has parsed code but no static links `Humanizer.SourceGenerators/Generators/ProfileCatalogs/MetricScaleWordCatalogInput.cs` contains 3 parsed code areas but none are connected in the static callgraph. | Humanizer.SourceGenerators/Generators/ProfileCatalogs/MetricScaleWordCatalogInput.cs | low |
| Call graph | Circular call relationship 3 functions participate in a static call cycle. | Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs:867 | medium |
| Call graph | Circular call relationship 2 functions participate in a static call cycle. | Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs:928 | medium |
| Call graph | Circular call relationship 6 functions participate in a static call cycle. | Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs:1409 | medium |
| Call graph | Circular call relationship 3 functions participate in a static call cycle. | Humanizer/Inflections/LocalizedInflectionCatalog.cs:93 | medium |
| Call graph | Circular call relationship 2 functions participate in a static call cycle. | Humanizer/Localisation/NumberToWords/HyphenatedOrdinalNumberToWordsConverter.cs:84 | medium |
| Across files | Missing internal call target `TimeOnlyToClockNotationConverterBenchmarks.EsClockNotationConverter` calls `Humanizer.ITimeOnlyToClockNotationConverter.Convert`, but the target was not found in the parsed function index. | Benchmarks/TimeOnlyToClockNotationConverterBenchmarks.cs:10 | high |
| Across files | Missing internal call target `TimeOnlyToClockNotationConverterBenchmarks.EsClockNotationConverter` calls `Humanizer.PhraseClockNotationConverter.Convert`, but the target was not found in the parsed function index. | Benchmarks/TimeOnlyToClockNotationConverterBenchmarks.cs:10 | high |
| Across files | Missing internal call target `TimeOnlyToClockNotationConverterBenchmarks.BrazilianPortugueseClockNotationConverter` calls `Humanizer.ITimeOnlyToClockNotationConverter.Convert`, but the target was not found in the parsed function index. | Benchmarks/TimeOnlyToClockNotationConverterBenchmarks.cs:18 | high |
| Across files | Missing internal call target `TimeOnlyToClockNotationConverterBenchmarks.BrazilianPortugueseClockNotationConverter` calls `Humanizer.PhraseClockNotationConverter.Convert`, but the target was not found in the parsed function index. | Benchmarks/TimeOnlyToClockNotationConverterBenchmarks.cs:18 | high |
| Across files | Missing internal call target `TimeOnlyToClockNotationConverterBenchmarks.FrClockNotationConverter` calls `Humanizer.ITimeOnlyToClockNotationConverter.Convert`, but the target was not found in the parsed function index. | Benchmarks/TimeOnlyToClockNotationConverterBenchmarks.cs:26 | high |
| Across files | Missing internal call target `TimeOnlyToClockNotationConverterBenchmarks.FrClockNotationConverter` calls `Humanizer.PhraseClockNotationConverter.Convert`, but the target was not found in the parsed function index. | Benchmarks/TimeOnlyToClockNotationConverterBenchmarks.cs:26 | high |
| Across files | Missing internal call target `TimeOnlyToClockNotationConverterBenchmarks.LbClockNotationConverter` calls `Humanizer.ITimeOnlyToClockNotationConverter.Convert`, but the target was not found in the parsed function index. | Benchmarks/TimeOnlyToClockNotationConverterBenchmarks.cs:34 | high |
| Across files | Missing internal call target `TimeOnlyToClockNotationConverterBenchmarks.LbClockNotationConverter` calls `Humanizer.PhraseClockNotationConverter.Convert`, but the target was not found in the parsed function index. | Benchmarks/TimeOnlyToClockNotationConverterBenchmarks.cs:34 | high |
A sample of the highest-ranked signals. These come from static analysis: they are leads to review, not confirmed bugs.
Functions nothing in the repository calls.
No unused functions were found.
What changed in the last 30 days, in plain language.
Summary of Humanizer changes (evidence limited to the first three of 10 commits; the payload was cut off, so the remaining 7 commits and 5-author totals are not covered).
ByteSizeExtensions.Bits(this double input) was added in src/Humanizer/Bytes/ByteSizeExtensions.cs. It calls ByteSize.FromBytes(input / ByteSize.BitsInByte), so fractional bits are kept in ByteSize.Bytes, while ByteSize.Bits rounds up to a whole bit. For example, 2.5 bits gives 0.3125 bytes and a Bits value of 3. The commit adds a DoubleBits unit test that checks exactly this. It updates the public API approval snapshots for DotNet8_0, DotNet10_0, DotNet11_0 and Net4_8. It adds the method to the generated API docs page (website/docs/api/Humanizer.ByteSizeExtensions.md). It also updates the source hash for ByteSizeExtensions.cs in website/docs/contributing/locale-yaml-reference.mdx. Impact: it is additive, so existing callers are unaffected.DynamicLengthAndPreserveWordsTruncator. When the cutoff falls mid-word, the truncator used to backtrack with value.LastIndexOf(' ', ...), so only a plain space counted as a boundary. It now uses a new helper, LastIndexOfWhiteSpace, which scans backward with char.IsWhiteSpace. That matches the existing backward scan in TruncateFromLeft. Tabs, newlines, CRLF and non-breaking spaces now count as boundaries. For example, "221B Baker Street\nLondon NW1 6XE" truncated to 20 characters gives "221B Baker Street…". A new theory test with six inline cases covers this. The analysis reports a low-risk, localized change with no callers or impacted files in the callgraph data.defaultdocumentation.console tool was bumped from 1.2.5 to 1.2.6 in .config/dotnet-tools.json. ByteRate.CompareTo(object?) in src/Humanizer/Bytes/ByteRate.cs had /// <inheritdoc /> replaced with explicit summary, param, returns and exception docs. ApiAccessRecord in tools/docs/api-access.cs gained a MethodReturnType property, filled from signature.ReturnType. In tools/docs/api-reference.ps1, the temporary-XML alias workaround New-DefaultDocumentationApiInput was removed. The script now dot-sources api-xml-input.ps1 and adds Resolve-ApiConversionMethodId, which resolves generated IDs for conversion-named methods (op_Implicit, op_Explicit, op_CheckedExplicit) against assembly-derived records. The diff shown for this commit is truncated, so the full file list (7 files) is not visible.Overall: one small additive public API (Bits(double)), one truncation correctness fix, and one dependency-driven docs-generation update. All three landed on 2026-10-03.
An example question, answered from the code.
What does this project do and how is it organised?
The user asked what this project does and how its code and repository are organised.
Humanizer/Inflections/InflectionEngine.cs, Humanizer/Inflections/InflectionBundle.Text.cs, Humanizer/Inflections/LocalizedInflectionCatalog.cs). It also includes localisation code (Humanizer/Localisation/EifelerRule.cs) and quantity formatting (Humanizer/ToQuantityExtensions.cs).Humanizer/, also shown as src/Humanizer/...), a source generator (Humanizer.SourceGenerators/, namespace Humanizer.SourceGenerators), Roslyn analyzers (src/Humanizer.Analyzers/README.md, Humanizer.Analyzers.NamespaceMigrationCodeFixProvider), and tests run via dotnet test tests/Humanizer.Tests/Humanizer.Tests.csproj (AGENTS.md:29).InflectionBundle.Text.Project (Humanizer/Inflections/InflectionBundle.Text.cs:5-46) takes input, output, a CaseProjection and an InflectionStatus, and returns an InflectionResult:Unsupported with the original input if output is empty or not well-formed UTF-16.casing == InflectionCasing.LowerTitleUpper and the projection is Title, it calls TryProjectUpper(..., firstOnly: true, ...). If the projection is Upper, it calls TryProjectUpper(..., firstOnly: false, ...). A failure in either call returns Unsupported.projected = output.IsScriptEligible(projected, allowNonLetters: true), or returns Unsupported.Invariant if the projected string equals the input (ordinal comparison). Otherwise it returns the supplied status with the projected text.Project are InflectionBundle.Inflect, InflectReverseProductive and TryExact. Its callees are IsScriptEligible, IsWellFormedUtf16 and TryProjectUpper.LocalizedInflectionCatalog.Inflect (Humanizer/Inflections/LocalizedInflectionCatalog.cs:48-59) takes a CultureInfo, direction, productive flag, plural category and quantity. If TryResolveBundle succeeds for the culture, it delegates to bundle.Inflect(...). Otherwise it returns a result with the resolution status and the original input.InflectionEngine.TryExact (Humanizer/Inflections/InflectionEngine.cs:530-632) does a binary search over forward or reverse entries, depending on direction. For LowerTitleUpper casing it compares case-insensitively. For Mixed projection, a match that is not an exact ordinal match gives Unknown. The snippet is truncated, so the rest is not shown.SuffixScaleWordsToNumberConverter.TryAdd), ByteSize, collection formatters, truncators and ToQuantityExtensions.ConcatWithSpace. These are shown only as names and edges, not bodies.Humanizer/. Paths seen include Inflections/, Localisation/ and Localisation/WordsToNumber/. Some source-text paths use src/Humanizer/....Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogEmission.cs is a source generator. [GRAPH] HumanizerSourceGenerator.CompareInflectionKeys is a caller of InflectionUnicodeData.CompareSimpleCase, which suggests the generator shares inflection key comparison logic with the runtime.src/Humanizer.Analyzers/README.md:40 mentions a "Fix All in Project" quick action. [GRAPH] Humanizer.Analyzers.NamespaceMigrationCodeFixProvider.GetReplacementName calls StringHumanizeExtensions.Concat.AGENTS.md:29 says tests run with dotnet test tests/Humanizer.Tests/Humanizer.Tests.csproj for net8.0, net10.0 and net11.0 on all platforms. net48 is run only on Windows.src/Benchmarks, tools/Humanizer.UnicodeDataGenerator and website/docs.An AI review of how outside input reaches risky operations.
No exploitable findings.
Humanizer is a pure .NET formatting library. Its code turns numbers, dates and enums into text using locale tables that are compiled in at build time. It never runs processes, reaches the network or touches the filesystem with untrusted input. I checked each sink the scan flagged. (1) .agents/skills/add-locale-batch/scripts/locale_batch_status.py: run_gh calls subprocess.run with an argument list and no shell. The arguments come from the CLI user's own --repo/--status flags and the PR numbers in their local JSON file. The only file it writes is the --status path the user names, so it crosses no trust boundary. (2) website/scripts/verify-pagefind.mjs is a local build-verification script that starts a server on the docs output it just built. Only the developer running it can reach it. (3) website/src/theme/Root/index.tsx: the dangerouslySetInnerHTML is a fixed string ('<pagefind-modal reset-on-close></pagefind-modal>'). The window.location.replace target comes from legacyRedirects.mjs, which checks at module load that every redirect destination is a local path ('/' but not '//'). It reads the referrer only when it has the same origin and the path appears in a static redirects.json, so there is no open redirect or XSS that an attacker controls. (4) GitHub workflows: docs.yml runs on pull_request, not pull_request_target. It sets top-level permissions to {}. Jobs with contents: write or pages: write are gated on push/workflow_dispatch, so code from a fork PR never runs with a write token or secrets. The NamespaceMigrationAnalyzer that ships in the package only inspects syntax and runs nothing. None of these paths gives an attacker code execution, credential theft, arbitrary file access or control of the repo or pipeline.