Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore skipped specs for Prism #451

Merged
merged 1 commit into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@
RUBY
end

# FIXME: `undefined method `[]' for nil` occurs Prism 0.24.0. It has been resolved in
# the development line. This will be resolved in Prism > 0.24.0 and higher releases.
it 'registers an offense when the method is called with no receiver', broken_on: :prism do
it 'registers an offense when the method is called with no receiver' do
expect_offense(<<~RUBY)
all? do |e|
[1, 2, 3].include?(e)
Expand Down
4 changes: 1 addition & 3 deletions spec/rubocop/cop/performance/redundant_merge_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@
end
end

# FIXME: `undefined method `[]' for nil` occurs Prism 0.24.0. It has been resolved in
# the development line. This will be resolved in Prism > 0.24.0 and higher releases.
context 'when receiver is implicit', broken_on: :prism do
context 'when receiver is implicit' do
it "doesn't autocorrect" do
new_source = autocorrect_source('merge!(foo: 1, bar: 2)')
expect(new_source).to eq('merge!(foo: 1, bar: 2)')
Expand Down
16 changes: 4 additions & 12 deletions spec/rubocop/cop/performance/string_identifier_argument_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
RUBY
end
else
# FIXME: `undefined method `[]' for nil` occurs Prism 0.24.0. It has been resolved in
# the development line. This will be resolved in Prism > 0.24.0 and higher releases.
it "registers an offense when using string argument for `#{method}` method", broken_on: :prism do
it "registers an offense when using string argument for `#{method}` method" do
expect_offense(<<~RUBY, method: method)
#{method}('do_something')
_{method} ^^^^^^^^^^^^^^ Use `:do_something` instead of `'do_something'`.
Expand All @@ -40,18 +38,14 @@
RUBY
end

# FIXME: `undefined method `[]' for nil` occurs Prism 0.24.0. It has been resolved in
# the development line. This will be resolved in Prism > 0.24.0 and higher releases.
it "does not register an offense when using symbol argument for `#{method}` method", broken_on: :prism do
it "does not register an offense when using symbol argument for `#{method}` method" do
expect_no_offenses(<<~RUBY)
#{method}(:do_something)
RUBY
end

if described_class::INTERPOLATION_IGNORE_METHODS.include?(method)
# FIXME: `undefined method `[]' for nil` occurs Prism 0.24.0. It has been resolved in
# the development line. This will be resolved in Prism > 0.24.0 and higher releases.
it 'does not register an offense when using string interpolation for `#{method}` method', broken_on: :prism do
it 'does not register an offense when using string interpolation for `#{method}` method' do
# NOTE: These methods don't support `::` when passing a symbol. const_get('A::B') is valid
# but const_get(:'A::B') isn't. Since interpolated arguments may contain any content these
# cases are not detected as an offense to prevent false positives.
Expand All @@ -60,9 +54,7 @@
RUBY
end
else
# FIXME: `undefined method `[]' for nil` occurs Prism 0.24.0. It has been resolved in
# the development line. This will be resolved in Prism > 0.24.0 and higher releases.
it 'registers an offense when using interpolated string argument', broken_on: :prism do
it 'registers an offense when using interpolated string argument' do
expect_offense(<<~RUBY, method: method)
#{method}("do_something_\#{var}")
_{method} ^^^^^^^^^^^^^^^^^^^^^ Use `:"do_something_\#{var}"` instead of `"do_something_\#{var}"`.
Expand Down