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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. inherit_from: .rubocop_todo.yml
  2. AllCops:
  3. TargetRubyVersion: 2.5
  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. IgnoredPatterns: ['\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/TrailingWhitespace:
  75. AllowInHeredoc: true
  76. Metrics:
  77. Enabled: false
  78. Naming/AccessorMethodName:
  79. Enabled: false
  80. Naming/VariableNumber:
  81. CheckMethodNames: false
  82. CheckSymbols: false
  83. Naming/BinaryOperatorParameterName:
  84. Enabled: false
  85. Naming/PredicateName:
  86. Enabled: false
  87. Rails/BulkChangeTable:
  88. Exclude:
  89. - 'db/migrate/20120714122200_add_workflows_rule_fields.rb'
  90. - 'db/migrate/20131214094309_remove_custom_fields_min_max_length_default_values.rb'
  91. Rails/EnvironmentVariableAccess:
  92. Enabled: false
  93. Rails/HelperInstanceVariable:
  94. Enabled: false
  95. Style/AsciiComments:
  96. Exclude:
  97. # Copyright credit has non ascii character.
  98. # We can not change nor remove it.
  99. - 'app/models/repository/git.rb'
  100. Style/BlockComments:
  101. Enabled: true
  102. Exclude:
  103. - 'lib/diff.rb'
  104. Style/BlockDelimiters:
  105. Enabled: true
  106. Exclude:
  107. - 'db/migrate/007_create_journals.rb'
  108. - 'lib/diff.rb'
  109. Style/EmptyElse:
  110. EnforcedStyle: empty
  111. Style/FormatString:
  112. EnforcedStyle: sprintf
  113. Style/FormatStringToken:
  114. Enabled: false
  115. Style/FrozenStringLiteralComment:
  116. Enabled: true
  117. EnforcedStyle: always
  118. Exclude:
  119. - 'db/**/*.rb'
  120. - 'Gemfile'
  121. - 'Rakefile'
  122. - 'config.ru'
  123. - 'config/additional_environment.rb'
  124. Style/HashEachMethods:
  125. Enabled: true
  126. Style/HashSyntax:
  127. Enabled: true
  128. EnforcedStyle: no_mixed_keys
  129. Style/HashTransformKeys:
  130. Enabled: true
  131. Style/HashTransformValues:
  132. Enabled: true
  133. Style/IdenticalConditionalBranches:
  134. Exclude:
  135. - 'config/initializers/10-patches.rb'
  136. - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
  137. Style/NegatedIfElseCondition:
  138. Enabled: false
  139. Style/RaiseArgs:
  140. Enabled: false
  141. Style/TrailingCommaInArrayLiteral:
  142. Enabled: false
  143. Style/TrailingCommaInHashLiteral:
  144. Enabled: false