rubocop

https://github.com/bbatsov/rubocop

Ruby

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

RuboCop::Cop::VariableForce::Variable#used?

This is a convenient way to check whether the variable is used
in its entire variable lifetime.
For more precise usage check, refer Assignment#used?.

Once the variable is captured by a block, we have no idea
when, where and how many times the block would be invoked
and it means we cannot track the usage of the variable.
So we consider it's used to suppress false positive offenses.

Source | Google | Stack overflow

Edit

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

cd rubocop

open lib/rubocop/cop/variable_force/variable.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-RuboCop--Cop--VariableForce--Variable-used--for-pr


# Commit to git

git add lib/rubocop/cop/variable_force/variable.rbgit commit -m "better docs for RuboCop::Cop::VariableForce::Variable#used?"


# 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--VariableForce--Variable-used--for-pr

hub pull-request


# Celebrate!