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.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. inherit_from: .rubocop_todo.yml
  2. AllCops:
  3. TargetRubyVersion: 2.6
  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. Rails/ActionControllerFlashBeforeRender:
  90. # False positive in actions where `redirect_to_referer_or` is used
  91. Enabled: false
  92. Rails/ActionControllerTestCase:
  93. Enabled: false
  94. Rails/ActionOrder:
  95. Enabled: false
  96. Rails/ActiveSupportOnLoad:
  97. Exclude:
  98. # TODO: Need to check the impact on plugins. Disable for now.
  99. - 'lib/redmine/preparation.rb'
  100. Rails/BulkChangeTable:
  101. Exclude:
  102. - 'db/migrate/20120714122200_add_workflows_rule_fields.rb'
  103. - 'db/migrate/20131214094309_remove_custom_fields_min_max_length_default_values.rb'
  104. Rails/CompactBlank:
  105. Enabled: false
  106. Rails/Delegate:
  107. Enabled: false
  108. Rails/EnvironmentVariableAccess:
  109. Enabled: false
  110. Rails/FilePath:
  111. Enabled: false
  112. Rails/HelperInstanceVariable:
  113. Enabled: false
  114. Rails/Pluck:
  115. Exclude:
  116. # `pluck` is not available in Gemfile
  117. - 'Gemfile'
  118. Rails/RootPathnameMethods:
  119. Enabled: false
  120. Rails/SquishedSQLHeredocs:
  121. Enabled: false
  122. Rails/WhereExists:
  123. Enabled: false
  124. Style/AsciiComments:
  125. Exclude:
  126. # Copyright credit has non ascii character.
  127. # We can not change nor remove it.
  128. - 'app/models/repository/git.rb'
  129. Style/BlockComments:
  130. Enabled: true
  131. Exclude:
  132. - 'lib/redmine/string_array_diff/diff.rb'
  133. - 'lib/redmine/string_array_diff/diffable.rb'
  134. Style/BlockDelimiters:
  135. Enabled: true
  136. Exclude:
  137. - 'db/migrate/007_create_journals.rb'
  138. - 'lib/redmine/string_array_diff/diff.rb'
  139. - 'lib/redmine/string_array_diff/diffable.rb'
  140. Style/FetchEnvVar:
  141. Enabled: false
  142. Style/EmptyElse:
  143. EnforcedStyle: empty
  144. Style/FormatString:
  145. EnforcedStyle: sprintf
  146. Style/FormatStringToken:
  147. Enabled: false
  148. Style/FrozenStringLiteralComment:
  149. Enabled: true
  150. EnforcedStyle: always
  151. Exclude:
  152. - 'db/**/*.rb'
  153. - 'Gemfile'
  154. - 'Rakefile'
  155. - 'config.ru'
  156. - 'config/additional_environment.rb'
  157. Style/GlobalStdStream:
  158. Enabled: false
  159. Style/HashEachMethods:
  160. Enabled: true
  161. Style/HashSyntax:
  162. Enabled: true
  163. EnforcedStyle: no_mixed_keys
  164. Style/HashTransformKeys:
  165. Enabled: true
  166. Style/HashTransformValues:
  167. Enabled: true
  168. Style/IdenticalConditionalBranches:
  169. Exclude:
  170. - 'config/initializers/10-patches.rb'
  171. - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
  172. Style/NegatedIfElseCondition:
  173. Enabled: false
  174. Style/RaiseArgs:
  175. Enabled: false
  176. Style/Semicolon:
  177. Enabled: false
  178. Style/SlicingWithRange:
  179. Enabled: false
  180. Style/SoleNestedConditional:
  181. Enabled: false
  182. Style/TernaryParentheses:
  183. Enabled: false
  184. Style/TrailingCommaInArrayLiteral:
  185. Enabled: false
  186. Style/TrailingCommaInHashLiteral:
  187. Enabled: false