You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

.rubocop.yml 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. inherit_from: .rubocop_todo.yml
  2. AllCops:
  3. TargetRubyVersion: 2.7
  4. TargetRailsVersion: 6.1
  5. NewCops: enable
  6. Exclude:
  7. - '**/vendor/**/*'
  8. - '**/tmp/**/*'
  9. - '**/bin/**/*'
  10. - '**/plugins/**/*'
  11. - '**/extra/**/*'
  12. - '**/lib/generators/**/templates/*'
  13. - '**/lib/tasks/**/*'
  14. - '**/files/**/*'
  15. - 'db/schema.rb'
  16. # Enable extensions
  17. require:
  18. - rubocop-performance
  19. - rubocop-rails
  20. # Rules for Redmine
  21. Bundler/OrderedGems:
  22. Enabled: false
  23. Layout/CaseIndentation:
  24. Exclude:
  25. - 'config/initializers/10-patches.rb'
  26. Layout/ClosingParenthesisIndentation:
  27. Enabled: true
  28. Exclude:
  29. - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
  30. Layout/EmptyLinesAroundAccessModifier:
  31. Enabled: true
  32. Exclude:
  33. - 'config/initializers/10-patches.rb'
  34. Layout/EmptyLineBetweenDefs:
  35. AllowAdjacentOneLineDefs: true
  36. Layout/FirstHashElementIndentation:
  37. Enabled: true
  38. Exclude:
  39. - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
  40. Layout/LineLength:
  41. Enabled: true
  42. AllowedPatterns: ['\A\s+test \".+\" do\z', '\A\s*\#']
  43. Exclude:
  44. - 'db/migrate/0*.rb'
  45. - 'db/migrate/1*.rb'
  46. - 'db/migrate/201*.rb'
  47. - 'db/migrate/20200*.rb'
  48. - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
  49. Layout/RescueEnsureAlignment:
  50. Enabled: true
  51. Exclude:
  52. - 'db/migrate/085_add_role_tracker_old_status_index_to_workflows.rb'
  53. Layout/SpaceAroundEqualsInParameterDefault:
  54. Enabled: false
  55. Layout/SpaceBeforeSemicolon:
  56. Enabled: true
  57. Exclude:
  58. - 'config/initializers/10-patches.rb'
  59. Layout/SpaceBeforeBlockBraces:
  60. # "space" is used more than "no_space".
  61. # But "no_space" is more natural in one liner.
  62. # str = path.to_s.split(%r{[/\\]}).select{|p| !p.blank?}.join("/")
  63. Enabled: false
  64. Layout/SpaceInsideBlockBraces:
  65. Enabled: false
  66. Layout/SpaceInsideHashLiteralBraces:
  67. Enabled: false
  68. Lint/RaiseException:
  69. Enabled: true
  70. Lint/StructNewOverride:
  71. Enabled: true
  72. Lint/SuppressedException:
  73. AllowComments: true
  74. Layout/LineContinuationLeadingSpace:
  75. Enabled: false
  76. Layout/TrailingWhitespace:
  77. AllowInHeredoc: true
  78. Metrics:
  79. Enabled: false
  80. Naming/AccessorMethodName:
  81. Enabled: false
  82. Naming/VariableNumber:
  83. CheckMethodNames: false
  84. CheckSymbols: false
  85. Naming/BinaryOperatorParameterName:
  86. Enabled: false
  87. Naming/PredicateName:
  88. Enabled: false
  89. Performance/CollectionLiteralInLoop:
  90. MinSize: 4
  91. Rails/ActionControllerFlashBeforeRender:
  92. # False positive in actions where `redirect_to_referer_or` is used
  93. Enabled: false
  94. Rails/ActionControllerTestCase:
  95. Enabled: false
  96. Rails/ActionOrder:
  97. Enabled: false
  98. Rails/ActiveSupportOnLoad:
  99. Exclude:
  100. # TODO: Need to check the impact on plugins. Disable for now.
  101. - 'lib/redmine/preparation.rb'
  102. Rails/BulkChangeTable:
  103. Exclude:
  104. - 'db/migrate/20120714122200_add_workflows_rule_fields.rb'
  105. - 'db/migrate/20131214094309_remove_custom_fields_min_max_length_default_values.rb'
  106. Rails/CompactBlank:
  107. Enabled: false
  108. Rails/Delegate:
  109. Enabled: false
  110. Rails/EnvironmentVariableAccess:
  111. Enabled: false
  112. Rails/FilePath:
  113. Enabled: false
  114. Rails/HelperInstanceVariable:
  115. Enabled: false
  116. Rails/Pluck:
  117. Exclude:
  118. # `pluck` is not available in Gemfile
  119. - 'Gemfile'
  120. Rails/RootPathnameMethods:
  121. Enabled: false
  122. Rails/SquishedSQLHeredocs:
  123. Enabled: false
  124. Rails/WhereExists:
  125. Enabled: false
  126. Style/AsciiComments:
  127. Exclude:
  128. # Copyright credit has non ascii character.
  129. # We can not change nor remove it.
  130. - 'app/models/repository/git.rb'
  131. Style/BlockComments:
  132. Enabled: true
  133. Exclude:
  134. - 'lib/redmine/string_array_diff/diff.rb'
  135. - 'lib/redmine/string_array_diff/diffable.rb'
  136. Style/BlockDelimiters:
  137. Enabled: true
  138. Exclude:
  139. - 'db/migrate/007_create_journals.rb'
  140. - 'lib/redmine/string_array_diff/diff.rb'
  141. - 'lib/redmine/string_array_diff/diffable.rb'
  142. Style/FetchEnvVar:
  143. Enabled: false
  144. Style/EmptyElse:
  145. EnforcedStyle: empty
  146. Style/FormatString:
  147. EnforcedStyle: sprintf
  148. Style/FormatStringToken:
  149. Enabled: false
  150. Style/FrozenStringLiteralComment:
  151. Enabled: true
  152. EnforcedStyle: always
  153. Exclude:
  154. - 'db/**/*.rb'
  155. - 'Gemfile'
  156. - 'Rakefile'
  157. - 'config.ru'
  158. - 'config/additional_environment.rb'
  159. Style/GlobalStdStream:
  160. Enabled: false
  161. Style/HashEachMethods:
  162. Enabled: true
  163. Style/HashSyntax:
  164. Enabled: true
  165. EnforcedStyle: no_mixed_keys
  166. Style/HashTransformKeys:
  167. Enabled: true
  168. Style/HashTransformValues:
  169. Enabled: true
  170. Style/IdenticalConditionalBranches:
  171. Exclude:
  172. - 'config/initializers/10-patches.rb'
  173. - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
  174. Style/NegatedIfElseCondition:
  175. Enabled: false
  176. Style/RaiseArgs:
  177. Enabled: false
  178. Style/RedundantConstantBase:
  179. Exclude:
  180. - 'config/environments/production.rb'
  181. Style/Semicolon:
  182. Enabled: false
  183. Style/SlicingWithRange:
  184. Enabled: false
  185. Style/SoleNestedConditional:
  186. Enabled: false
  187. Style/TernaryParentheses:
  188. Enabled: false
  189. Style/TrailingCommaInArrayLiteral:
  190. Enabled: false
  191. Style/TrailingCommaInHashLiteral:
  192. Enabled: false
  193. Style/YodaExpression:
  194. Enabled: false