.rubocop.yml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. require: rubocop-performance
  2. AllCops:
  3. TargetRubyVersion: 2.6.3
  4. # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
  5. # to leave them active, so we can selectively disable cops where appropriate.
  6. DisabledByDefault: false
  7. # Ignore most generated files
  8. Exclude:
  9. - '**/templates/**/*'
  10. - '**/vendor/**/*'
  11. - '**/node_modules/**/*'
  12. - 'bin/bundle'
  13. - 'bin/rails'
  14. - 'bin/rake'
  15. - 'bin/setup'
  16. - 'bin/spring'
  17. - 'bin/update'
  18. - 'bin/webpack'
  19. - 'bin/webpack-dev-server'
  20. - 'bin/yarn'
  21. - 'db/schema.rb'
  22. Performance:
  23. Exclude:
  24. - '**/spec/**/*'
  25. Rails:
  26. Enabled: true
  27. # Prefer &&/|| over and/or.
  28. Style/AndOr:
  29. Enabled: true
  30. # Do not use braces for hash literals when they are the last argument of a
  31. # method call.
  32. Style/BracesAroundHashParameters:
  33. Enabled: true
  34. EnforcedStyle: context_dependent
  35. # Align `when` with `case`.
  36. Layout/CaseIndentation:
  37. Enabled: true
  38. # Align comments with method definitions.
  39. Layout/CommentIndentation:
  40. Enabled: true
  41. Layout/ElseAlignment:
  42. Enabled: true
  43. # Align `end` with the matching keyword or starting expression except for
  44. # assignments, where it should be aligned with the LHS.
  45. Layout/EndAlignment:
  46. Enabled: true
  47. EnforcedStyleAlignWith: variable
  48. AutoCorrect: true
  49. Layout/EmptyLineAfterMagicComment:
  50. Enabled: true
  51. Layout/EmptyLinesAroundBlockBody:
  52. Enabled: true
  53. # In a regular class definition, no empty lines around the body.
  54. Layout/EmptyLinesAroundClassBody:
  55. Enabled: true
  56. # In a regular method definition, no empty lines around the body.
  57. Layout/EmptyLinesAroundMethodBody:
  58. Enabled: true
  59. # In a regular module definition, no empty lines around the body.
  60. Layout/EmptyLinesAroundModuleBody:
  61. Enabled: true
  62. Layout/FirstParameterIndentation:
  63. Enabled: true
  64. # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
  65. Style/HashSyntax:
  66. Enabled: true
  67. # Method definitions after `private` or `protected` isolated calls need one
  68. # extra level of indentation.
  69. Layout/IndentationConsistency:
  70. Enabled: true
  71. EnforcedStyle: rails
  72. # Two spaces, no tabs (for indentation).
  73. Layout/IndentationWidth:
  74. Enabled: true
  75. Layout/LeadingCommentSpace:
  76. Enabled: true
  77. Layout/SpaceAfterColon:
  78. Enabled: true
  79. Layout/SpaceAfterComma:
  80. Enabled: true
  81. Layout/SpaceAfterSemicolon:
  82. Enabled: true
  83. Layout/SpaceAroundEqualsInParameterDefault:
  84. Enabled: true
  85. Layout/SpaceAroundKeyword:
  86. Enabled: true
  87. Layout/SpaceAroundOperators:
  88. Enabled: true
  89. Layout/SpaceBeforeComma:
  90. Enabled: true
  91. Layout/SpaceBeforeComment:
  92. Enabled: true
  93. Layout/SpaceBeforeFirstArg:
  94. Enabled: true
  95. Style/DefWithParentheses:
  96. Enabled: true
  97. # Defining a method with parameters needs parentheses.
  98. Style/MethodDefParentheses:
  99. Enabled: true
  100. Style/FrozenStringLiteralComment:
  101. Enabled: true
  102. EnforcedStyle: always
  103. Exclude:
  104. - 'db/schema.rb'
  105. Style/RedundantFreeze:
  106. Enabled: true
  107. Style/Documentation:
  108. Enabled: false
  109. Style/ClassAndModuleChildren:
  110. Enabled: false
  111. Style/BlockComments:
  112. Enabled: false
  113. Style/RescueModifier:
  114. Enabled: false
  115. Style/GuardClause:
  116. Enabled: false
  117. Metrics/BlockLength:
  118. Enabled: false
  119. Metrics/LineLength:
  120. Max: 120
  121. Metrics/MethodLength:
  122. Max: 20
  123. Metrics/AbcSize:
  124. Enabled: false
  125. # Use `foo {}` not `foo{}`.
  126. Layout/SpaceBeforeBlockBraces:
  127. Enabled: true
  128. Exclude:
  129. - '**/spec/**/*'
  130. # Use `foo { bar }` not `foo {bar}`.
  131. Layout/SpaceInsideBlockBraces:
  132. Enabled: true
  133. EnforcedStyleForEmptyBraces: space
  134. Exclude:
  135. - '**/spec/**/*'
  136. # Use `{ a: 1 }` not `{a:1}`.
  137. Layout/SpaceInsideHashLiteralBraces:
  138. Enabled: true
  139. Layout/SpaceInsideParens:
  140. Enabled: true
  141. Style/TrailingCommaInHashLiteral:
  142. Enabled: true
  143. EnforcedStyleForMultiline: comma
  144. # Check quotes usage according to lint rule below.
  145. Style/StringLiterals:
  146. Enabled: true
  147. EnforcedStyle: single_quotes
  148. # Detect hard tabs, no hard tabs.
  149. Layout/Tab:
  150. Enabled: true
  151. # Blank lines should not have any spaces.
  152. Layout/TrailingBlankLines:
  153. Enabled: true
  154. # No trailing whitespace.
  155. Layout/TrailingWhitespace:
  156. Enabled: true
  157. # Use quotes for string literals when they are enough.
  158. Style/UnneededPercentQ:
  159. Enabled: true
  160. Lint/AmbiguousOperator:
  161. Enabled: true
  162. Lint/AmbiguousRegexpLiteral:
  163. Enabled: true
  164. Lint/ErbNewArguments:
  165. Enabled: true
  166. # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
  167. Lint/RequireParentheses:
  168. Enabled: true
  169. Lint/ShadowingOuterLocalVariable:
  170. Enabled: true
  171. Lint/StringConversionInInterpolation:
  172. Enabled: true
  173. Lint/UriEscapeUnescape:
  174. Enabled: true
  175. Lint/UselessAssignment:
  176. Enabled: true
  177. Lint/DeprecatedClassMethods:
  178. Enabled: true
  179. Style/ParenthesesAroundCondition:
  180. Enabled: true
  181. Style/RedundantBegin:
  182. Enabled: true
  183. Style/RedundantReturn:
  184. Enabled: true
  185. AllowMultipleReturnValues: true
  186. Style/Semicolon:
  187. Enabled: true
  188. AllowAsExpressionSeparator: true
  189. # Prefer Foo.method over Foo::method
  190. Style/ColonMethodCall:
  191. Enabled: true
  192. Style/TrivialAccessors:
  193. Enabled: true
  194. Performance/FlatMap:
  195. Enabled: true
  196. Performance/RedundantMerge:
  197. Enabled: true
  198. Performance/StartWith:
  199. Enabled: true
  200. Performance/EndWith:
  201. Enabled: true
  202. Performance/RegexpMatch:
  203. Enabled: true
  204. Performance/ReverseEach:
  205. Enabled: true
  206. Performance/UnfreezeString:
  207. Enabled: true