Rubocop rollout #14642
Replies: 4 comments
-
These can/should be overridden in the Rubocop config file or using custom rules. Discovering which rules are problematic is the hard part. Generally the Rubocop team try to avoid rules which will generate bugs.
Locking the version of Rubocop in the
I agree in the short term. In the long term, ensuring all code is consistent will make future reviews easier. Once the majority of the code base is brought up to date with consistent style then it will be much easier to manage and review new style changes as the changes will be much smaller.
As above.
Performing |
Beta Was this translation helpful? Give feedback.
-
Because the code is probably buggy and is impossible to maintain (and may contain security vulnerabilities) and unnecessarily increases the effort required to update/modify to the point where no one bothers adding new features because the existing code is impossible to read/understand so we end up writing terrible new code that leverages the existing terrible code which only makes the problem worse. |
Beta Was this translation helpful? Give feedback.
-
One additional issue not discussed above relates to indentation. A lot of the library code uses this format for modules: module Msf
class Post
module Linux
module BusyBox Rather than: module Msf
class Post
module Linux
module BusyBox Thus running Edit: A quick look through available Rubocop rules shows no rules which allow keeping the existing behavior. Presuming that we want to use indentation, perhaps it would make sense to update the indentation for all libraries (by automatically applying only the indentation rule) before applying additional changes. |
Beta Was this translation helpful? Give feedback.
-
Github supporting https://github.community/t/support-ignore-revs-file-in-githubs-blame-view/3256/13 |
Beta Was this translation helpful? Give feedback.
-
Problem
A lot of time is currently spent during code review pointing out obvious code quality mistakes with newly contributed Metasploit Modules. These problems can easily be automated with Rubocop.
Goal
Allow Metasploit maintainers to spend their time on more important matters.
Reduce the time spent reviewing easily fixed mistakes on pull requests.
Solution
Rely on Rubocop to enforce the consistency of Ruby code. Metasploit maintainers can simply request that Rubocop be ran on new modules, instead of commenting on each individual code quality rule that has been violated.
Considerations
Although it's possible to run Rubocop wholesale on all of Metasploit, it comes with some downsides:
Some of the above downsides with Rubocop directly conflict with the goal of allowing Metasploit maintainers and community members to spend their time on more important matters.
Outcome
WIth the above considerations, a good first step for the Rubocop initiative is to focus on solving the immediate problem of reducing the time spent on reviewing new modules. This means that core library files and old modules would be ignored for now.
Project mile stones
Beta Was this translation helpful? Give feedback.
All reactions