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

Manual rubocop fixes #751

Merged
merged 19 commits into from
Feb 16, 2016
Merged

Conversation

jhawthorn
Copy link
Contributor

This fixes most of the remaining rubocop warnings that remained after the autocorrection.

Many of these offenses were not just rubocop warnings, but also ruby syntax warnings. This should mean that all files now pass ruby -c -w.

After this there are only 14 remaining offences, all of which to fix will need some minor behaviour change. To keep reviews simple, all changes made here should not effect behaviour.

@@ -33,7 +33,7 @@

get "/api/variants?q[product_name_or_sku_cont]=fritos", token: user.spree_api_key

skus = JSON.parse(response.body)['variants'].map { |variant| variant['sku'] }
skus = JSON.parse(response.body)['variants'].map { |x| x['sku'] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this beneficial? I'd find variant more descriptive as a variable name than x.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, var shadowing again. I don't mind the x.

Copy link
Member

Choose a reason for hiding this comment

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

Short local variable names for one liners are ok IMO, but I'll vote forv

@mamhoff
Copy link
Contributor

mamhoff commented Jan 28, 2016

Aside from the naming nitpick in order_inventory.rb, this is wonderful.

@jhawthorn
Copy link
Contributor Author

Updated with more descriptive names in the shadowed variable commit

@@ -35,7 +35,7 @@ def check_option_values(option_values)

it "can retrieve a list of specific option types" do
option_type_1 = create(:option_type)
option_type_2 = create(:option_type)
create(:option_type)
Copy link
Member

Choose a reason for hiding this comment

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

If we're here, why not follow "given, when, then" and put this into a before block? option_type1 could even be a let!

@jhawthorn
Copy link
Contributor Author

rebased

@cbrunsdon
Copy link
Contributor

I appreciate some people's comments on things but I'd say just merge it as it is. Its an improvement and none of the suggested changes I read made it significantly better or clearer than the change already happening.

Also its a Big Fat Change and the sooner we merge the less hassle it'll be for hawthorn.

Removes use of inject and unused variables
Remove all assignments flagged by rubocop's Lint/UselessAssignment
This test was previously missing an assertion. Added one to assert the
current behaviour
This fixes lines like

  foo ( 1 + 2 ) + 3

Which is unclear
Fixes Style/NestedParenthesizedCalls
@tvdeyen
Copy link
Member

tvdeyen commented Feb 16, 2016

Go!

jhawthorn added a commit that referenced this pull request Feb 16, 2016
@jhawthorn jhawthorn merged commit 53077ad into solidusio:master Feb 16, 2016
@jhawthorn jhawthorn deleted the manual_rubocop_fixes branch February 16, 2016 22:55
@jhawthorn jhawthorn restored the manual_rubocop_fixes branch February 16, 2016 22:56
@tvdeyen
Copy link
Member

tvdeyen commented Feb 16, 2016

😎

@mtomov
Copy link
Contributor

mtomov commented Feb 19, 2016

Thank you for that!

@jhawthorn jhawthorn deleted the manual_rubocop_fixes branch October 17, 2016 23:20
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.

None yet

6 participants