.rubocop.yml 7.3 KB

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