.rubocop.yml 8.6 KB

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