Skip to content

Bugfix: remove typo from logging.#34

Merged
kimkulling merged 4 commits intomainfrom
bugfix/remove_typo_in_logging
Apr 18, 2026
Merged

Bugfix: remove typo from logging.#34
kimkulling merged 4 commits intomainfrom
bugfix/remove_typo_in_logging

Conversation

@kimkulling
Copy link
Copy Markdown
Owner

@kimkulling kimkulling commented Apr 18, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Standardized log message formatting across severity levels for consistent output
    • Displayed plain message text (without severity prefix) for regular informational messages to improve readability

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 18, 2026

Warning

Rate limit exceeded

@kimkulling has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 52 minutes and 32 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 52 minutes and 32 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c2483442-4390-498a-9f27-e467710ff947

📥 Commits

Reviewing files that changed from the base of the PR and between 7ad53c5 and 51dbfee.

📒 Files selected for processing (1)
  • src/tinyui.cpp

Walkthrough

Updated log formatting in src/tinyui.cpp to special-case LogSeverity::Message (prints only the message and newline); other severities print severity token + space + message + newline. Also changed Context::create(...) to initialize mVersion via Version(0, 0, 2). Build config updated to C++23 in CMakeLists.txt.

Changes

Cohort / File(s) Summary
Logging & version init
src/tinyui.cpp
log_message(LogSeverity, const char*) now omits severity prefix for LogSeverity::Message and standardizes formatting for other severities (removes trailing period). Context::create(...) initializes ctx->mVersion with Version(0, 0, 2) instead of brace-init.
Build configuration
CMakeLists.txt
Updated CMAKE_CXX_STANDARD from 17 to 23.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title claims to fix a typo in logging, but the actual changes include updating the C++ standard from C++17 to C++23 in CMakeLists.txt, which is not a typo fix. The title should reflect all significant changes, such as 'Update C++ standard to C++23 and fix logging formatting' or provide a more comprehensive description of the changes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/remove_typo_in_logging

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/tinyui.cpp (1)

59-63: LGTM — fix is correct; consider guarding invalid severities.

The special case for LogSeverity::Message correctly avoids the leading empty token + space, and dropping the trailing period standardizes formatting. One minor defensive note: the else branch indexes SeverityToken with static_cast<size_t>(severity), which would underflow for LogSeverity::Invalid (-1) and overflow for LogSeverity::Count. An assert (or early return) on the valid range would make this robust against misuse.

🛡️ Optional defensive guard
 void log_message(LogSeverity severity, const char *message) {
     assert(message != nullptr);
+    assert(severity > LogSeverity::Invalid && severity < LogSeverity::Count);
     if (severity == LogSeverity::Message) {
         std::cout << message << "\n";
     } else {
         std::cout << SeverityToken[static_cast<size_t>(severity)] << " " << message << "\n";
     }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/tinyui.cpp` around lines 59 - 63, Add a defensive range check before
indexing SeverityToken: validate that the LogSeverity value is within the valid
range (greater than LogSeverity::Invalid and less than LogSeverity::Count) and
handle out-of-range values (e.g., assert, log an error and return, or clamp to a
default) so the else branch that uses
SeverityToken[static_cast<size_t>(severity)] cannot underflow/overflow;
reference the existing symbols SeverityToken, LogSeverity::Message,
LogSeverity::Invalid, and LogSeverity::Count in tinyui.cpp to locate where to
insert the guard.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/tinyui.cpp`:
- Around line 59-63: Add a defensive range check before indexing SeverityToken:
validate that the LogSeverity value is within the valid range (greater than
LogSeverity::Invalid and less than LogSeverity::Count) and handle out-of-range
values (e.g., assert, log an error and return, or clamp to a default) so the
else branch that uses SeverityToken[static_cast<size_t>(severity)] cannot
underflow/overflow; reference the existing symbols SeverityToken,
LogSeverity::Message, LogSeverity::Invalid, and LogSeverity::Count in tinyui.cpp
to locate where to insert the guard.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b0c8fe5c-1e55-4b6a-b820-ce142e44f47b

📥 Commits

Reviewing files that changed from the base of the PR and between 11107d8 and 132e647.

📒 Files selected for processing (1)
  • src/tinyui.cpp

@sonarqubecloud
Copy link
Copy Markdown

@kimkulling kimkulling added the bug Something isn't working label Apr 18, 2026
@kimkulling kimkulling merged commit c7c6d30 into main Apr 18, 2026
4 checks passed
@kimkulling kimkulling deleted the bugfix/remove_typo_in_logging branch April 18, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logger adds character .

1 participant