.rubocop.yml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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. Metrics/AbcSize:
  125. Enabled: false
  126. # Use `foo {}` not `foo{}`.
  127. Layout/SpaceBeforeBlockBraces:
  128. Enabled: true
  129. Exclude:
  130. - '**/spec/**/*'
  131. # Use `foo { bar }` not `foo {bar}`.
  132. Layout/SpaceInsideBlockBraces:
  133. Enabled: true
  134. EnforcedStyleForEmptyBraces: space
  135. Exclude:
  136. - '**/spec/**/*'
  137. # Use `{ a: 1 }` not `{a:1}`.
  138. Layout/SpaceInsideHashLiteralBraces:
  139. Enabled: true
  140. EnforcedStyle: no_space
  141. Layout/SpaceInsideParens:
  142. Enabled: true
  143. Style/TrailingCommaInHashLiteral:
  144. Enabled: true
  145. EnforcedStyleForMultiline: comma
  146. # Check quotes usage according to lint rule below.
  147. Style/StringLiterals:
  148. Enabled: true
  149. EnforcedStyle: single_quotes
  150. # Detect hard tabs, no hard tabs.
  151. Layout/Tab:
  152. Enabled: true
  153. # Blank lines should not have any spaces.
  154. Layout/TrailingBlankLines:
  155. Enabled: true
  156. # No trailing whitespace.
  157. Layout/TrailingWhitespace:
  158. Enabled: true
  159. # Use quotes for string literals when they are enough.
  160. Style/UnneededPercentQ:
  161. Enabled: true
  162. Lint/AmbiguousOperator:
  163. Enabled: true
  164. Lint/AmbiguousRegexpLiteral:
  165. Enabled: true
  166. Lint/ErbNewArguments:
  167. Enabled: true
  168. # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
  169. Lint/RequireParentheses:
  170. Enabled: true
  171. Lint/ShadowingOuterLocalVariable:
  172. Enabled: true
  173. Lint/StringConversionInInterpolation:
  174. Enabled: true
  175. Lint/UriEscapeUnescape:
  176. Enabled: true
  177. Lint/UselessAssignment:
  178. Enabled: true
  179. Lint/DeprecatedClassMethods:
  180. Enabled: true
  181. Lint/MissingCopEnableDirective:
  182. Enabled: false
  183. Style/ParenthesesAroundCondition:
  184. Enabled: true
  185. Style/RedundantBegin:
  186. Enabled: true
  187. Style/RedundantReturn:
  188. Enabled: true
  189. AllowMultipleReturnValues: true
  190. Style/Semicolon:
  191. Enabled: true
  192. AllowAsExpressionSeparator: true
  193. # Prefer Foo.method over Foo::method
  194. Style/ColonMethodCall:
  195. Enabled: true
  196. Style/TrivialAccessors:
  197. Enabled: true
  198. Performance/FlatMap:
  199. Enabled: true
  200. Performance/RedundantMerge:
  201. Enabled: true
  202. Performance/StartWith:
  203. Enabled: true
  204. Performance/EndWith:
  205. Enabled: true
  206. Performance/RegexpMatch:
  207. Enabled: true
  208. Performance/ReverseEach:
  209. Enabled: true
  210. Performance/UnfreezeString:
  211. Enabled: true
  212. RSpec/MultipleExpectations:
  213. Enabled: false
  214. RSpec/NestedGroups:
  215. Enabled: false
  216. RSpec/AnyInstance:
  217. Enabled: false
  218. RSpec/ExampleLength:
  219. Enabled: true
  220. Max: 20
  221. RSpec/EmptyExampleGroup:
  222. Enabled: false
  223. RSpec/ImplicitSubject:
  224. Enabled: false
  225. RSpec/LetSetup:
  226. Enabled: false
  227. RSpec/MessageSpies:
  228. Enabled: false
  229. RSpec/VerifiedDoubles:
  230. Enabled: false
  231. RSpec/NamedSubject:
  232. Enabled: false