.rubocop.yml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. require:
  2. - rubocop-rspec
  3. AllCops:
  4. TargetRubyVersion: 2.7
  5. # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
  6. # to ignore them, so only the ones explicitly set in this file are enabled.
  7. DisabledByDefault: true
  8. # Prefer &&/|| over and/or.
  9. Style/AndOr:
  10. Enabled: true
  11. # Align `when` with `case`.
  12. Layout/CaseIndentation:
  13. Enabled: true
  14. Layout/ClosingHeredocIndentation:
  15. Enabled: true
  16. # Align comments with method definitions.
  17. Layout/CommentIndentation:
  18. Enabled: true
  19. Layout/ElseAlignment:
  20. Enabled: true
  21. # Align `end` with the matching keyword or starting expression except for
  22. # assignments, where it should be aligned with the LHS.
  23. Layout/EndAlignment:
  24. Enabled: true
  25. EnforcedStyleAlignWith: variable
  26. AutoCorrect: true
  27. Layout/EmptyLineAfterMagicComment:
  28. Enabled: true
  29. Layout/EmptyLineAfterMultilineCondition:
  30. Enabled: true
  31. Layout/EmptyLinesAroundAccessModifier:
  32. Enabled: true
  33. EnforcedStyle: only_before
  34. Layout/EmptyLinesAroundBlockBody:
  35. Enabled: true
  36. # In a regular class definition, no empty lines around the body.
  37. Layout/EmptyLinesAroundClassBody:
  38. Enabled: true
  39. # In a regular method definition, no empty lines around the body.
  40. Layout/EmptyLinesAroundMethodBody:
  41. Enabled: true
  42. # In a regular module definition, no empty lines around the body.
  43. Layout/EmptyLinesAroundModuleBody:
  44. Enabled: true
  45. # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
  46. Style/HashSyntax:
  47. Enabled: true
  48. Layout/FirstArgumentIndentation:
  49. Enabled: true
  50. # Method definitions after `private` or `protected` isolated calls need one
  51. # extra level of indentation.
  52. Layout/IndentationConsistency:
  53. Enabled: true
  54. EnforcedStyle: indented_internal_methods
  55. # Detect hard tabs, no hard tabs.
  56. Layout/IndentationStyle:
  57. Enabled: true
  58. # Two spaces, no tabs (for indentation).
  59. Layout/IndentationWidth:
  60. Enabled: true
  61. Layout/LeadingCommentSpace:
  62. Enabled: true
  63. Layout/SpaceAfterColon:
  64. Enabled: true
  65. Layout/SpaceAfterComma:
  66. Enabled: true
  67. Layout/SpaceAfterSemicolon:
  68. Enabled: true
  69. Layout/SpaceAroundEqualsInParameterDefault:
  70. Enabled: true
  71. Layout/SpaceAroundKeyword:
  72. Enabled: true
  73. Layout/SpaceBeforeComma:
  74. Enabled: true
  75. Layout/SpaceBeforeComment:
  76. Enabled: true
  77. Layout/SpaceBeforeFirstArg:
  78. Enabled: true
  79. Style/ClassMethodsDefinitions:
  80. Enabled: true
  81. EnforcedStyle: def_self
  82. Style/DefWithParentheses:
  83. Enabled: true
  84. # Defining a method with parameters needs parentheses.
  85. Style/MethodDefParentheses:
  86. Enabled: true
  87. Style/MethodCallWithArgsParentheses:
  88. Enabled: true
  89. IgnoredMethods:
  90. # Gemfile, gemspec
  91. - source
  92. - add_dependency
  93. - add_development_dependency
  94. # include/require
  95. - require
  96. - require_relative
  97. - include
  98. # fundamental methods
  99. - raise
  100. - sleep
  101. # RSpec
  102. - describe
  103. - it
  104. - to
  105. - not_to
  106. - be
  107. - eq
  108. # async/await
  109. - define_async_method
  110. - await
  111. - future
  112. # utils
  113. - debug_print
  114. - debug_puts
  115. - exit
  116. - puts
  117. Style/MethodCallWithoutArgsParentheses:
  118. Enabled: true
  119. Style/RedundantFreeze:
  120. Enabled: true
  121. Style/RedundantSelf:
  122. Enabled: true
  123. Style/RedundantSelfAssignment:
  124. Enabled: true
  125. # Use `foo {}` not `foo{}`.
  126. Layout/SpaceBeforeBlockBraces:
  127. Enabled: true
  128. # Use `foo { bar }` not `foo {bar}`.
  129. Layout/SpaceInsideBlockBraces:
  130. Enabled: true
  131. EnforcedStyleForEmptyBraces: space
  132. # Use `{ a: 1 }` not `{a:1}`.
  133. Layout/SpaceInsideHashLiteralBraces:
  134. Enabled: true
  135. Layout/SpaceInsideParens:
  136. Enabled: true
  137. # Empty lines should not have any spaces.
  138. Layout/TrailingEmptyLines:
  139. Enabled: true
  140. # No trailing whitespace.
  141. Layout/TrailingWhitespace:
  142. Enabled: true
  143. # Use quotes for string literals when they are enough.
  144. Style/RedundantPercentQ:
  145. Enabled: true
  146. Lint/AmbiguousOperator:
  147. Enabled: true
  148. Lint/AmbiguousRegexpLiteral:
  149. Enabled: true
  150. Lint/BinaryOperatorWithIdenticalOperands:
  151. Enabled: true
  152. Lint/DeprecatedClassMethods:
  153. Enabled: true
  154. Lint/DuplicateRescueException:
  155. Enabled: true
  156. Lint/ErbNewArguments:
  157. Enabled: true
  158. Lint/EmptyConditionalBody:
  159. Enabled: true
  160. Lint/FloatComparison:
  161. Enabled: true
  162. Lint/OutOfRangeRegexpRef:
  163. Enabled: true
  164. Lint/RedundantStringCoercion:
  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/SelfAssignment:
  170. Enabled: true
  171. Lint/ShadowingOuterLocalVariable:
  172. Enabled: true
  173. Lint/TopLevelReturnWithArgument:
  174. Enabled: true
  175. Lint/UnreachableLoop:
  176. Enabled: true
  177. Lint/UriEscapeUnescape:
  178. Enabled: true
  179. Lint/UselessAssignment:
  180. Enabled: true
  181. Style/ParenthesesAroundCondition:
  182. Enabled: true
  183. Style/ExplicitBlockArgument:
  184. Enabled: true
  185. Style/FrozenStringLiteralComment:
  186. Enabled: false
  187. Style/GlobalStdStream:
  188. Enabled: true
  189. Style/HashEachMethods:
  190. Enabled: true
  191. Style/HashTransformKeys:
  192. Enabled: true
  193. Style/HashTransformValues:
  194. Enabled: true
  195. Style/RaiseArgs:
  196. Enabled: true
  197. EnforcedStyle: compact
  198. Style/RedundantBegin:
  199. Enabled: true
  200. Style/RedundantReturn:
  201. Enabled: true
  202. AllowMultipleReturnValues: true
  203. Style/Semicolon:
  204. Enabled: true
  205. AllowAsExpressionSeparator: true
  206. Style/StringConcatenation:
  207. Enabled: true
  208. # Prefer Foo.method over Foo::method
  209. Style/ColonMethodCall:
  210. Enabled: true
  211. Style/TrivialAccessors:
  212. Enabled: false
  213. Style/AccessModifierDeclarations:
  214. Enabled: true
  215. EnforcedStyle: inline
  216. Style/ClassAndModuleChildren:
  217. EnforcedStyle: compact
  218. Style/TrailingCommaInArguments:
  219. Enabled: true
  220. EnforcedStyleForMultiline: comma
  221. Style/TrailingCommaInArrayLiteral:
  222. Enabled: true
  223. EnforcedStyleForMultiline: comma
  224. Style/TrailingCommaInHashLiteral:
  225. Enabled: true
  226. EnforcedStyleForMultiline: comma
  227. # rubocop-rspec
  228. RSpec/EmptyLineAfterExampleGroup:
  229. Enabled: true
  230. RSpec/EmptyLineAfterHook:
  231. Enabled: true
  232. # bad: expect("success").to eq(result)
  233. # good: expect(result).to eq("success")
  234. RSpec/ExpectActual:
  235. Enabled: true
  236. # bad: expect{ subject }.to change(Hoge, :count).by(1)
  237. # good: expect{ subject }.to change{ Hoge.count }.by(1)
  238. RSpec/ExpectChange:
  239. Enabled: true
  240. EnforcedStyle: block
  241. RSpec/ExpectInHook:
  242. Enabled: true
  243. RSpec/ImplicitBlockExpectation:
  244. Enabled: true
  245. RSpec/InstanceVariable:
  246. Enabled: true
  247. # bad: it_should_behave_like
  248. # good: it_behaves_like
  249. RSpec/ItBehavesLike:
  250. Enabled: true
  251. RSpec/LeakyConstantDeclaration:
  252. Enabled: false
  253. RSpec/LetSetup:
  254. Enabled: true
  255. RSpec/MultipleSubjects:
  256. Enabled: true
  257. RSpec/NestedGroups:
  258. Enabled: true
  259. Max: 4
  260. RSpec/NotToNot:
  261. Enabled: true
  262. RSpec/PredicateMatcher:
  263. Enabled: true
  264. RSpec/ReceiveCounts:
  265. Enabled: true
  266. RSpec/ReceiveNever:
  267. Enabled: true
  268. RSpec/ReturnFromStub:
  269. Enabled: true
  270. EnforcedStyle: and_return
  271. RSpec/SharedContext:
  272. Enabled: true
  273. RSpec/SharedExamples:
  274. Enabled: true
  275. RSpec/SingleArgumentMessageChain:
  276. Enabled: true
  277. RSpec/VoidExpect:
  278. Enabled: true
  279. RSpec/Yield:
  280. Enabled: true