.rubocop.yml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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. - spec/capybara_helper.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. EnforcedStyle: no_space
  140. Layout/SpaceInsideParens:
  141. Enabled: true
  142. Style/TrailingCommaInHashLiteral:
  143. Enabled: true
  144. EnforcedStyleForMultiline: comma
  145. # Check quotes usage according to lint rule below.
  146. Style/StringLiterals:
  147. Enabled: true
  148. EnforcedStyle: single_quotes
  149. # Detect hard tabs, no hard tabs.
  150. Layout/Tab:
  151. Enabled: true
  152. # Blank lines should not have any spaces.
  153. Layout/TrailingBlankLines:
  154. Enabled: true
  155. # No trailing whitespace.
  156. Layout/TrailingWhitespace:
  157. Enabled: true
  158. # Use quotes for string literals when they are enough.
  159. Style/UnneededPercentQ:
  160. Enabled: true
  161. Lint/AmbiguousOperator:
  162. Enabled: true
  163. Lint/AmbiguousRegexpLiteral:
  164. Enabled: true
  165. Lint/ErbNewArguments:
  166. Enabled: true
  167. # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
  168. Lint/RequireParentheses:
  169. Enabled: true
  170. Lint/ShadowingOuterLocalVariable:
  171. Enabled: true
  172. Lint/StringConversionInInterpolation:
  173. Enabled: true
  174. Lint/UriEscapeUnescape:
  175. Enabled: true
  176. Lint/UselessAssignment:
  177. Enabled: true
  178. Lint/DeprecatedClassMethods:
  179. Enabled: true
  180. Style/ParenthesesAroundCondition:
  181. Enabled: true
  182. Style/RedundantBegin:
  183. Enabled: true
  184. Style/RedundantReturn:
  185. Enabled: true
  186. AllowMultipleReturnValues: true
  187. Style/Semicolon:
  188. Enabled: true
  189. AllowAsExpressionSeparator: true
  190. # Prefer Foo.method over Foo::method
  191. Style/ColonMethodCall:
  192. Enabled: true
  193. Style/TrivialAccessors:
  194. Enabled: true
  195. Performance/FlatMap:
  196. Enabled: true
  197. Performance/RedundantMerge:
  198. Enabled: true
  199. Performance/StartWith:
  200. Enabled: true
  201. Performance/EndWith:
  202. Enabled: true
  203. Performance/RegexpMatch:
  204. Enabled: true
  205. Performance/ReverseEach:
  206. Enabled: true
  207. Performance/UnfreezeString:
  208. Enabled: true