.rubocop.yml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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/EmptyLinesAroundClassBody:
  79. Description: "Keeps track of empty lines around class bodies."
  80. Enabled: false
  81. Layout/EmptyLinesAroundMethodBody:
  82. Description: "Keeps track of empty lines around method bodies."
  83. Enabled: false
  84. Layout/EmptyLinesAroundBlockBody:
  85. Description: "Keeps track of empty lines around block bodies."
  86. Enabled: false
  87. Layout/EmptyLinesAroundModuleBody:
  88. Description: "Keeps track of empty lines around module bodies."
  89. Enabled: false
  90. Style/MultilineBlockChain:
  91. Description: 'Avoid multi-line chains of blocks.'
  92. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
  93. Enabled: false
  94. Metrics/ClassLength:
  95. Description: 'Avoid classes longer than 100 lines of code.'
  96. Enabled: false
  97. Metrics/MethodLength:
  98. Description: 'Avoid methods longer than 10 lines of code.'
  99. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
  100. Enabled: false
  101. Style/BlockComments:
  102. Description: 'Do not use block comments.'
  103. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-block-comments'
  104. Enabled: false
  105. Style/PerlBackrefs:
  106. Description: 'Avoid Perl-style regex back references.'
  107. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
  108. Enabled: false
  109. Style/SelfAssignment:
  110. Description: >-
  111. Checks for places where self-assignment shorthand should have
  112. been used.
  113. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
  114. Enabled: false
  115. Style/BracesAroundHashParameters:
  116. Description: 'Enforce braces style around hash parameters.'
  117. Enabled: false
  118. Rails/BulkChangeTable:
  119. Description: 'Check whether alter queries are combinable.'
  120. Enabled: false
  121. Rails/FindEach:
  122. Description: 'Prefer all.find_each over all.find.'
  123. Enabled: false
  124. Rails/HasAndBelongsToMany:
  125. Description: 'Prefer has_many :through to has_and_belongs_to_many.'
  126. # StyleGuide: 'https://github.com/bbatsov/rails-style-guide#has-many-through'
  127. Enabled: false
  128. Rails/SkipsModelValidations:
  129. Description: >-
  130. Use methods that skips model validations with caution.
  131. See reference for more information.
  132. Reference: 'http://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
  133. Enabled: true
  134. Exclude:
  135. - test/**/*
  136. Style/ClassAndModuleChildren:
  137. Description: 'Checks style of children classes and modules.'
  138. Enabled: false
  139. Naming/FileName:
  140. Description: 'Use snake_case for source file names.'
  141. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
  142. Enabled: true
  143. Exclude:
  144. - 'script/websocket-server.rb'
  145. Naming/VariableNumber:
  146. Description: 'Use the configured style when numbering variables.'
  147. Enabled: false
  148. Naming/UncommunicativeMethodParamName:
  149. Description: >-
  150. Checks for method parameter names that contain capital letters,
  151. end in numbers, or do not meet a minimal length.
  152. Enabled: true
  153. AllowedNames: e, id, _, ip
  154. Lint/BooleanSymbol:
  155. Description: 'Check for `:true` and `:false` symbols.'
  156. Enabled: true
  157. Exclude:
  158. - "db/seeds/object_manager_attributes.rb"
  159. - "test/integration/object_manager_attributes_controller_test.rb"
  160. - "test/integration/object_manager_test.rb"
  161. Lint/InterpolationCheck:
  162. Description: 'Raise warning for interpolation in single q strs'
  163. Enabled: true
  164. Exclude:
  165. - "test/unit/email_process_auto_response_test.rb"
  166. - "test/unit/email_process_bounce_delivery_permanent_failed_test.rb"
  167. - "test/unit/email_process_bounce_follow_test.rb"
  168. - "test/unit/notification_factory_renderer_test.rb"
  169. - "test/unit/notification_factory_template_test.rb"
  170. - "test/unit/ticket_trigger_test.rb"
  171. - "test/unit/ticket_trigger_recursive_disabled_test.rb"
  172. # RSpec tests
  173. Style/NumericPredicate:
  174. Description: >-
  175. Checks for the use of predicate- or comparison methods for
  176. numeric comparisons.
  177. StyleGuide: '#predicate-methods'
  178. # This will change to a new method call which isn't guaranteed to be on the
  179. # object. Switching these methods has to be done with knowledge of the types
  180. # of the variables which rubocop doesn't have.
  181. AutoCorrect: false
  182. Enabled: true
  183. Exclude:
  184. - "**/*_spec.rb"
  185. Lint/AmbiguousBlockAssociation:
  186. Description: >-
  187. Checks for ambiguous block association with method when param passed without
  188. parentheses.
  189. StyleGuide: '#syntax'
  190. Enabled: true
  191. Exclude:
  192. - "spec/support/*.rb"
  193. - "**/*_spec.rb"
  194. - "**/*_examples.rb"
  195. # Special exceptions
  196. Style/HashSyntax:
  197. Exclude:
  198. - "**/*.rake"