Skip to content

Commit 73736c7

Browse files
committed
Add Rubocop to the Metasploit project
This is a work in progress because the code base is old and the style varies wildly, however .rubocop.yml can (and should) be tweaked over time to change standards as we see fit. As it stands right now there are few (if any) modules that pass Rubocop.
1 parent 72c0c59 commit 73736c7

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

.rubocop.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
LineLength:
2+
Enabled: true
3+
Max: 180
4+
5+
MethodLength:
6+
Enabled: true
7+
Max: 30
8+
9+
Style/ClassLength:
10+
Exclude:
11+
# Most modules are quite large and all contained in one class. This is OK.
12+
- 'modules/**/*'

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ and Metasploit's [Common Coding Mistakes](https://github.com/rapid7/metasploit-f
3333
## Code Contributions
3434

3535
* **Do** stick to the [Ruby style guide](https://github.com/bbatsov/ruby-style-guide).
36+
* Similarly, **try** to get Rubocop passing or at least relatively quiet against the files added/modified as part of your contribution
3637
* **Do** follow the [50/72 rule](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) for Git commit messages.
3738
* **Do** create a [topic branch](http://git-scm.com/book/en/Git-Branching-Branching-Workflows#Topic-Branches) to work on instead of working directly on `master`.
3839

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ group :pcap do
3535
end
3636

3737
group :development do
38+
# Style/sanity checking Ruby code
39+
gem 'rubocop'
3840
# Markdown formatting for yard
3941
gem 'redcarpet'
4042
# generating documentation

Gemfile.lock

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ GEM
1313
i18n (~> 0.6, >= 0.6.4)
1414
multi_json (~> 1.0)
1515
arel (3.0.2)
16+
ast (2.0.0)
1617
bcrypt (3.1.7)
1718
builder (3.0.4)
1819
database_cleaner (1.1.1)
@@ -33,8 +34,13 @@ GEM
3334
nokogiri (1.6.0)
3435
mini_portile (~> 0.5.0)
3536
packetfu (1.1.9)
37+
parser (2.1.9)
38+
ast (>= 1.1, < 3.0)
39+
slop (~> 3.4, >= 3.4.5)
3640
pcaprub (0.11.3)
3741
pg (0.16.0)
42+
powerpack (0.0.9)
43+
rainbow (2.0.0)
3844
rake (10.1.0)
3945
redcarpet (3.0.0)
4046
rkelly-remix (0.0.6)
@@ -47,12 +53,20 @@ GEM
4753
rspec-expectations (2.14.2)
4854
diff-lcs (>= 1.1.3, < 2.0)
4955
rspec-mocks (2.14.3)
56+
rubocop (0.23.0)
57+
json (>= 1.7.7, < 2)
58+
parser (~> 2.1.9)
59+
powerpack (~> 0.0.6)
60+
rainbow (>= 1.99.1, < 3.0)
61+
ruby-progressbar (~> 1.4)
62+
ruby-progressbar (1.5.1)
5063
shoulda-matchers (2.3.0)
5164
activesupport (>= 3.0.0)
5265
simplecov (0.5.4)
5366
multi_json (~> 1.0.3)
5467
simplecov-html (~> 0.5.3)
5568
simplecov-html (0.5.3)
69+
slop (3.5.0)
5670
sqlite3 (1.3.9)
5771
timecop (0.6.3)
5872
tzinfo (0.3.37)
@@ -81,6 +95,7 @@ DEPENDENCIES
8195
rkelly-remix (= 0.0.6)
8296
robots
8397
rspec (>= 2.12)
98+
rubocop
8499
shoulda-matchers
85100
simplecov (= 0.5.4)
86101
sqlite3

0 commit comments

Comments
 (0)