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

Fix dataclump analysis for clumps in non consecutive methods #1799

Conversation

le-santos
Copy link
Contributor

This PR fixes issue #1798.

What changes?

  1. DataClump detector now creates all combinations between methods to analyse for possible clumps, instead of grouping only the consecutive methods.
def a(x,y); end
def b(x,y); end
def c(z)  ; end
def d(x,y); end

# Before
# candidate_methods.each_cons(3)
# => [[a, b, c], [b, c, d]]

# Now
# candidate_methods.combination(3)
# => [[a, b, c], [a, b, d], [a, c, d], [b, c, d]]
  1. After this fix, the codebase quality tests pointed a new DataClump smell in Reek::AST::Node class. For that reason, it was necessary to adjust some params in protected methods of this class.

@le-santos le-santos changed the title Le santos/fix dataclump analysis for clumps in non consecutive methods Fix dataclump analysis for clumps in non consecutive methods Jan 9, 2025
Copy link

@leandronsp leandronsp left a comment

Choose a reason for hiding this comment

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

superb!

@troessner
Copy link
Owner

Very nice @le-santos! @mvz PR looks good to me, wdyt about merging this one and releasing a new version?

@mvz
Copy link
Collaborator

mvz commented Jan 12, 2025

@troessner yes, looks good to me too!

@troessner troessner merged commit b442b59 into troessner:master Jan 12, 2025
6 checks passed
@troessner
Copy link
Owner

Releasing 6.4 now, thanks @le-santos !

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.

4 participants