Standardize bare Ruby exception messages to lowercase, unpunctuated - #2909
Merged
Conversation
dblock
force-pushed
the
standardize-error-messages
branch
from
September 5, 2026 21:55
63c925d to
a736de5
Compare
Danger ReportNo issues found. |
dblock
force-pushed
the
standardize-error-messages
branch
from
September 5, 2026 21:56
a736de5 to
f8e5a19
Compare
Contributor
|
@dblock I'll make a release after this PR. |
Lowercase and remove trailing periods from ArgumentError messages in dsl/entity.rb, dsl/inside_route.rb, dsl/validations.rb and validations/types/dry_type_coercer.rb, matching the lowercase, unpunctuated style already used everywhere else and consistent with Ruby's own core/stdlib exceptions. Documents the convention in CONTRIBUTING.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add the rubocop-exception_messages RuboCop plugin (https://github.com/dblock/rubocop-exception_messages) to catch any future regressions in exception message casing/punctuation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dblock
force-pushed
the
standardize-error-messages
branch
from
September 6, 2026 16:55
f49090f to
524de97
Compare
… 0.2.0 Bump rubocop-exception_messages to 0.2.0, which adds the QuoteStyle cop enforcing backtick-wrapped interpolated values in exception messages by default. Autocorrect and fix affected spec assertions.
Member
Author
|
@ericproulx ready |
ericproulx
approved these changes
Sep 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lowercases and removes trailing periods from the 7
ArgumentErrormessages inlib/that deviated from the rest of the codebase's lowercase, unpunctuated style (dsl/entity.rb,dsl/inside_route.rb,dsl/validations.rb,validations/types/dry_type_coercer.rb), and documents the convention in CONTRIBUTING.md.This matches Ruby's own core/stdlib exception style (e.g.
TypeError: no implicit conversion from nil to integer), which reads naturally when printed after the exception class name and colon in a backtrace, and is consistent with howGrape::Exceptions::*messages are already written.Updated the corresponding specs that asserted the old exact message text.
To help enforce this convention going forward, I created a new RuboCop plugin gem, rubocop-exception_messages, with
ExceptionMessages/CasingandExceptionMessages/Punctuationcops that flag/autocorrect exception messages violating this style. Added as a dev dependency here so CI catches any regressions.Bumped to 0.2.0, which adds
ExceptionMessages/QuoteStyle, enabled by default, wrapping interpolated values in backticks (e.g."unknown type: `#{type}`") for consistency across error messages. Autocorrected the 16 affected messages acrosslib/andspec/, and updated specs asserting exact message text accordingly.