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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  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. - 'db/migrate/20190510070108_add_unique_id_to_import_items.rb'
  105. - 'db/migrate/20200826153402_add_totp_to_user.rb'
  106. - 'db/migrate/20221012135202_add_index_to_custom_values.rb'
  107. Rails/CompactBlank:
  108. Enabled: false
  109. Rails/Delegate:
  110. Enabled: false
  111. Rails/EnvironmentVariableAccess:
  112. Enabled: false
  113. Rails/FilePath:
  114. Enabled: false
  115. Rails/FindEach:
  116. Enabled: false
  117. Rails/HelperInstanceVariable:
  118. Enabled: false
  119. Rails/Pluck:
  120. Exclude:
  121. # `pluck` is not available in Gemfile
  122. - 'Gemfile'
  123. Rails/RootPathnameMethods:
  124. Enabled: false
  125. Rails/SquishedSQLHeredocs:
  126. Enabled: false
  127. Rails/ThreeStateBooleanColumn:
  128. Exclude:
  129. - 'db/migrate/009_add_hide_mail_pref.rb'
  130. - 'db/migrate/059_add_roles_assignable.rb'
  131. - 'db/migrate/082_add_messages_locked.rb'
  132. - 'db/migrate/086_add_custom_fields_searchable.rb'
  133. - 'db/migrate/102_add_custom_fields_editable.rb'
  134. - 'db/migrate/20120115143100_add_repositories_is_default.rb'
  135. - 'db/migrate/20120127174243_add_custom_fields_multiple.rb'
  136. - 'db/migrate/20210704125704_add_twofa_required_to_groups.rb'
  137. Rails/WhereExists:
  138. Enabled: false
  139. Style/AsciiComments:
  140. Exclude:
  141. # Copyright credit has non ascii character.
  142. # We can not change nor remove it.
  143. - 'app/models/repository/git.rb'
  144. Style/BlockComments:
  145. Exclude:
  146. - 'lib/redmine/string_array_diff/diff.rb'
  147. - 'lib/redmine/string_array_diff/diffable.rb'
  148. Style/BlockDelimiters:
  149. Exclude:
  150. - 'db/migrate/007_create_journals.rb'
  151. - 'lib/redmine/string_array_diff/diff.rb'
  152. - 'lib/redmine/string_array_diff/diffable.rb'
  153. Style/FetchEnvVar:
  154. Enabled: false
  155. Style/EmptyElse:
  156. EnforcedStyle: empty
  157. Style/FormatString:
  158. EnforcedStyle: sprintf
  159. Style/FormatStringToken:
  160. Enabled: false
  161. Style/FrozenStringLiteralComment:
  162. EnforcedStyle: always
  163. Exclude:
  164. - 'db/**/*.rb'
  165. - 'Gemfile'
  166. - 'Rakefile'
  167. - 'config.ru'
  168. - 'config/additional_environment.rb'
  169. Style/GlobalStdStream:
  170. Enabled: false
  171. Style/HashSyntax:
  172. EnforcedStyle: no_mixed_keys
  173. Style/HashEachMethods:
  174. Exclude:
  175. - 'db/migrate/072_add_enumerations_position.rb'
  176. - 'db/migrate/078_add_custom_fields_position.rb'
  177. Style/IdenticalConditionalBranches:
  178. Exclude:
  179. - 'config/initializers/10-patches.rb'
  180. - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
  181. Style/InverseMethods:
  182. Enabled: false
  183. Style/NegatedIfElseCondition:
  184. Enabled: false
  185. Style/RaiseArgs:
  186. Enabled: false
  187. Style/RedundantConstantBase:
  188. Exclude:
  189. - 'config/environments/production.rb'
  190. Style/RedundantParentheses:
  191. Enabled: false
  192. Style/Semicolon:
  193. Enabled: false
  194. Style/SlicingWithRange:
  195. Enabled: false
  196. Style/SoleNestedConditional:
  197. Enabled: false
  198. Style/StringLiteralsInInterpolation:
  199. Enabled: false
  200. Style/TernaryParentheses:
  201. Enabled: false
  202. Style/TrailingCommaInArrayLiteral:
  203. Enabled: false
  204. Style/TrailingCommaInHashLiteral:
  205. Enabled: false
  206. Style/YodaExpression:
  207. Enabled: false