.rubocop.yml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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/BlockDelimiters:
  83. Description: >-
  84. Avoid using {...} for multi-line blocks (multiline chaining is
  85. always ugly).
  86. Prefer {...} over do...end for single-line blocks.
  87. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
  88. Enabled: false
  89. Style/MultilineBlockChain:
  90. Description: 'Avoid multi-line chains of blocks.'
  91. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
  92. Enabled: false
  93. Metrics/ClassLength:
  94. Description: 'Avoid classes longer than 100 lines of code.'
  95. Enabled: false
  96. Metrics/MethodLength:
  97. Description: 'Avoid methods longer than 10 lines of code.'
  98. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
  99. Enabled: false
  100. Style/BlockComments:
  101. Description: 'Do not use block comments.'
  102. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-block-comments'
  103. Enabled: false
  104. Style/PerlBackrefs:
  105. Description: 'Avoid Perl-style regex back references.'
  106. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
  107. Enabled: false
  108. Style/SelfAssignment:
  109. Description: >-
  110. Checks for places where self-assignment shorthand should have
  111. been used.
  112. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
  113. Enabled: false
  114. Style/BracesAroundHashParameters:
  115. Description: 'Enforce braces style around hash parameters.'
  116. Enabled: false
  117. Rails/FindEach:
  118. Description: 'Prefer all.find_each over all.find.'
  119. Enabled: false
  120. Rails/HasAndBelongsToMany:
  121. Description: 'Prefer has_many :through to has_and_belongs_to_many.'
  122. # StyleGuide: 'https://github.com/bbatsov/rails-style-guide#has-many-through'
  123. Enabled: false
  124. Style/ClassAndModuleChildren:
  125. Description: 'Checks style of children classes and modules.'
  126. Enabled: false
  127. Style/FileName:
  128. Description: 'Use snake_case for source file names.'
  129. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
  130. Enabled: true
  131. Exclude:
  132. - 'script/websocket-server.rb'
  133. # 2.0
  134. Metrics/PerceivedComplexity:
  135. Description: >-
  136. A complexity metric geared towards measuring complexity for a
  137. human reader.
  138. Enabled: false
  139. Metrics/AbcSize:
  140. Description: >-
  141. A calculated magnitude based on number of assignments,
  142. branches, and conditions.
  143. Enabled: false
  144. Metrics/CyclomaticComplexity:
  145. Description: >-
  146. A complexity metric that is strongly correlated to the number
  147. of test cases needed to validate a method.
  148. Enabled: false
  149. Metrics/BlockNesting:
  150. Description: 'Avoid excessive block nesting'
  151. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
  152. Enabled: false
  153. Metrics/ModuleLength:
  154. Description: 'Avoid modules longer than 100 lines of code.'
  155. Enabled: false
  156. # TODO
  157. Style/Documentation:
  158. Description: 'Document classes and non-namespace modules.'
  159. Enabled: false
  160. Lint/UselessAssignment:
  161. Enabled: false
  162. Style/ExtraSpacing:
  163. Description: 'Do not use unnecessary spacing.'
  164. Enabled: false
  165. # Broken!!!! Generates broken code since "String".downcase == "strinG".downcase is not equals "String".casecmp("strinG") but "String".casecmp("strinG") == 0 !!!
  166. Performance/Casecmp:
  167. Description: 'Use `casecmp` rather than `downcase ==`.'
  168. Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
  169. Enabled: false