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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. inherit_from: .rubocop_todo.yml
  2. AllCops:
  3. TargetRubyVersion: 3.0
  4. TargetRailsVersion: 7.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. Exclude:
  28. - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
  29. Layout/EmptyLinesAroundAccessModifier:
  30. Exclude:
  31. - 'config/initializers/10-patches.rb'
  32. Layout/EmptyLineBetweenDefs:
  33. AllowAdjacentOneLineDefs: true
  34. Layout/FirstHashElementIndentation:
  35. Exclude:
  36. - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
  37. Layout/LineLength:
  38. AllowedPatterns: ['\A\s+test \".+\" do\z', '\A\s*\#']
  39. Exclude:
  40. - 'db/migrate/0*.rb'
  41. - 'db/migrate/1*.rb'
  42. - 'db/migrate/201*.rb'
  43. - 'db/migrate/20200*.rb'
  44. - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
  45. Layout/RescueEnsureAlignment:
  46. Exclude:
  47. - 'db/migrate/085_add_role_tracker_old_status_index_to_workflows.rb'
  48. Layout/SpaceAroundEqualsInParameterDefault:
  49. Enabled: false
  50. Layout/SpaceBeforeSemicolon:
  51. Exclude:
  52. - 'config/initializers/10-patches.rb'
  53. Layout/SpaceBeforeBlockBraces:
  54. # "space" is used more than "no_space".
  55. # But "no_space" is more natural in one liner.
  56. # str = path.to_s.split(%r{[/\\]}).select{|p| !p.blank?}.join("/")
  57. Enabled: false
  58. Layout/SpaceBeforeFirstArg:
  59. Enabled: false
  60. Layout/SpaceInsideBlockBraces:
  61. Enabled: false
  62. Layout/SpaceInsideHashLiteralBraces:
  63. Enabled: false
  64. Lint/MissingSuper:
  65. Exclude:
  66. - 'lib/redmine/views/builders/structure.rb'
  67. Lint/SuppressedException:
  68. AllowComments: true
  69. Layout/LineContinuationLeadingSpace:
  70. Enabled: false
  71. Layout/TrailingWhitespace:
  72. AllowInHeredoc: true
  73. Metrics:
  74. Enabled: false
  75. Naming/AccessorMethodName:
  76. Enabled: false
  77. Naming/VariableNumber:
  78. CheckMethodNames: false
  79. CheckSymbols: false
  80. Naming/BinaryOperatorParameterName:
  81. Enabled: false
  82. Naming/PredicateName:
  83. Enabled: false
  84. Performance/CollectionLiteralInLoop:
  85. MinSize: 4
  86. Rails/ActionControllerFlashBeforeRender:
  87. # False positive in actions where `redirect_to_referer_or` is used
  88. Enabled: false
  89. Rails/ActionControllerTestCase:
  90. Enabled: false
  91. Rails/ActionOrder:
  92. Enabled: false
  93. Rails/ActiveSupportOnLoad:
  94. Exclude:
  95. # TODO: Need to check the impact on plugins. Disable for now.
  96. - 'lib/redmine/preparation.rb'
  97. Rails/ApplicationRecord:
  98. Exclude:
  99. - 'db/migrate/0*.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/FindEach:
  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/ThreeStateBooleanColumn:
  125. Exclude:
  126. - 'db/migrate/009_add_hide_mail_pref.rb'
  127. - 'db/migrate/059_add_roles_assignable.rb'
  128. - 'db/migrate/082_add_messages_locked.rb'
  129. - 'db/migrate/086_add_custom_fields_searchable.rb'
  130. - 'db/migrate/102_add_custom_fields_editable.rb'
  131. - 'db/migrate/20120115143100_add_repositories_is_default.rb'
  132. - 'db/migrate/20120127174243_add_custom_fields_multiple.rb'
  133. - 'db/migrate/20210704125704_add_twofa_required_to_groups.rb'
  134. Rails/WhereExists:
  135. Enabled: false
  136. Style/AsciiComments:
  137. Exclude:
  138. # Copyright credit has non ascii character.
  139. # We can not change nor remove it.
  140. - 'app/models/repository/git.rb'
  141. Style/BlockComments:
  142. Exclude:
  143. - 'lib/redmine/string_array_diff/diff.rb'
  144. - 'lib/redmine/string_array_diff/diffable.rb'
  145. Style/BlockDelimiters:
  146. Exclude:
  147. - 'db/migrate/007_create_journals.rb'
  148. - 'lib/redmine/string_array_diff/diff.rb'
  149. - 'lib/redmine/string_array_diff/diffable.rb'
  150. Style/FetchEnvVar:
  151. Enabled: false
  152. Style/EmptyElse:
  153. EnforcedStyle: empty
  154. Style/FormatString:
  155. EnforcedStyle: sprintf
  156. Style/FormatStringToken:
  157. Enabled: false
  158. Style/FrozenStringLiteralComment:
  159. EnforcedStyle: always
  160. Exclude:
  161. - 'db/**/*.rb'
  162. - 'Gemfile'
  163. - 'Rakefile'
  164. - 'config.ru'
  165. - 'config/additional_environment.rb'
  166. Style/GlobalStdStream:
  167. Enabled: false
  168. Style/HashSyntax:
  169. EnforcedStyle: no_mixed_keys
  170. Style/HashEachMethods:
  171. Exclude:
  172. - 'db/migrate/072_add_enumerations_position.rb'
  173. - 'db/migrate/078_add_custom_fields_position.rb'
  174. Style/IdenticalConditionalBranches:
  175. Exclude:
  176. - 'config/initializers/10-patches.rb'
  177. - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
  178. Style/InverseMethods:
  179. Enabled: false
  180. Style/NegatedIfElseCondition:
  181. Enabled: false
  182. Style/RaiseArgs:
  183. Enabled: false
  184. Style/RedundantConstantBase:
  185. Exclude:
  186. - 'config/environments/production.rb'
  187. Style/RedundantParentheses:
  188. Enabled: false
  189. Style/Semicolon:
  190. Enabled: false
  191. Style/SlicingWithRange:
  192. Enabled: false
  193. Style/SoleNestedConditional:
  194. Enabled: false
  195. Style/StringLiteralsInInterpolation:
  196. Enabled: false
  197. Style/TernaryParentheses:
  198. Enabled: false
  199. Style/TrailingCommaInArrayLiteral:
  200. Enabled: false
  201. Style/TrailingCommaInHashLiteral:
  202. Enabled: false
  203. Style/YodaExpression:
  204. Enabled: false