rbhint 0.85.1.rc1 → 0.85.1.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -2
  3. data/assets/output.html.erb +1 -1
  4. data/config/default.yml +13 -1
  5. data/lib/rbhint.rb +8 -0
  6. data/lib/rbhint/version.rb +1 -1
  7. data/lib/rubocop.rb +2 -0
  8. data/lib/rubocop/config.rb +1 -1
  9. data/lib/rubocop/config_loader_resolver.rb +1 -1
  10. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +1 -1
  11. data/lib/rubocop/cop/generator/configuration_injector.rb +1 -1
  12. data/lib/rubocop/cop/layout/assignment_indentation.rb +2 -2
  13. data/lib/rubocop/cop/layout/block_alignment.rb +1 -1
  14. data/lib/rubocop/cop/layout/block_end_newline.rb +1 -1
  15. data/lib/rubocop/cop/layout/case_indentation.rb +2 -2
  16. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +1 -1
  17. data/lib/rubocop/cop/layout/comment_indentation.rb +4 -4
  18. data/lib/rubocop/cop/layout/condition_position.rb +1 -1
  19. data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
  20. data/lib/rubocop/cop/layout/dot_position.rb +1 -1
  21. data/lib/rubocop/cop/layout/else_alignment.rb +1 -1
  22. data/lib/rubocop/cop/layout/empty_comment.rb +2 -2
  23. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +1 -1
  24. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +2 -2
  25. data/lib/rubocop/cop/layout/empty_lines.rb +1 -1
  26. data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +1 -1
  27. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +2 -0
  28. data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +1 -1
  29. data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +1 -1
  30. data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +1 -1
  31. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +2 -2
  32. data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +1 -1
  33. data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +1 -1
  34. data/lib/rubocop/cop/layout/end_alignment.rb +1 -1
  35. data/lib/rubocop/cop/layout/end_of_line.rb +2 -2
  36. data/lib/rubocop/cop/layout/extra_spacing.rb +6 -6
  37. data/lib/rubocop/cop/layout/first_argument_indentation.rb +3 -3
  38. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +2 -2
  39. data/lib/rubocop/cop/layout/first_array_element_line_break.rb +2 -2
  40. data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +2 -2
  41. data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +1 -1
  42. data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +1 -1
  43. data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +1 -1
  44. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +2 -2
  45. data/lib/rubocop/cop/layout/hash_alignment.rb +1 -1
  46. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +1 -1
  47. data/lib/rubocop/cop/layout/heredoc_indentation.rb +3 -3
  48. data/lib/rubocop/cop/layout/indentation_consistency.rb +1 -1
  49. data/lib/rubocop/cop/layout/indentation_style.rb +1 -1
  50. data/lib/rubocop/cop/layout/indentation_width.rb +2 -2
  51. data/lib/rubocop/cop/layout/initial_indentation.rb +1 -1
  52. data/lib/rubocop/cop/layout/leading_comment_space.rb +1 -1
  53. data/lib/rubocop/cop/layout/leading_empty_lines.rb +1 -1
  54. data/lib/rubocop/cop/layout/line_length.rb +6 -6
  55. data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +1 -1
  56. data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +1 -1
  57. data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +1 -1
  58. data/lib/rubocop/cop/layout/multiline_block_layout.rb +1 -1
  59. data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +1 -1
  60. data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +1 -1
  61. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +1 -1
  62. data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +1 -1
  63. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +1 -1
  64. data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +1 -1
  65. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +1 -1
  66. data/lib/rubocop/cop/layout/parameter_alignment.rb +1 -1
  67. data/lib/rubocop/cop/layout/space_after_colon.rb +2 -2
  68. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +1 -1
  69. data/lib/rubocop/cop/layout/space_around_keyword.rb +2 -2
  70. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +6 -6
  71. data/lib/rubocop/cop/layout/space_around_operators.rb +2 -2
  72. data/lib/rubocop/cop/layout/space_before_block_braces.rb +14 -0
  73. data/lib/rubocop/cop/layout/space_before_comment.rb +1 -1
  74. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +1 -1
  75. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +1 -1
  76. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +1 -1
  77. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +2 -2
  78. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +1 -1
  79. data/lib/rubocop/cop/layout/trailing_empty_lines.rb +1 -1
  80. data/lib/rubocop/cop/layout/trailing_whitespace.rb +1 -1
  81. data/lib/rubocop/cop/lint/constant_resolution.rb +89 -0
  82. data/lib/rubocop/cop/lint/float_out_of_range.rb +1 -1
  83. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +6 -1
  84. data/lib/rubocop/cop/lint/percent_string_array.rb +1 -1
  85. data/lib/rubocop/cop/lint/percent_symbol_array.rb +1 -1
  86. data/lib/rubocop/cop/lint/raise_exception.rb +4 -4
  87. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +4 -2
  88. data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +1 -1
  89. data/lib/rubocop/cop/metrics/abc_size.rb +1 -1
  90. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +35 -3
  91. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +1 -1
  92. data/lib/rubocop/cop/metrics/utils/iterating_block.rb +61 -0
  93. data/lib/rubocop/cop/mixin/configurable_naming.rb +1 -1
  94. data/lib/rubocop/cop/mixin/documentation_comment.rb +2 -2
  95. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
  96. data/lib/rubocop/cop/mixin/first_element_line_break.rb +1 -1
  97. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +1 -1
  98. data/lib/rubocop/cop/mixin/parentheses.rb +1 -2
  99. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +1 -1
  100. data/lib/rubocop/cop/mixin/range_help.rb +1 -1
  101. data/lib/rubocop/cop/mixin/regexp_literal_help.rb +27 -0
  102. data/lib/rubocop/cop/mixin/string_literals_help.rb +1 -1
  103. data/lib/rubocop/cop/mixin/surrounding_space.rb +3 -3
  104. data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -1
  105. data/lib/rubocop/cop/mixin/uncommunicative_name.rb +2 -2
  106. data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
  107. data/lib/rubocop/cop/naming/file_name.rb +1 -3
  108. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +1 -1
  109. data/lib/rubocop/cop/style/bare_percent_literals.rb +1 -1
  110. data/lib/rubocop/cop/style/block_delimiters.rb +2 -4
  111. data/lib/rubocop/cop/style/class_and_module_children.rb +1 -1
  112. data/lib/rubocop/cop/style/command_literal.rb +1 -1
  113. data/lib/rubocop/cop/style/commented_keyword.rb +2 -2
  114. data/lib/rubocop/cop/style/conditional_assignment.rb +1 -1
  115. data/lib/rubocop/cop/style/copyright.rb +3 -3
  116. data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +1 -1
  117. data/lib/rubocop/cop/style/documentation.rb +2 -2
  118. data/lib/rubocop/cop/style/empty_case_condition.rb +8 -6
  119. data/lib/rubocop/cop/style/encoding.rb +1 -1
  120. data/lib/rubocop/cop/style/exponential_notation.rb +2 -2
  121. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +1 -1
  122. data/lib/rubocop/cop/style/identical_conditional_branches.rb +1 -1
  123. data/lib/rubocop/cop/style/if_inside_else.rb +1 -1
  124. data/lib/rubocop/cop/style/inverse_methods.rb +1 -1
  125. data/lib/rubocop/cop/style/ip_addresses.rb +1 -1
  126. data/lib/rubocop/cop/style/multiline_if_then.rb +1 -1
  127. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +17 -6
  128. data/lib/rubocop/cop/style/nested_ternary_operator.rb +27 -0
  129. data/lib/rubocop/cop/style/next.rb +2 -2
  130. data/lib/rubocop/cop/style/numeric_literal_prefix.rb +2 -2
  131. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
  132. data/lib/rubocop/cop/style/redundant_parentheses.rb +1 -1
  133. data/lib/rubocop/cop/style/redundant_percent_q.rb +2 -2
  134. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +2 -2
  135. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +14 -23
  136. data/lib/rubocop/cop/style/redundant_self.rb +6 -9
  137. data/lib/rubocop/cop/style/sample.rb +1 -1
  138. data/lib/rubocop/cop/style/semicolon.rb +1 -1
  139. data/lib/rubocop/cop/style/struct_inheritance.rb +21 -0
  140. data/lib/rubocop/cop/style/symbol_array.rb +5 -5
  141. data/lib/rubocop/cop/style/ternary_parentheses.rb +1 -1
  142. data/lib/rubocop/cop/style/word_array.rb +1 -1
  143. data/lib/rubocop/cop/util.rb +2 -2
  144. data/lib/rubocop/cop/utils/format_string.rb +1 -1
  145. data/lib/rubocop/formatter/disabled_config_formatter.rb +1 -1
  146. data/lib/rubocop/formatter/formatter_set.rb +1 -1
  147. data/lib/rubocop/name_similarity.rb +6 -0
  148. data/lib/rubocop/path_util.rb +2 -2
  149. data/lib/rubocop/platform.rb +1 -1
  150. data/lib/rubocop/rspec/expect_offense.rb +12 -2
  151. data/lib/rubocop/target_finder.rb +1 -1
  152. data/lib/rubocop/target_ruby.rb +1 -1
  153. metadata +10 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd891aa24d19c875913eea3b0955d179e0755ff691e7f7b79dbc297e97a2970f
