railsbp/rails_best_practices — Issue #102: Many false postives for "remove unused method"
Author: PragTob
Created: 2012-02-19 01:07:22+00:00
State: open

Hey there,

at first thanks for rails best practices - very cool tool.
When running the tool on my project [Tracketytrack] (https://github.com/PragTob/TracketyTrack) I seem to get many false positives telling me to remove unused methods, however these methods are used.
For instance:

```
./app/models/user.rb:75 - remove unused methods (User#make_salt)
```

where the method is definitely used (extracted from user.rb:)

``` ruby
def encrypt_password
self.salt = make_salt if new_record?
self.encrypted_password = encrypt(password) unless password.blank?
end

def encrypt(string)
secure_hash("#{salt}--#{string}")
end

def make_salt
secure_hash("#{Time.now.utc}--#{password}")
end
```

make_salt is used right at line 2.

For all the methods that are claimed to be unused check [this gist] (https://gist.github.com/1861498) - I can't guarantee right now that all of them are really used but the majority totally is (otherwise shame on me and my team!). But every method I checked so far is used and some of them pretty essential :-)

Oh I'm using 1.7.2.

Thank you!