.rubocop.yml 8.1 KB

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