4
- data.tar.gz: be6d7b62c97c7da10a6b2e0862f012eeacd50c6f33b5ab92fee1af27cd76be20
3
+ metadata.gz: 575dc4f99f17504f68d1e06e7be4a0f50086cd89096bfeac5e0c5182aa46912a
4
+ data.tar.gz: 78d0d28fb807ce20c1faf65cb98b334dd1b485c689ddcb180e1caf75168c87b2
5
5
  SHA512:
6
- metadata.gz: 1029fa48c588e4c8b393917d72a1c717120e5ef262dcadeae0db9969e99feb8ca1d17abc0e281a64cf166499483543b31510f09df405e31a441db6497f8c5cd3
7
- data.tar.gz: a49e77b5ff8ac7bec74499e55d61c63d506aad88c31ccee30572c235a49eb1cd816eb72ae3da8e3e68139284c9c4ae9f4963b0174ac0908e074f07f2bdada15d
6
+ metadata.gz: 898979dd42750d133f7f00c0ebd27616b6aaf02a5bb89dbae9c199467a8225e10c9eb35256ebd19a66a71b7e1bcff3323604ab1c196be61d121a456aab8f795b
7
+ data.tar.gz: f406066ffa12d88b7741578f2d78fbcce59da7ddfaee360e8941eb591a11dee985d6eaa23a677abf6ceab97fe63b220f0426c26d0a1e14d061612c7e146e4d8f
data/README.md CHANGED
@@ -40,7 +40,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RbHint update you
40
40
  might want to use a conservative version lock in your `Gemfile`:
41
41
 
42
42
  ```rb
43
- gem 'rbhint', '~> 0.85.1.rc1', require: false
43
+ gem 'rbhint', '~> 0.85.0', require: false
44
44
  ```
45
45
 
46
46
  ## Quickstart
@@ -54,7 +54,7 @@ $ rbhint
54
54
 
55
55
  ## Documentation
56
56
 
57
- RbHint is a feature-for-feature compatible adaptation of RuboCop, with a kindler, gentler approach to encouragingg change. You can read more about how to use RbHint by reading [RuboCop's official docs](https://docs.rubocop.org).
57
+ RbHint is a feature-for-feature compatible adaptation of RuboCop, with a kinder, gentler approach to encouraging change. You can read more about how to use RbHint by reading [RuboCop's official docs](https://docs.rubocop.org).
58
58
 
59
59
  ## Compatibility
60
60
 
@@ -63,6 +63,8 @@ RbHint supports the following Ruby implementations:
63
63
  * MRI 2.4+
64
64
  * JRuby 9.2+
65
65
 
66
+ See [compatibility](https://docs.rubocop.org/rubocop/compatibility.html) for further details.
67
+
66
68
  ## Team
67
69
 
68
70
  Currently, `rbhint` is maintained by [Zee Spencer](https://github.com/zspencer).
@@ -78,6 +80,8 @@ Here's a list of RbHint's historic developers:
78
80
  * [Masataka Kuwabara](https://github.com/pocke)
79
81
  * [Koichi Ito](https://github.com/koic)
80
82
  * [Maxim Krizhanovski](https://github.com/darhazer)
83
+ * [Benjamin Quorning](https://github.com/bquorning)
84
+ * [Marc-André Lafortune](https://github.com/marcandre)
81
85
 
82
86
 
83
87
  ## Contributors
@@ -254,7 +254,7 @@
254
254
  <% end %>
255
255
  </div>
256
256
  <footer>
257
- Generated by <a href="https://github.com/zspencer/rbhint">RuboCop</a>
257
+ Generated by <a href="https://github.com/zspencer/rbhint">RbHint</a>
258
258
  <span class="version"><%= RbHint::Version::STRING %></span>
259
259
  </footer>
260
260
  </body>
@@ -1361,6 +1361,15 @@ Lint/CircularArgumentReference:
1361
1361
  Enabled: true
1362
1362
  VersionAdded: '0.33'
1363
1363
 
1364
+ Lint/ConstantResolution:
1365
+ Description: 'Check that constants are fully qualified with `::`.'
1366
+ Enabled: false
1367
+ VersionAdded: '0.86'
1368
+ # Restrict this cop to only looking at certain names
1369
+ Only: []
1370
+ # Restrict this cop from only looking at certain names
1371
+ Ignore: []
1372
+
1364
1373
  Lint/Debugger:
1365
1374
  Description: 'Check for debugger calls.'
1366
1375
  Enabled: true
@@ -1925,7 +1934,7 @@ Metrics/CyclomaticComplexity:
1925
1934
  VersionAdded: '0.25'
1926
1935
  VersionChanged: '0.81'
1927
1936
  IgnoredMethods: []
1928
- Max: 6
1937
+ Max: 7
1929
1938
 
1930
1939
  Metrics/MethodLength:
1931
1940
  Description: 'Avoid methods longer than 10 lines of code.'
@@ -3239,6 +3248,7 @@ Style/MultilineTernaryOperator:
3239
3248
  StyleGuide: '#no-multiline-ternary'
3240
3249
  Enabled: true
3241
3250
  VersionAdded: '0.9'
3251
+ VersionChanged: '0.86'
3242
3252
 
3243
3253
  Style/MultilineWhenThen:
3244
3254
  Description: 'Do not use then for multi-line when statement.'
@@ -3343,6 +3353,7 @@ Style/NestedTernaryOperator:
3343
3353
  StyleGuide: '#no-nested-ternary'
3344
3354
  Enabled: true
3345
3355
  VersionAdded: '0.9'
3356
+ VersionChanged: '0.86'
3346
3357
 
3347
3358
  Style/Next:
3348
3359
  Description: 'Use `next` to skip iteration instead of a condition at the end.'
@@ -3875,6 +3886,7 @@ Style/StructInheritance:
3875
3886
  StyleGuide: '#no-extend-struct-new'
3876
3887
  Enabled: true
3877
3888
  VersionAdded: '0.29'
3889
+ VersionChanged: '0.86'
3878
3890
 
3879
3891
  Style/SymbolArray:
3880
3892
  Description: 'Use %i or %I for arrays of symbols.'
@@ -2,5 +2,13 @@
2
2
 
3
3
  require 'rubocop'
4
4
 
5
+ # A Kindler, Gentler Ruby Linter and Formatter.
6
+ #
7
+ # RbHint encourages a shared code format by giving hints and
8
+ # flagging unusually formatted code in a project.
9
+ #
10
+ # It may also be used to enforce firm boundaries for code format
11
+ # when those boundaries are appropriate for the project.
12
+ #
5
13
  module RbHint
6
14
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RbHint
4
4
  module Version
5
- STRING = '0.85.1.rc1'
5
+ STRING = '0.85.1.rc2'
6
6
  end
7
7
  end
@@ -242,6 +242,7 @@ require_relative 'rubocop/cop/lint/assignment_in_condition'
242
242
  require_relative 'rubocop/cop/lint/big_decimal_new'
243
243
  require_relative 'rubocop/cop/lint/boolean_symbol'
244
244
  require_relative 'rubocop/cop/lint/circular_argument_reference'
245
+ require_relative 'rubocop/cop/lint/constant_resolution'
245
246
  require_relative 'rubocop/cop/lint/debugger'
246
247
  require_relative 'rubocop/cop/lint/deprecated_class_methods'
247
248
  require_relative 'rubocop/cop/lint/deprecated_open_ssl_constant'
@@ -321,6 +322,7 @@ require_relative 'rubocop/cop/lint/useless_else_without_rescue'
321
322
  require_relative 'rubocop/cop/lint/useless_setter_call'
322
323
  require_relative 'rubocop/cop/lint/void'
323
324
 
325
+ require_relative 'rubocop/cop/metrics/utils/iterating_block'
324
326
  require_relative 'rubocop/cop/metrics/cyclomatic_complexity'
325
327
  # relies on cyclomatic_complexity
326
328
  require_relative 'rubocop/cop/metrics/utils/abc_size_calculator'
@@ -152,7 +152,7 @@ module RuboCop
152
152
  return true if File.extname(file) == '.gemspec'
153
153
 
154
154
  file_to_include?(file) do |pattern, relative_path, absolute_path|
155
- pattern.to_s =~ /[A-Z]/ &&
155
+ /[A-Z]/.match?(pattern.to_s) &&
156
156
  (match_path?(pattern, relative_path) ||
157
157
  match_path?(pattern, absolute_path))
158
158
  end
@@ -192,7 +192,7 @@ module RuboCop
192
192
 
193
193
  def remote_file?(uri)
194
194
  regex = URI::DEFAULT_PARSER.make_regexp(%w[http https])
195
- uri =~ /\A#{regex}\z/
195
+ /\A#{regex}\z/.match?(uri)
196
196
  end
197
197
 
198
198
  def handle_disabled_by_default(config, new_default_configuration)
@@ -64,7 +64,7 @@ module RuboCop
64
64
  def extract_ruby_version(required_ruby_version)
65
65
  if required_ruby_version.array_type?
66
66
  required_ruby_version = required_ruby_version.children.detect do |v|
67
- v.str_content =~ /[>=]/
67
+ /[>=]/.match?(v.str_content)
68
68
  end
69
69
  end
70
70
 
@@ -58,7 +58,7 @@ module RuboCop
58
58
  end
59
59
 
60
60
  def cop_name_line?(yaml)
61
- yaml !~ /^[\s#]/
61
+ !/^[\s#]/.match?(yaml)
62
62
  end
63
63
  end
64
64
  end
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks the indentation of the first line of the
6
+ # This hint checks the indentation of the first line of the
7
7
  # right-hand-side of a multi-line assignment.
8
8
  #
9
9
  # @example
@@ -20,7 +20,7 @@ module RuboCop
20
20
  # end
21
21
  #
22
22
  # The indentation of the remaining lines can be corrected with
23
- # other cops such as `IndentationConsistency` and `EndAlignment`.
23
+ # other hints such as `IndentationConsistency` and `EndAlignment`.
24
24
  class AssignmentIndentation < Cop
25
25
  include CheckAssignment
26
26
  include Alignment
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks whether the end keywords are aligned properly for do
6
+ # This hint checks whether the end keywords are aligned properly for do
7
7
  # end blocks.
8
8
  #
9
9
  # Three modes are supported through the `EnforcedStyleAlignWith`
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks whether the end statement of a do..end block
6
+ # This hint checks whether the end statement of a do..end block
7
7
  # is on its own line.
8
8
  #
9
9
  # @example
@@ -3,10 +3,10 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks how the ``when``s of a `case` expression
6
+ # This hint checks how the ``when``s of a `case` expression
7
7
  # are indented in relation to its `case` or `end` keyword.
8
8
  #
9
- # It will register a separate offense for each misaligned `when`.
9
+ # It will register a separate flag for each misaligned `when`.
10
10
  #
11
11
  # @example
12
12
  # # If Layout/EndAlignment is set to keyword style (default)
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks the indentation of hanging closing parentheses in
6
+ # This hint checks the indentation of hanging closing parentheses in
7
7
  # method calls, method definitions, and grouped expressions. A hanging
8
8
  # closing parenthesis means `)` preceded by a line break.
9
9
  #
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks the indentation of comments.
6
+ # This hint checks the indentation of comments.
7
7
  #
8
8
  # @example
9
9
  # # bad
@@ -109,7 +109,7 @@ module RuboCop
109
109
 
110
110
  def own_line_comment?(comment)
111
111
  own_line = processed_source.lines[comment.loc.line - 1]
112
- own_line =~ /\A\s*#/
112
+ /\A\s*#/.match?(own_line)
113
113
  end
114
114
 
115
115
  def line_after_comment(comment)
@@ -129,11 +129,11 @@ module RuboCop
129
129
  end
130
130
 
131
131
  def less_indented?(line)
132
- line =~ /^\s*(end\b|[)}\]])/
132
+ /^\s*(end\b|[)}\]])/.match?(line)
133
133
  end
134
134
 
135
135
  def two_alternatives?(line)
136
- line =~ /^\s*(else|elsif|when|rescue|ensure)\b/
136
+ /^\s*(else|elsif|when|rescue|ensure)\b/.match?(line)
137
137
  end
138
138
  end
139
139
  end
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks for conditions that are not on the same line as
6
+ # This hint checks for conditions that are not on the same line as
7
7
  # if/while/until.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks whether the end keywords of method definitions are
6
+ # This hint checks whether the end keywords of method definitions are
7
7
  # aligned properly.
8
8
  #
9
9
  # Two modes are supported through the EnforcedStyleAlignWith configuration
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks the . position in multi-line method calls.
6
+ # This hint checks the . position in multi-line method calls.
7
7
  #
8
8
  # @example EnforcedStyle: leading (default)
9
9
  # # bad
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks the alignment of else keywords. Normally they should
6
+ # This hint checks the alignment of else keywords. Normally they should
7
7
  # be aligned with an if/unless/while/until/begin/def keyword, but there
8
8
  # are special cases when they should follow the same rules as the
9
9
  # alignment of end.
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks empty comment.
6
+ # This hint checks empty comment.
7
7
  #
8
8
  # @example
9
9
  # # bad
@@ -119,7 +119,7 @@ module RuboCop
119
119
  /\A(#+\n)+\z/
120
120
  end
121
121
 
122
- !(comment_text =~ empty_comment_pattern).nil?
122
+ empty_comment_pattern.match?(comment_text)
123
123
  end
124
124
 
125
125
  def comment_text(comment)
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop enforces empty line after guard clause
6
+ # This hint checks for an empty line after a guard clause.
7
7
  #
8
8
  # @example
9
9
  #
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks whether method definitions are
6
+ # This hint checks whether method definitions are
7
7
  # separated by one empty line.
8
8
  #
9
9
  # `NumberOfEmptyLines` can be an integer (default is 1) or
@@ -11,7 +11,7 @@ module RuboCop
11
11
  # number of empty lines permitted.
12
12
  #
13
13
  # `AllowAdjacentOneLineDefs` configures whether adjacent
14
- # one-line method definitions are considered an offense.
14
+ # one-line method definitions are considered a flag.
15
15
  #
16
16
  # @example
17
17
  #
@@ -5,7 +5,7 @@ require 'set'
5
5
  module RuboCop
6
6
  module Cop
7
7
  module Layout
8
- # This cop checks for two or more consecutive blank lines.
8
+ # This hint checks for two or more consecutive blank lines.
9
9
  #
10
10
  # @example
11
11
  #
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks if empty lines exist around the arguments
6
+ # This hint checks if empty lines exist around the arguments
7
7
  # of a method invocation.
8
8
  #
9
9
  # @example
@@ -96,6 +96,8 @@ module RuboCop
96
96
  end
97
97
 
98
98
  def next_line_node(node)
99
+ return if node.parent.if_type?
100
+
99
101
  node.parent.children[node.sibling_index + 1]
100
102
  end
101
103
 
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks if empty lines exist around the bodies of begin-end
6
+ # This hint checks if empty lines exist around the bodies of begin-end
7
7
  # blocks.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks if empty lines around the bodies of blocks match
6
+ # This hint checks if empty lines around the bodies of blocks match
7
7
  # the configuration.
8
8
  #
9
9
  # @example EnforcedStyle: empty_lines
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks if empty lines around the bodies of classes match
6
+ # This hint checks if empty lines around the bodies of classes match
7
7
  # the configuration.
8
8
  #
9
9
  # @example EnforcedStyle: empty_lines
@@ -3,8 +3,8 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks if empty lines exist around the bodies of `begin`
7
- # sections. This cop doesn't check empty lines at `begin` body
6
+ # This hint checks if empty lines exist around the bodies of `begin`
7
+ # sections. This hint doesn't check empty lines at `begin` body
8
8
  # beginning/end and around method definition body.
9
9
  # `Style/EmptyLinesAroundBeginBody` or `Style/EmptyLinesAroundMethodBody`
10
10
  # can be used for this purpose.
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks if empty lines exist around the bodies of methods.
6
+ # This hint checks if empty lines exist around the bodies of methods.
7
7
  #
8
8
  # @example
9
9
  #
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Layout
6
- # This cop checks if empty lines around the bodies of modules match
6
+ # This hint checks if empty lines around the bodies of modules match
7
7
  # the configuration.
8
8
  #
9
9
  # @example EnforcedStyle: empty_lines