.rubocop.yml 8.1 KB

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