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 Lint/DuplicateMethods #1173

Merged
merged 1 commit into from
Aug 14, 2017
Merged

Fix Lint/DuplicateMethods #1173

merged 1 commit into from
Aug 14, 2017

Conversation

mxygem
Copy link
Member

@mxygem mxygem commented Aug 10, 2017

Summary

Investigated the Lint/DuplicateMethods offenses and need guidance on how best to address them.

Details

  • Offense count: 2
  • Added review note as I'm unsure how these should be handled.
  • Review note: In the two instances of duplication, both methods are under MultilineArgument, but one self method calls another that belongs to the private Builder class.
  • Here's the code in question

Motivation and Context

Working to help solve issue 1021!

How Has This Been Tested?

bundle exec rake 👍

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

@mattwynne
Copy link
Member

I think you could safely inline those two method calls on lines 32 and 36, and construct the types directly there. Leave the Builder to just be used for the from_core method.

@mxygem
Copy link
Member Author

mxygem commented Aug 12, 2017

So, in getting more familiar with the code and realizing that builder.doc_string and builder.data_table are pretty widely used concepts, it makes removing them from the Builder class not a good idea, IMO. Here's some info on what I did, and why:

* There's only a single point that calls MultilineArgument.doc_string directly when running the rake tests, so I've changed it to MultilineArgument.doc_string_builder and modified the method outside Builder in multiline_argument.rb to match.

  • While there seem to be no tests that touch lines 35-37 of multiline_argument.rb aka data_table I've updated it to match the dos_string_builder naming scheme, too. This section of code potentially has a coverage issue as it seems like we're not testing arrays. I can comment out the code called here, and rake doesn't break

* I've also changed the #from method for both string and array argument types, so that code that utilizes #from will work accordingly too.

Running bundle exec rake succeeds without any errors due to this change.

Commit inc!

@mxygem
Copy link
Member Author

mxygem commented Aug 13, 2017

Inlined the function so things should look/feel better.

* Offense count: 2
* Inlined methods and all is good.
@mxygem mxygem merged commit 47811a0 into cucumber:master Aug 14, 2017
@mxygem mxygem deleted the 1021-fix-style-violations-2 branch August 14, 2017 22:48
@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants