rapid7/metasploit-framework — pull request #3712 by kernelsmith (2014-08-26 20:43:03+00:00)
Title: adds better exploit module detection to msftidy

Instead of only looking for Msf::Exploit, it now looks to see if the next line has any contents besides whitespace and/or the word 'end'. This removes a false positive on spec/lib/msf/core/modules/loader/archive_spec.rb. To implement this, a method named is_exploit_module? is implemented which can be adjusted if the current approach proves too simple in the future. Additionally, some regex usage was made into a constant to reduce repeated regex compilations. Also, @source.lines was being called repeatedly, so this was made into an internal attribute called @lines and the code was refactored to accommodate so the file contents aren't repeatedly split on line endings, instead just once. Note @lines is an enumerator, not an Array, so things like .first and .each will work, the latter essentially replacing @source.each_line, however you cannot do stuff like @lines[1..10]. If certain indices are required, simply use each_with_index.

## Verification

- [ ] Run tools/msftidy specs/ on master, note the errors and warnings generated
- [ ] Run tools/msftidy specs/ on this branch, note that one error should no longer appear. The error is

```
spec/lib/msf/core/modules/loader/archive_spec.rb - [ERROR] Exploit is missing a disclosure date
```