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

Remove OpenStruct from primer_octicon cop #3052

Closed
wants to merge 1 commit into from

Conversation

HParker
Copy link

@HParker HParker commented Sep 4, 2024

OpenStruct will not be included in modern Ruby versions, so we should not rely on it being there. This removes usage and instead builds the same class instance that is returned above.

irb(main):003> h = RuboCop::AST::HashNode.new(hash) => s(:hash)
irb(main):004> h.keys
=> []
irb(main):005> h.pairs
=> []
irb(main):006> h.type
=> :hash

@HParker HParker requested a review from a team as a code owner September 4, 2024 20:10
Copy link

changeset-bot bot commented Sep 4, 2024

⚠️ No Changeset found

Latest commit: 8fafbbf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

OpenStruct will not be included in modern Ruby versions, so we should not rely on it being there.
This removes usage and instead builds the same class instance that is returned above.

irb(main):003> h = RuboCop::AST::HashNode.new(hash)
=> s(:hash)
irb(main):004> h.keys
=> []
irb(main):005> h.pairs
=> []
irb(main):006> h.type
=> :hash
Comment on lines +277 to +283
def test_no_args
investigate(cop, <<-RUBY)
octicon
RUBY

assert_correction "primer_octicon"
end
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the cop explicitly does nothing if no arguments are passed to the octicon method, so that's why this test is failing 😄

@camertron
Copy link
Contributor

camertron commented Sep 4, 2024

Hey @HParker, several of my branches are failing CI with error messages related to openstruct, so I went ahead and merged your fix in #3055 👍 Thank you!

@camertron camertron closed this Sep 4, 2024
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