Skip to content

Comments

Small update to "verbose linting" spec to allow for Ruby 3.4 backtrace changes#1731

Merged
neilvcarvalho merged 1 commit intothoughtbot:mainfrom
CodeMeister:lint-spec-backtrace
Feb 3, 2025
Merged

Small update to "verbose linting" spec to allow for Ruby 3.4 backtrace changes#1731
neilvcarvalho merged 1 commit intothoughtbot:mainfrom
CodeMeister:lint-spec-backtrace

Conversation

@CodeMeister
Copy link
Contributor

Update for testing in Ruby 3.4

  • file: spec/acceptance/lint_spec.rb:188

THE PROBLEM THIS FIXES

Ruby 3.4 backtrace locations now include both the object and method names in the format:
"<object_name>#<method_name>.

So a backtrace location with "...save!" in ruby 3.3, now becomes "... 'InvalidThing#save!'" in Ruby 3.4.

THE SOLUTION

The solution was to update the test regex to allow for either option:
%r{#{FILE}:\d*:in ('InvalidThing#save!'|`save!')}

… 3.4

- file:   spec/acceptance/lint_spec.rb:188

Ruby 3.4 backtrace locations now include the object name
as well as the method name.

So "...`save!`" in 3.3, becomes "...'InvalidThing#save!'" in 3.4

The solution was to update the test regex to allow for either option:
  %r{#{__FILE__}:\d*:in ('InvalidThing#save!'|`save!')}
Copy link
Member

@neilvcarvalho neilvcarvalho left a comment

Choose a reason for hiding this comment

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

TY! I was going to add this as an issue as I didn't have time to investigate yesterday, and forgot. This unlocks adding Ruby 3.4 to the test matrix, which I was trying to add initially.

@neilvcarvalho neilvcarvalho merged commit 5df1196 into thoughtbot:main Feb 3, 2025
25 checks passed
@CodeMeister CodeMeister deleted the lint-spec-backtrace branch July 28, 2025 12:34
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