.rubocop.yml 7.9 KB

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