Skip to content

[patch] Parse "minor" and "natural_minor" as the Aeolian mode - #398

Merged
matt-edmondson merged 2 commits into
mainfrom
fix/302-minor-mode-alias
Oct 9, 2026
Merged

matt-edmondson merged 2 commits into
mainfrom
fix/302-minor-mode-alias

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #302

What was wrong

The mode alias table in Semantics.Music/Mode.cs only mapped ionian to major. As a result Key.TryParse("A minor", out _) returned false and Mode.Parse("minor") threw, even though "A minor" is the usual way to write half of all keys.

Change

  • Map minor and natural_minor to aeolian in Aliases. Lookup is case-insensitive, like the existing alias.
  • Update the TryParse remark to list the aliases.

Tests

  • ModeTests.Parse_MinorAlias_EqualsAeolian: minor, Minor and natural_minor each parse to Mode.Aeolian, and ToString() still prints the canonical aeolian.
  • KeyTests.Parse_MinorSpelling_IsTheSameKeyAsAeolian: Key.Parse("A minor") equals A aeolian, and ToString() still prints "A aeolian".

Verification

  • Without the alias entries, all four new test cases fail.
  • With them, the full Semantics.Test suite passes: 1484 passed, 0 failed, 8 skipped (the same 8 are skipped on main). Semantics.Music builds with 0 warnings.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RsRLSwgcnfRH2EGHrQMMxb


Generated by Claude Code

claude added 2 commits October 8, 2026 09:34
The mode alias table only mapped ionian to major, so the usual spelling of
a minor key failed: Key.TryParse("A minor") returned false and
Mode.Parse("minor") threw. Map minor and natural_minor to aeolian, so a
parsed "A minor" equals A aeolian and still prints as "A aeolian".

Fixes #302

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RsRLSwgcnfRH2EGHrQMMxb
The minor aliases made "aeolian" the fourth copy of the same literal in
Mode.cs, which SonarCloud's S1192 check failed the quality gate on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RsRLSwgcnfRH2EGHrQMMxb
@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Key.Parse("A minor") fails: "minor" isn't a recognised mode name, only "aeolian" is

2 participants