rubocop

https://github.com/bbatsov/rubocop

Ruby

A Ruby static code analyzer, based on the community Ruby style guide.

RuboCop::Cop::Style::ConditionalAssignment#correction_exceeds_line_limit?

If `Metrics/LineLength` is enabled, we do not want to introduce an
offense by auto-correcting this cop. Find the max configured line
length. Find the longest line of condition. Remove the assignment
from lines that contain the offending assignment because after
correcting, this will not be on the line anymore. Check if the length
of the longest line + the length of the corrected assignment is
greater than the max configured line length

Source | Google | Stack overflow

Edit

git clone [email protected]:bbatsov/rubocop.git

cd rubocop

open lib/rubocop/cop/style/conditional_assignment.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-RuboCop--Cop--Style--ConditionalAssignment-correction_exceeds_line_limit--for-pr


# Commit to git

git add lib/rubocop/cop/style/conditional_assignment.rbgit commit -m "better docs for RuboCop::Cop::Style::ConditionalAssignment#correction_exceeds_line_limit?"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-RuboCop--Cop--Style--ConditionalAssignment-correction_exceeds_line_limit--for-pr

hub pull-request


# Celebrate!