bbatsov/rubocop — pull request #74 by RyanBoland (2013-04-20 02:47:26+00:00)
Title: New Cop - Number of LOC (lines of code) in method

Hey Guys,

Please be gentle, this is my first open source contribution!

I've added this cop as described in #60:
* Avoid methods longer than 10 LOC (lines of code). Ideally, most methods will be shorter than 5 LOC. Empty lines do not contribute to the relevant LOC. (this cop should have configurable max length)

### Issues
1. I had to configure the number of LOC limit to 65 in order to get everything passing for the Rubocop source code. If you'd like, I can go through and refactor/ignore the longer methods, but I wanted to get your opinion first.

2. 2abb4a5 - I had some trouble locating the "end" token that is associated with each "def". The line counts are conservative in some cases

For example:

``` ruby
def example(a, y)
if a == y
puts "yes"
end
end
```
My code currently finds the line # of the `"yes"` and adds one to it in order to find the `end`. In this example, though, that guess is incorrect because the `if` statement is closing on the next line. Like I said, I couldn't think of a way to explicitly find the proper `end`, please let me know if you have any ideas.
I have a pending test for this particular case.

Any feedback or general tips are very much welcome.
Thanks