.rubocop.yml 8.3 KB

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