Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Rubocop autoconfig #3587

Merged
merged 4 commits into from
Aug 4, 2014
Merged

Conversation

todb-r7
Copy link

@todb-r7 todb-r7 commented Jul 29, 2014

This excludes all the existing problems reported by Rubocop so that we don't get depressed by seeing every single module fail the check.

The goal is to at least prevent new classes of Rubocop errors from cropping up, and provide a TODO list of fixes to make across our giant code base.

Incidentally, this method of starting out with Rubocop is suggested in Rubocop's README.md.

CC @jhart-r7

Tod Beardsley added 2 commits July 29, 2014 16:48
This alphabetizes the configuration for rubocop.yml and preps for a
rubocop auto-config so we're not constantly hit with warnings.
@todb-r7
Copy link
Author

todb-r7 commented Jul 29, 2014

I'm experimenting with this TODO now to see how painful it is to knock out some tasks with rubocop --only runs -- ideally, you'd want to tackle each offense in turn, now that you know where they are.

@jhart-r7
Copy link
Contributor

I can't test this right now, but if this was committed and I added a new module/etc that is rife with style problems, what happens? Would rubocop flag it? Or only if the problems were not among the types of problems already present in existing code?

@todb
Copy link
Contributor

todb commented Jul 30, 2014

It's per type, but not per file. Rubocop doesn't appear to have a syntax for "ignore this problem only in these files."

So, we have a zillion strings with double quotes that don't actually need double quotes, so if you add a few more, you will not trigger a warning.

Ruby style purity is a very long road.

Sent from a tiny computer.
PGP KeyId: 4096R/F577904A
https://gist.github.com/todb-r7/84ae2e08eb4dafbc4822
Text (insecure): 512-438-9165

@kernelsmith
Copy link
Contributor

It’s already super fun when you have methods named after windows api data structs cuz you get a shit-ton of wrong case warnings. I’ve been letting it go if it’s strictly stuff like:

halDispatchTable = session.railgun.kernel32.GetProcAddress(hKernel, 'HalDispatchTable’)

tho I realize it could be enforced w/o real detriment. BTW, I’ve found this a handy technique for shortening and adding readability to long railgun calls

lp_image_base = %w(PBLOB lpImageBase out)
cb = %w(DWORD cb in)
lpcb_needed = %w(PDWORD lpcbNeeded out)
session.railgun.add_function('psapi', 'EnumDeviceDrivers', 'BOOL',
                                 [lp_image_base, cb, lpcb_needed])

credit to @zeroSteiner and/or @OJ on the idea of using %w

On Jul 29, 2014, at 7:03 PM, Tod Beardsley notifications@github.com wrote:

It's per type, but not per file. Rubocop doesn't appear to have a syntax for "ignore this problem only in these files."

So, we have a zillion strings with double quotes that don't actually need double quotes, so if you add a few more, you will not trigger a warning.

Ruby style purity is a very long road.

Sent from a tiny computer.
PGP KeyId: 4096R/F577904A
https://gist.github.com/todb-r7/84ae2e08eb4dafbc4822
Text (insecure): 512-438-9165

Reply to this email directly or view it on GitHub.

Tod Beardsley added 2 commits July 30, 2014 10:28
Per a discussion in IRC, these rules in particular don't
appear to be valuable for Metasploit at this stage.
@kernelsmith kernelsmith merged commit 7bf9d25 into rapid7:master Aug 4, 2014
@todb-r7 todb-r7 deleted the rubocop-autoconfig branch November 25, 2014 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants