.rubocop.yml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. Metrics/LineLength:
  13. Description: 'Limit lines to 80 characters.'
  14. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
  15. Enabled: false
  16. Style/NegatedIf:
  17. Description: >-
  18. Favor unless over if for negative conditions
  19. (or control flow or).
  20. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
  21. Enabled: false
  22. Style/IfUnlessModifier:
  23. Description: >-
  24. Favor modifier if/unless usage when you have a
  25. single-line body.
  26. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
  27. Enabled: false
  28. Style/TrailingCommaInLiteral:
  29. Description: 'Checks for trailing comma in array and hash literals.'
  30. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
  31. Enabled: false
  32. Style/TrailingCommaInArguments:
  33. Description: 'Checks for trailing comma in argument lists.'
  34. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
  35. Enabled: false
  36. Style/SpaceInsideParens:
  37. Description: 'No spaces after ( or before ).'
  38. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
  39. Enabled: false
  40. Style/SpaceAfterMethodName:
  41. Description: >-
  42. Do not put a space between a method name and the opening
  43. parenthesis in a method definition.
  44. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
  45. Enabled: false
  46. Style/LeadingCommentSpace:
  47. Description: 'Comments should start with a space.'
  48. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-space'
  49. Enabled: false
  50. Style/MethodCallParentheses:
  51. Description: 'Do not use parentheses for method calls with no arguments.'
  52. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-args-no-parens'
  53. Enabled: false
  54. Style/SpaceInsideBrackets:
  55. Description: 'No spaces after [ or before ].'
  56. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
  57. Enabled: false
  58. Style/DefWithParentheses:
  59. Description: 'Use def with parentheses when there are arguments.'
  60. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
  61. Enabled: false
  62. Style/MethodDefParentheses:
  63. Description: >-
  64. Checks if the method definitions have or don't have
  65. parentheses.
  66. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
  67. Enabled: false
  68. Style/EmptyLinesAroundClassBody:
  69. Description: "Keeps track of empty lines around class bodies."
  70. Enabled: false
  71. Style/EmptyLinesAroundMethodBody:
  72. Description: "Keeps track of empty lines around method bodies."
  73. Enabled: false
  74. Style/EmptyLinesAroundBlockBody:
  75. Description: "Keeps track of empty lines around block bodies."
  76. Enabled: false
  77. Style/EmptyLinesAroundModuleBody:
  78. Description: "Keeps track of empty lines around module bodies."
  79. Enabled: false
  80. Style/BlockDelimiters:
  81. Description: >-
  82. Avoid using {...} for multi-line blocks (multiline chaining is
  83. always ugly).
  84. Prefer {...} over do...end for single-line blocks.
  85. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
  86. Enabled: false
  87. Style/MultilineBlockChain:
  88. Description: 'Avoid multi-line chains of blocks.'
  89. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
  90. Enabled: false
  91. Metrics/ClassLength:
  92. Description: 'Avoid classes longer than 100 lines of code.'
  93. Enabled: false
  94. Metrics/MethodLength:
  95. Description: 'Avoid methods longer than 10 lines of code.'
  96. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
  97. Enabled: false
  98. Style/BlockComments:
  99. Description: 'Do not use block comments.'
  100. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-block-comments'
  101. Enabled: false
  102. Style/PerlBackrefs:
  103. Description: 'Avoid Perl-style regex back references.'
  104. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
  105. Enabled: false
  106. Style/SelfAssignment:
  107. Description: >-
  108. Checks for places where self-assignment shorthand should have
  109. been used.
  110. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
  111. Enabled: false
  112. Style/BracesAroundHashParameters:
  113. Description: 'Enforce braces style around hash parameters.'
  114. Enabled: false
  115. Rails/FindEach:
  116. Description: 'Prefer all.find_each over all.find.'
  117. Enabled: false
  118. Rails/HasAndBelongsToMany:
  119. Description: 'Prefer has_many :through to has_and_belongs_to_many.'
  120. # StyleGuide: 'https://github.com/bbatsov/rails-style-guide#has-many-through'
  121. Enabled: false
  122. Style/ClassAndModuleChildren:
  123. Description: 'Checks style of children classes and modules.'
  124. Enabled: false
  125. Style/FileName:
  126. Description: 'Use snake_case for source file names.'
  127. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
  128. Enabled: true
  129. Exclude:
  130. - 'script/websocket-server.rb'
  131. # 2.0
  132. Metrics/PerceivedComplexity:
  133. Description: >-
  134. A complexity metric geared towards measuring complexity for a
  135. human reader.
  136. Enabled: false
  137. Metrics/AbcSize:
  138. Description: >-
  139. A calculated magnitude based on number of assignments,
  140. branches, and conditions.
  141. Enabled: false
  142. Metrics/CyclomaticComplexity:
  143. Description: >-
  144. A complexity metric that is strongly correlated to the number
  145. of test cases needed to validate a method.
  146. Enabled: false
  147. Metrics/BlockNesting:
  148. Description: 'Avoid excessive block nesting'
  149. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
  150. Enabled: false
  151. Metrics/ModuleLength:
  152. Description: 'Avoid modules longer than 100 lines of code.'
  153. Enabled: false
  154. # TODO
  155. Style/Documentation:
  156. Description: 'Document classes and non-namespace modules.'
  157. Enabled: false
  158. Lint/UselessAssignment:
  159. Enabled: false
  160. Style/ExtraSpacing:
  161. Description: 'Do not use unnecessary spacing.'
  162. Enabled: false
  163. # Broken!!!! Generates broken code since "String".downcase == "strinG".downcase is not equals "String".casecmp("strinG") but "String".casecmp("strinG") == 0 !!!
  164. Performance/Casecmp:
  165. Description: 'Use `casecmp` rather than `downcase ==`.'
  166. Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
  167. Enabled: false