.rubocop.yml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. # For a least of many of the default cops, please check
  2. # https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml
  3. # https://github.com/rubocop-hq/rubocop-performance/blob/master/config/default.yml
  4. # https://github.com/rubocop-hq/rubocop-rspec/blob/master/config/default.yml
  5. # https://github.com/rubocop-hq/rubocop-rails/blob/master/config/default.yml
  6. require:
  7. - rubocop-performance
  8. - rubocop-rspec
  9. - rubocop-rails
  10. AllCops:
  11. TargetRubyVersion: 2.6.3
  12. # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
  13. # to leave them active, so we can selectively disable cops where appropriate.
  14. DisabledByDefault: false
  15. TargetRailsVersion: 6.0
  16. Exclude:
  17. - '**/node_modules/**/*'
  18. - 'db/schema.rb'
  19. - 'tmp/**/*'
  20. - 'bin/**/*'
  21. CacheRootDirectory: tmp
  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/IndentFirstArgument:
  63. Enabled: true
  64. # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
  65. Style/HashSyntax:
  66. Enabled: true
  67. # Two spaces, no tabs (for indentation).
  68. Layout/IndentationWidth:
  69. Enabled: true
  70. Layout/LeadingCommentSpace:
  71. Enabled: true
  72. Layout/SpaceAfterColon:
  73. Enabled: true
  74. Layout/SpaceAfterComma:
  75. Enabled: true
  76. Layout/SpaceAfterSemicolon:
  77. Enabled: true
  78. Layout/SpaceAroundEqualsInParameterDefault:
  79. Enabled: true
  80. Layout/SpaceAroundKeyword:
  81. Enabled: true
  82. Layout/SpaceAroundOperators:
  83. Enabled: true
  84. Layout/SpaceBeforeComma:
  85. Enabled: true
  86. Layout/SpaceBeforeComment:
  87. Enabled: true
  88. Layout/SpaceBeforeFirstArg:
  89. Enabled: true
  90. Style/DefWithParentheses:
  91. Enabled: true
  92. # Defining a method with parameters needs parentheses.
  93. Style/MethodDefParentheses:
  94. Enabled: true
  95. Style/FrozenStringLiteralComment:
  96. Enabled: true
  97. EnforcedStyle: always
  98. Exclude:
  99. - spec/capybara_helper.rb
  100. Style/RedundantFreeze:
  101. Enabled: true
  102. Style/Documentation:
  103. Enabled: false
  104. Style/ClassAndModuleChildren:
  105. Enabled: false
  106. Style/BlockComments:
  107. Enabled: false
  108. Style/RescueModifier:
  109. Enabled: false
  110. Style/StderrPuts:
  111. Enabled: false
  112. Style/GuardClause:
  113. Enabled: false
  114. Style/TrailingCommaInArguments:
  115. Enabled: true
  116. EnforcedStyleForMultiline: comma
  117. Style/TrailingCommaInArrayLiteral:
  118. Enabled: true
  119. EnforcedStyleForMultiline: comma
  120. Metrics/BlockLength:
  121. Enabled: false
  122. Metrics/MethodLength:
  123. Max: 20
  124. Exclude:
  125. - db/migrate/*.rb
  126. Metrics/AbcSize:
  127. Enabled: false
  128. # Use `foo {}` not `foo{}`.
  129. Layout/SpaceBeforeBlockBraces:
  130. Enabled: true
  131. Exclude:
  132. - '**/spec/**/*'
  133. # Use `foo { bar }` not `foo {bar}`.
  134. Layout/SpaceInsideBlockBraces:
  135. Enabled: true
  136. EnforcedStyleForEmptyBraces: space
  137. Exclude:
  138. - '**/spec/**/*'
  139. # Use `{ a: 1 }` not `{a:1}`.
  140. Layout/SpaceInsideHashLiteralBraces:
  141. Enabled: true
  142. EnforcedStyle: no_space
  143. Layout/SpaceInsideParens:
  144. Enabled: true
  145. Style/TrailingCommaInHashLiteral:
  146. Enabled: true
  147. EnforcedStyleForMultiline: comma
  148. # Check quotes usage according to lint rule below.
  149. Style/StringLiterals:
  150. Enabled: true
  151. EnforcedStyle: single_quotes
  152. # Detect hard tabs, no hard tabs.
  153. Layout/Tab:
  154. Enabled: true
  155. # Blank lines should not have any spaces.
  156. Layout/TrailingBlankLines:
  157. Enabled: true
  158. # No trailing whitespace.
  159. Layout/TrailingWhitespace:
  160. Enabled: true
  161. # Use quotes for string literals when they are enough.
  162. Style/UnneededPercentQ:
  163. Enabled: true
  164. Lint/AmbiguousOperator:
  165. Enabled: true
  166. Lint/AmbiguousRegexpLiteral:
  167. Enabled: true
  168. Lint/ErbNewArguments:
  169. Enabled: true
  170. # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
  171. Lint/RequireParentheses:
  172. Enabled: true
  173. Lint/ShadowingOuterLocalVariable:
  174. Enabled: true
  175. Lint/StringConversionInInterpolation:
  176. Enabled: true
  177. Lint/UriEscapeUnescape:
  178. Enabled: true
  179. Lint/UselessAssignment:
  180. Enabled: true
  181. Lint/DeprecatedClassMethods:
  182. Enabled: true
  183. Lint/MissingCopEnableDirective:
  184. Enabled: false
  185. Style/ParenthesesAroundCondition:
  186. Enabled: true
  187. Style/RedundantBegin:
  188. Enabled: true
  189. Style/RedundantReturn:
  190. Enabled: true
  191. AllowMultipleReturnValues: true
  192. Style/Semicolon:
  193. Enabled: true
  194. AllowAsExpressionSeparator: true
  195. # Prefer Foo.method over Foo::method
  196. Style/ColonMethodCall:
  197. Enabled: true
  198. Style/TrivialAccessors:
  199. Enabled: true
  200. Performance/FlatMap:
  201. Enabled: true
  202. Performance/RedundantMerge:
  203. Enabled: true
  204. Performance/StartWith:
  205. Enabled: true
  206. Performance/EndWith:
  207. Enabled: true
  208. Performance/RegexpMatch:
  209. Enabled: true
  210. Performance/ReverseEach:
  211. Enabled: true
  212. Performance/UnfreezeString:
  213. Enabled: true
  214. RSpec/MultipleExpectations:
  215. Enabled: false
  216. RSpec/NestedGroups:
  217. Enabled: false
  218. RSpec/AnyInstance:
  219. Enabled: false
  220. RSpec/ExampleLength:
  221. Enabled: true
  222. Max: 20
  223. RSpec/EmptyExampleGroup:
  224. Enabled: false
  225. RSpec/ImplicitSubject:
  226. Enabled: false
  227. RSpec/LetSetup:
  228. Enabled: false
  229. RSpec/MessageSpies:
  230. Enabled: false
  231. RSpec/VerifiedDoubles:
  232. Enabled: false
  233. RSpec/NamedSubject:
  234. Enabled: false