.rubocop.yml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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. Style/SpaceInsideParens:
  39. Description: 'No spaces after ( or before ).'
  40. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
  41. Enabled: false
  42. Style/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. Style/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/MethodCallParentheses:
  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. Style/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. Style/EmptyLinesAroundClassBody:
  71. Description: "Keeps track of empty lines around class bodies."
  72. Enabled: false
  73. Style/EmptyLinesAroundMethodBody:
  74. Description: "Keeps track of empty lines around method bodies."
  75. Enabled: false
  76. Style/EmptyLinesAroundBlockBody:
  77. Description: "Keeps track of empty lines around block bodies."
  78. Enabled: false
  79. Style/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. Style/ClassAndModuleChildren:
  118. Description: 'Checks style of children classes and modules.'
  119. Enabled: false
  120. Style/FileName:
  121. Description: 'Use snake_case for source file names.'
  122. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
  123. Enabled: true
  124. Exclude:
  125. - 'script/websocket-server.rb'
  126. # 2.0
  127. Metrics/PerceivedComplexity:
  128. Description: >-
  129. A complexity metric geared towards measuring complexity for a
  130. human reader.
  131. Enabled: false
  132. Metrics/AbcSize:
  133. Description: >-
  134. A calculated magnitude based on number of assignments,
  135. branches, and conditions.
  136. Enabled: false
  137. Metrics/CyclomaticComplexity:
  138. Description: >-
  139. A complexity metric that is strongly correlated to the number
  140. of test cases needed to validate a method.
  141. Enabled: false
  142. Metrics/BlockNesting:
  143. Description: 'Avoid excessive block nesting'
  144. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
  145. Enabled: false
  146. Metrics/ModuleLength:
  147. Description: 'Avoid modules longer than 100 lines of code.'
  148. Enabled: false
  149. # TODO
  150. Style/Documentation:
  151. Description: 'Document classes and non-namespace modules.'
  152. Enabled: false
  153. Lint/UselessAssignment:
  154. Enabled: false
  155. Style/ExtraSpacing:
  156. Description: 'Do not use unnecessary spacing.'
  157. Enabled: false
  158. # Broken!!!! Generates broken code since "String".downcase == "strinG".downcase is not equals "String".casecmp("strinG") but "String".casecmp("strinG") == 0 !!!
  159. Performance/Casecmp:
  160. Description: 'Use `casecmp` rather than `downcase ==`.'
  161. Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
  162. Enabled: false
  163. # RSpec tests
  164. Style/NumericPredicate:
  165. Description: >-
  166. Checks for the use of predicate- or comparison methods for
  167. numeric comparisons.
  168. StyleGuide: '#predicate-methods'
  169. # This will change to a new method call which isn't guaranteed to be on the
  170. # object. Switching these methods has to be done with knowledge of the types
  171. # of the variables which rubocop doesn't have.
  172. AutoCorrect: false
  173. Enabled: true
  174. Exclude:
  175. - "**/*_spec.rb"