.rubocop.yml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. # Default enabled cops
  2. # https://github.com/bbatsov/rubocop/blob/master/config/enabled.yml
  3. AllCops:
  4. Exclude:
  5. - 'bin/rails'
  6. - 'bin/rake'
  7. - 'bin/spring'
  8. - 'db/schema.rb'
  9. Rails:
  10. Enabled: true
  11. # Zammad StyleGuide
  12. Style/FrozenStringLiteralComment:
  13. Enabled: false
  14. Metrics/LineLength:
  15. Description: 'Limit lines to 80 characters.'
  16. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
  17. Enabled: false
  18. Style/NegatedIf:
  19. Description: >-
  20. Favor unless over if for negative conditions
  21. (or control flow or).
  22. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
  23. Enabled: false
  24. Style/IfUnlessModifier:
  25. Description: >-
  26. Favor modifier if/unless usage when you have a
  27. single-line body.
  28. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
  29. Enabled: false
  30. Style/TrailingCommaInLiteral:
  31. Description: 'Checks for trailing comma in array and hash literals.'
  32. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
  33. Enabled: false
  34. Style/TrailingCommaInArguments:
  35. Description: 'Checks for trailing comma in argument lists.'
  36. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
  37. Enabled: false
  38. Layout/SpaceInsideParens:
  39. Description: 'No spaces after ( or before ).'
  40. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
  41. Enabled: false
  42. Layout/SpaceAfterMethodName:
  43. Description: >-
  44. Do not put a space between a method name and the opening
  45. parenthesis in a method definition.
  46. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
  47. Enabled: false
  48. Layout/LeadingCommentSpace:
  49. Description: 'Comments should start with a space.'
  50. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-space'
  51. Enabled: false
  52. Style/MethodCallWithoutArgsParentheses:
  53. Description: 'Do not use parentheses for method calls with no arguments.'
  54. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-args-no-parens'
  55. Enabled: false
  56. Layout/SpaceInsideBrackets:
  57. Description: 'No spaces after [ or before ].'
  58. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
  59. Enabled: false
  60. Style/DefWithParentheses:
  61. Description: 'Use def with parentheses when there are arguments.'
  62. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
  63. Enabled: false
  64. Style/MethodDefParentheses:
  65. Description: >-
  66. Checks if the method definitions have or don't have
  67. parentheses.
  68. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
  69. Enabled: false
  70. Layout/EmptyLinesAroundClassBody:
  71. Description: "Keeps track of empty lines around class bodies."
  72. Enabled: false
  73. Layout/EmptyLinesAroundMethodBody:
  74. Description: "Keeps track of empty lines around method bodies."
  75. Enabled: false
  76. Layout/EmptyLinesAroundBlockBody:
  77. Description: "Keeps track of empty lines around block bodies."
  78. Enabled: false
  79. Layout/EmptyLinesAroundModuleBody:
  80. Description: "Keeps track of empty lines around module bodies."
  81. Enabled: false
  82. Style/MultilineBlockChain:
  83. Description: 'Avoid multi-line chains of blocks.'
  84. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
  85. Enabled: false
  86. Metrics/ClassLength:
  87. Description: 'Avoid classes longer than 100 lines of code.'
  88. Enabled: false
  89. Metrics/MethodLength:
  90. Description: 'Avoid methods longer than 10 lines of code.'
  91. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
  92. Enabled: false
  93. Style/BlockComments:
  94. Description: 'Do not use block comments.'
  95. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-block-comments'
  96. Enabled: false
  97. Style/PerlBackrefs:
  98. Description: 'Avoid Perl-style regex back references.'
  99. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
  100. Enabled: false
  101. Style/SelfAssignment:
  102. Description: >-
  103. Checks for places where self-assignment shorthand should have
  104. been used.
  105. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
  106. Enabled: false
  107. Style/BracesAroundHashParameters:
  108. Description: 'Enforce braces style around hash parameters.'
  109. Enabled: false
  110. Rails/FindEach:
  111. Description: 'Prefer all.find_each over all.find.'
  112. Enabled: false
  113. Rails/HasAndBelongsToMany:
  114. Description: 'Prefer has_many :through to has_and_belongs_to_many.'
  115. # StyleGuide: 'https://github.com/bbatsov/rails-style-guide#has-many-through'
  116. Enabled: false
  117. Rails/SkipsModelValidations:
  118. Description: >-
  119. Use methods that skips model validations with caution.
  120. See reference for more information.
  121. Reference: 'http://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
  122. Enabled: true
  123. Exclude:
  124. - test/**/*
  125. Style/ClassAndModuleChildren:
  126. Description: 'Checks style of children classes and modules.'
  127. Enabled: false
  128. Naming/FileName:
  129. Description: 'Use snake_case for source file names.'
  130. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
  131. Enabled: true
  132. Exclude:
  133. - 'script/websocket-server.rb'
  134. Naming/VariableNumber:
  135. Description: 'Use the configured style when numbering variables.'
  136. Enabled: false
  137. # 2.0
  138. Metrics/PerceivedComplexity:
  139. Description: >-
  140. A complexity metric geared towards measuring complexity for a
  141. human reader.
  142. Enabled: false
  143. Metrics/AbcSize:
  144. Description: >-
  145. A calculated magnitude based on number of assignments,
  146. branches, and conditions.
  147. Enabled: false
  148. Metrics/CyclomaticComplexity:
  149. Description: >-
  150. A complexity metric that is strongly correlated to the number
  151. of test cases needed to validate a method.
  152. Enabled: false
  153. Metrics/BlockNesting:
  154. Description: 'Avoid excessive block nesting'
  155. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
  156. Enabled: false
  157. Metrics/ModuleLength:
  158. Description: 'Avoid modules longer than 100 lines of code.'
  159. Enabled: false
  160. Metrics/BlockLength:
  161. Enabled: false
  162. Lint/RescueWithoutErrorClass:
  163. Enabled: false
  164. Rails/ApplicationRecord:
  165. Enabled: false
  166. # TODO
  167. Rails/HasManyOrHasOneDependent:
  168. Enabled: false
  169. Style/DateTime:
  170. Enabled: false
  171. Style/Documentation:
  172. Description: 'Document classes and non-namespace modules.'
  173. Enabled: false
  174. Lint/UselessAssignment:
  175. Enabled: false
  176. Layout/ExtraSpacing:
  177. Description: 'Do not use unnecessary spacing.'
  178. Enabled: false
  179. # Broken!!!! Generates broken code since "String".downcase == "strinG".downcase is not equals "String".casecmp("strinG") but "String".casecmp("strinG") == 0 !!!
  180. Performance/Casecmp:
  181. Description: 'Use `casecmp` rather than `downcase ==`.'
  182. Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
  183. Enabled: false
  184. # RSpec tests
  185. Style/NumericPredicate:
  186. Description: >-
  187. Checks for the use of predicate- or comparison methods for
  188. numeric comparisons.
  189. StyleGuide: '#predicate-methods'
  190. # This will change to a new method call which isn't guaranteed to be on the
  191. # object. Switching these methods has to be done with knowledge of the types
  192. # of the variables which rubocop doesn't have.
  193. AutoCorrect: false
  194. Enabled: true
  195. Exclude:
  196. - "**/*_spec.rb"
  197. Lint/AmbiguousBlockAssociation:
  198. Description: >-
  199. Checks for ambiguous block association with method when param passed without
  200. parentheses.
  201. StyleGuide: '#syntax'
  202. Enabled: true
  203. Exclude:
  204. - "**/*_spec.rb"
  205. - "**/*_examples.rb"