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

Refactor StaticComparison + rename to LiteralsComparison #293

Merged
merged 2 commits into from
Nov 2, 2022

Conversation

Sija
Copy link
Member

@Sija Sija commented Nov 2, 2022

Followup to #292 (comment)

@Sija Sija added this to the 1.3.0 milestone Nov 2, 2022
@Sija Sija requested a review from veelenga November 2, 2022 00:40
@Sija Sija self-assigned this Nov 2, 2022
@Sija Sija force-pushed the Sija/refactor-static-comparison-rule branch from 6e85b21 to 75af2ec Compare November 2, 2022 00:42
Comment on lines +61 to +62
is_dynamic = obj.class.in?(DYNAMIC_LITERAL_TYPES) ||
arg.class.in?(DYNAMIC_LITERAL_TYPES)
Copy link
Member Author

@Sija Sija Nov 2, 2022

Choose a reason for hiding this comment

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

This could have a recursive check in re: to the container types, to see whether they consist of all primitives, and thus can be deemed static. I've left it as a potential further improvement, plus it's a pretty minor detail.

@Sija Sija changed the title Refactor Lint/StaticComparison to LiteralsComparison Refactor StaticComparison + rename to LiteralsComparison Nov 2, 2022
@Sija Sija force-pushed the Sija/refactor-static-comparison-rule branch from 75af2ec to 6bf8db8 Compare November 2, 2022 01:00
So, the  comparisons like `Regex == 1=42` will also be detected.
Copy link
Member

@veelenga veelenga left a comment

Choose a reason for hiding this comment

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

Makes sense to me. Thank you

@veelenga
Copy link
Member

veelenga commented Nov 2, 2022

I am going to prepare a new release if you are ok with that.

@Sija Sija merged commit 816c8b1 into master Nov 2, 2022
@Sija Sija deleted the Sija/refactor-static-comparison-rule branch November 2, 2022 09:10
@Sija
Copy link
Member Author

Sija commented Nov 2, 2022

@veelenga Sure, 1.3.0 is moar than ready to be released :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants