.rubocop.yml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. # Default enabled cops
  2. # https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml
  3. require:
  4. - rubocop-performance
  5. - rubocop-rails
  6. - rubocop-rspec
  7. inherit_from:
  8. - .rubocop_todo.yml
  9. - .rubocop_todo.rspec.yml
  10. AllCops:
  11. DisplayCopNames: true
  12. Exclude:
  13. - 'bin/rails'
  14. - 'bin/rake'
  15. - 'bin/spring'
  16. - 'db/schema.rb'
  17. - 'vendor/**/*'
  18. - 'public/assets/**/*'
  19. RSpec:
  20. Patterns:
  21. - '_spec.rb$'
  22. - '_examples.rb$'
  23. Rails:
  24. Enabled: true
  25. # Zammad StyleGuide
  26. Style/FrozenStringLiteralComment:
  27. Enabled: false
  28. Layout/LineLength:
  29. Description: 'Limit lines to 80 characters.'
  30. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
  31. Enabled: false
  32. Style/NegatedIf:
  33. Description: >-
  34. Favor unless over if for negative conditions
  35. (or control flow or).
  36. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
  37. Enabled: false
  38. Style/IfUnlessModifier:
  39. Description: >-
  40. Favor modifier if/unless usage when you have a
  41. single-line body.
  42. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
  43. Enabled: false
  44. Style/TrailingCommaInArrayLiteral:
  45. Description: 'Checks for trailing comma in array literals.'
  46. StyleGuide: '#no-trailing-array-commas'
  47. Enabled: false
  48. Style/TrailingCommaInHashLiteral:
  49. Description: 'Checks for trailing comma in hash literals.'
  50. Enabled: false
  51. Style/TrailingCommaInArguments:
  52. Description: 'Checks for trailing comma in argument lists.'
  53. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
  54. Enabled: false
  55. Layout/SpaceInsideParens:
  56. Description: 'No spaces after ( or before ).'
  57. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
  58. Enabled: false
  59. Layout/SpaceAfterMethodName:
  60. Description: >-
  61. Do not put a space between a method name and the opening
  62. parenthesis in a method definition.
  63. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
  64. Enabled: false
  65. Layout/LeadingCommentSpace:
  66. Description: 'Comments should start with a space.'
  67. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-space'
  68. Enabled: false
  69. Style/MethodCallWithoutArgsParentheses:
  70. Description: 'Do not use parentheses for method calls with no arguments.'
  71. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-args-no-parens'
  72. Enabled: false
  73. Layout/SpaceInsideReferenceBrackets:
  74. Description: 'Checks the spacing inside referential brackets.'
  75. Enabled: false
  76. Layout/SpaceInsideArrayLiteralBrackets:
  77. Description: 'Checks the spacing inside array literal brackets.'
  78. Enabled: false
  79. Style/DefWithParentheses:
  80. Description: 'Use def with parentheses when there are arguments.'
  81. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
  82. Enabled: false
  83. Style/MethodDefParentheses:
  84. Description: >-
  85. Checks if the method definitions have or don't have
  86. parentheses.
  87. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
  88. Enabled: false
  89. Layout/HashAlignment:
  90. Description: >-
  91. Align the elements of a hash literal if they span more than
  92. one line.
  93. Enabled: true
  94. EnforcedHashRocketStyle: table
  95. EnforcedColonStyle: table
  96. EnforcedLastArgumentHashStyle: always_inspect
  97. Layout/EmptyLinesAroundClassBody:
  98. Description: "Keeps track of empty lines around class bodies."
  99. Enabled: false
  100. Layout/EmptyLinesAroundMethodBody:
  101. Description: "Keeps track of empty lines around method bodies."
  102. Enabled: false
  103. Layout/EmptyLinesAroundBlockBody:
  104. Description: "Keeps track of empty lines around block bodies."
  105. Enabled: false
  106. Layout/EmptyLinesAroundModuleBody:
  107. Description: "Keeps track of empty lines around module bodies."
  108. Enabled: false
  109. Style/MultilineBlockChain:
  110. Description: 'Avoid multi-line chains of blocks.'
  111. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
  112. Enabled: false
  113. Metrics/ClassLength:
  114. Description: 'Avoid classes longer than 100 lines of code.'
  115. Enabled: false
  116. Metrics/MethodLength:
  117. Description: 'Avoid methods longer than 10 lines of code.'
  118. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
  119. Enabled: false
  120. Style/BlockComments:
  121. Description: 'Do not use block comments.'
  122. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-block-comments'
  123. Enabled: false
  124. Style/PerlBackrefs:
  125. Description: 'Avoid Perl-style regex back references.'
  126. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
  127. Enabled: false
  128. Style/HashEachMethods:
  129. Enabled: true
  130. Style/HashTransformKeys:
  131. Enabled: true
  132. Style/HashTransformValues:
  133. Enabled: true
  134. Style/SelfAssignment:
  135. Description: >-
  136. Checks for places where self-assignment shorthand should have
  137. been used.
  138. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
  139. Enabled: false
  140. Rails/ApplicationRecord:
  141. Exclude:
  142. - 'app/models/application_model.rb'
  143. - 'app/models/active_job_lock.rb'
  144. Rails/BulkChangeTable:
  145. Description: 'Check whether alter queries are combinable.'
  146. Enabled: false
  147. Rails/FindEach:
  148. Description: 'Prefer all.find_each over all.find.'
  149. Enabled: false
  150. Rails/HasAndBelongsToMany:
  151. Description: 'Prefer has_many :through to has_and_belongs_to_many.'
  152. # StyleGuide: 'https://github.com/bbatsov/rails-style-guide#has-many-through'
  153. Enabled: false
  154. Rails/SkipsModelValidations:
  155. Description: >-
  156. Use methods that skips model validations with caution.
  157. See reference for more information.
  158. Reference: 'http://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
  159. Enabled: true
  160. Exclude:
  161. - test/**/*
  162. - "**/*_spec.rb"
  163. - "**/*_examples.rb"
  164. Style/ClassAndModuleChildren:
  165. Description: 'Checks style of children classes and modules.'
  166. Enabled: false
  167. Naming/FileName:
  168. Description: 'Use snake_case for source file names.'
  169. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
  170. Enabled: true
  171. Exclude:
  172. - 'script/websocket-server.rb'
  173. Naming/VariableNumber:
  174. Description: 'Use the configured style when numbering variables.'
  175. Enabled: false
  176. Naming/MethodParameterName:
  177. Description: >-
  178. Checks for method parameter names that contain capital letters,
  179. end in numbers, or do not meet a minimal length.
  180. Enabled: true
  181. AllowedNames: e, id, _, ip
  182. Lint/BooleanSymbol:
  183. Description: 'Check for `:true` and `:false` symbols.'
  184. Enabled: true
  185. Exclude:
  186. - "db/seeds/object_manager_attributes.rb"
  187. - "spec/requests/integration/object_manager_attributes_spec.rb"
  188. - "test/integration/object_manager_test.rb"
  189. Lint/InterpolationCheck:
  190. Description: 'Raise warning for interpolation in single q strs'
  191. Enabled: true
  192. Exclude:
  193. - "test/unit/email_process_auto_response_test.rb"
  194. - "test/unit/email_process_bounce_delivery_permanent_failed_test.rb"
  195. - "test/unit/email_process_bounce_follow_test.rb"
  196. - "test/unit/notification_factory_renderer_test.rb"
  197. - "test/unit/notification_factory_template_test.rb"
  198. - "test/unit/ticket_trigger_test.rb"
  199. - "test/unit/ticket_trigger_recursive_disabled_test.rb"
  200. # RSpec tests
  201. Style/NumericPredicate:
  202. Description: >-
  203. Checks for the use of predicate- or comparison methods for
  204. numeric comparisons.
  205. StyleGuide: '#predicate-methods'
  206. # This will change to a new method call which isn't guaranteed to be on the
  207. # object. Switching these methods has to be done with knowledge of the types
  208. # of the variables which rubocop doesn't have.
  209. AutoCorrect: false
  210. Enabled: true
  211. Exclude:
  212. - "**/*_spec.rb"
  213. Lint/AmbiguousBlockAssociation:
  214. Description: >-
  215. Checks for ambiguous block association with method when param
  216. passed without parentheses.
  217. StyleGuide: '#syntax'
  218. Enabled: true
  219. Exclude:
  220. - "spec/support/*.rb"
  221. - "**/*_spec.rb"
  222. - "**/*_examples.rb"
  223. Layout/MultilineMethodCallIndentation:
  224. Description: >-
  225. Checks the indentation of the method name part in method calls
  226. that span more than one line.
  227. EnforcedStyle: indented
  228. Include:
  229. - "**/*_spec.rb"