Mirror of metasploit
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

.rubocop.yml 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. # This list was intially created by analyzing the last three months (51
  2. # modules) committed to Metasploit Framework. Many, many older modules
  3. # will have offenses, but this should at least provide a baseline for
  4. # new modules.
  5. #
  6. # Updates to this file should include a 'Description' parameter for any
  7. # explaination needed.
  8. # inherit_from: .rubocop_todo.yml
  9. AllCops:
  10. TargetRubyVersion: 2.4
  11. Metrics/ClassLength:
  12. Description: 'Most Metasploit modules are quite large. This is ok.'
  13. Enabled: true
  14. Exclude:
  15. - 'modules/**/*'
  16. Style/ClassAndModuleChildren:
  17. Enabled: false
  18. Description: 'Forced nesting is harmful for grepping and general code comprehension'
  19. Metrics/AbcSize:
  20. Enabled: false
  21. Description: 'This is often a red-herring'
  22. Metrics/CyclomaticComplexity:
  23. Enabled: false
  24. Description: 'This is often a red-herring'
  25. Metrics/PerceivedComplexity:
  26. Enabled: false
  27. Description: 'This is often a red-herring'
  28. Style/TernaryParentheses:
  29. Enabled: false
  30. Description: 'This outright produces bugs'
  31. Style/FrozenStringLiteralComment:
  32. Enabled: false
  33. Description: 'We cannot support this yet without a lot of things breaking'
  34. Style/RedundantReturn:
  35. Description: 'This often looks weird when mixed with actual returns, and hurts nothing'
  36. Enabled: false
  37. Naming/VariableNumber:
  38. Description: 'To make it easier to use reference code, disable this cop'
  39. Enabled: false
  40. Style/NumericPredicate:
  41. Description: 'This adds no efficiency nor space saving'
  42. Enabled: false
  43. Style/Documentation:
  44. Enabled: true
  45. Description: 'Most Metasploit modules do not have class documentation.'
  46. Exclude:
  47. - 'modules/**/*'
  48. Layout/SpaceInsideArrayLiteralBrackets:
  49. Enabled: false
  50. Description: 'Almost all module metadata have space in brackets'
  51. Style/GuardClause:
  52. Enabled: false
  53. Description: 'This often introduces bugs in tested code'
  54. Style/EmptyLiteral:
  55. Enabled: false
  56. Description: 'This looks awkward when you mix empty and non-empty literals'
  57. Style/NegatedIf:
  58. Enabled: false
  59. Description: 'This often introduces bugs in tested code'
  60. Style/ConditionalAssignment:
  61. Enabled: false
  62. Description: 'This is confusing for folks coming from other languages'
  63. Style/Encoding:
  64. Description: 'We prefer binary to UTF-8.'
  65. Enabled: false
  66. Style/ParenthesesAroundCondition:
  67. Enabled: false
  68. Description: 'This is used in too many places to discount, especially in ported code. Has little effect'
  69. Style/TrailingCommaInArrayLiteral:
  70. Enabled: false
  71. Description: 'This is often a useful pattern, and is actually required by other languages. It does not hurt.'
  72. Metrics/LineLength:
  73. Description: >-
  74. Metasploit modules often pattern match against very
  75. long strings when identifying targets.
  76. Enabled: true
  77. Max: 180
  78. Metrics/BlockLength:
  79. Enabled: true
  80. Description: >-
  81. While the style guide suggests 10 lines, exploit definitions
  82. often exceed 200 lines.
  83. Max: 300
  84. Metrics/MethodLength:
  85. Enabled: true
  86. Description: >-
  87. While the style guide suggests 10 lines, exploit definitions
  88. often exceed 200 lines.
  89. Max: 300
  90. Naming/UncommunicativeMethodParamName:
  91. Enabled: true
  92. Description: 'Whoever made this requirement never looked at crypto methods, IV'
  93. MinNameLength: 2
  94. # %q() is super useful for long strings split over multiple lines and
  95. # is very common in module constructors for things like descriptions
  96. Style/UnneededPercentQ:
  97. Enabled: false
  98. Style/NumericLiterals:
  99. Enabled: false
  100. Description: 'This often hurts readability for exploit-ish code.'
  101. Layout/AlignHash:
  102. Enabled: false
  103. Description: 'aligning info hashes to match these rules is almost impossible to get right'
  104. Layout/EmptyLines:
  105. Enabled: false
  106. Description: 'these are used to increase readability'
  107. Layout/EmptyLinesAroundClassBody:
  108. Enabled: false
  109. Description: 'these are used to increase readability'
  110. Layout/EmptyLinesAroundMethodBody:
  111. Enabled: false
  112. Description: 'these are used to increase readability'
  113. Layout/AlignParameters:
  114. Enabled: true
  115. EnforcedStyle: 'with_fixed_indentation'
  116. Description: 'initialize method of every module has fixed indentation for Name, Description, etc'
  117. Style/For:
  118. Enabled: false
  119. Description: 'if a module is written with a for loop, it cannot always be logically replaced with each'
  120. Style/StringLiterals:
  121. Enabled: false
  122. Description: 'Single vs double quote fights are largely unproductive.'
  123. Style/WordArray:
  124. Enabled: false
  125. Description: 'Metasploit prefers consistent use of []'
  126. Style/IfUnlessModifier:
  127. Enabled: false
  128. Description: 'This style might save a couple of lines, but often makes code less clear'
  129. Style/RedundantBegin:
  130. Exclude:
  131. # this pattern is very common and somewhat unavoidable
  132. # def run_host(ip)
  133. # begin
  134. # ...
  135. # rescue ...
  136. # ...
  137. # ensure
  138. # disconnect
  139. # end
  140. # end
  141. - 'modules/**/*'
  142. Documentation:
  143. Exclude:
  144. - 'modules/**/*'