Skip to content

fix(config): Improve INI validation warning messages#52

Merged
codepuncher merged 1 commit into
mainfrom
refactor/config-utils-cleanup
Jun 17, 2026
Merged

fix(config): Improve INI validation warning messages#52
codepuncher merged 1 commit into
mainfrom
refactor/config-utils-cleanup

Conversation

@codepuncher

Copy link
Copy Markdown
Owner

Summary

  • Adds AsciiToLower helper and updates CaseInsensitiveEqual / CaseInsensitiveLess to use it instead of locale-dependent std::tolower [CFG-5]
  • Extracts warnIfUnrecognised lambda to deduplicate the two unrecognised-action warning blocks in LoadSettings [STYLE-1, STYLE-2]
  • Simplifies ReadHoldDuration to a single consolidated range warning instead of four per-case messages [CFG-6]
  • Adds HoldFast::kNoneName constant and replaces all "None" comparison literals across Config.cpp, MCMNavigator.cpp, InputHandler.cpp, and MenuUI.cpp [STYLE-3]

The warning messages in ReadHoldDuration and the unrecognised-action path are user-visible improvements — log output is now more actionable when the INI is misconfigured. Part of the June 2026 audit fix series (#51).

Test plan

  • Build clean (./scripts/build.sh)
  • clang-tidy and clang-format pass (pre-commit hooks)
  • In-game: hold Start/Back, MCM navigation works, action warnings appear correctly in log for unrecognised INI values

@codepuncher codepuncher requested review from Copilot June 17, 2026 08:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves user-facing configuration diagnostics and consistency by making case-insensitive comparisons ASCII-stable (non-locale-dependent), deduplicating INI warning logic, and centralizing the "None" sentinel name.

Changes:

  • Add HoldFast::AsciiToLower and update case-insensitive comparisons to avoid locale-dependent std::tolower.
  • Refactor LoadSettings warning path to deduplicate “unrecognised action” warnings and make ReadHoldDuration warnings more consolidated/actionable.
  • Introduce HoldFast::kNoneName and replace "None" comparison literals across config/UI/navigation call sites.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Utils.h Adds AsciiToLower and updates CaseInsensitiveEqual to use ASCII-stable lowercasing.
src/Config.cpp Consolidates fHoldDuration range warnings and deduplicates unrecognised-action warnings via a helper lambda.
src/LongPressAction.h Adds HoldFast::kNoneName constant for the "None" sentinel.
src/MCMNavigator.cpp Updates case-insensitive sort to use AsciiToLower and replaces "None" comparisons with kNoneName.
src/InputHandler.cpp Replaces "None" comparison with kNoneName for pending MCM navigation.
src/MenuUI.cpp Uses kNoneName for "None" comparisons in MCM target UI selection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/MenuUI.cpp
Comment thread src/Utils.h
@codepuncher codepuncher force-pushed the refactor/config-utils-cleanup branch from 4f9d83b to 1150942 Compare June 17, 2026 09:00
@codepuncher codepuncher requested review from Copilot and removed request for Copilot June 17, 2026 09:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread src/Utils.h Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread src/Utils.h

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@codepuncher codepuncher merged commit d3f7a66 into main Jun 17, 2026
12 checks passed
@codepuncher codepuncher deleted the refactor/config-utils-cleanup branch June 17, 2026 10:00
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.

2 participants