rbhint 0.85.1.rc1 → 0.85.1.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/assets/output.html.erb +1 -1
- data/config/default.yml +13 -1
- data/lib/rbhint.rb +8 -0
- data/lib/rbhint/version.rb +1 -1
- data/lib/rubocop.rb +2 -0
- data/lib/rubocop/config.rb +1 -1
- data/lib/rubocop/config_loader_resolver.rb +1 -1
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +1 -1
- data/lib/rubocop/cop/generator/configuration_injector.rb +1 -1
- data/lib/rubocop/cop/layout/assignment_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/block_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/block_end_newline.rb +1 -1
- data/lib/rubocop/cop/layout/case_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/comment_indentation.rb +4 -4
- data/lib/rubocop/cop/layout/condition_position.rb +1 -1
- data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/dot_position.rb +1 -1
- data/lib/rubocop/cop/layout/else_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/empty_comment.rb +2 -2
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +1 -1
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +2 -2
- data/lib/rubocop/cop/layout/empty_lines.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +2 -0
- data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +2 -2
- data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +1 -1
- data/lib/rubocop/cop/layout/end_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/end_of_line.rb +2 -2
- data/lib/rubocop/cop/layout/extra_spacing.rb +6 -6
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +3 -3
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/first_array_element_line_break.rb +2 -2
- data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/first_parameter_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/hash_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +1 -1
- data/lib/rubocop/cop/layout/heredoc_indentation.rb +3 -3
- data/lib/rubocop/cop/layout/indentation_consistency.rb +1 -1
- data/lib/rubocop/cop/layout/indentation_style.rb +1 -1
- data/lib/rubocop/cop/layout/indentation_width.rb +2 -2
- data/lib/rubocop/cop/layout/initial_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/leading_comment_space.rb +1 -1
- data/lib/rubocop/cop/layout/leading_empty_lines.rb +1 -1
- data/lib/rubocop/cop/layout/line_length.rb +6 -6
- data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/parameter_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/space_after_colon.rb +2 -2
- data/lib/rubocop/cop/layout/space_around_block_parameters.rb +1 -1
- data/lib/rubocop/cop/layout/space_around_keyword.rb +2 -2
- data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +6 -6
- data/lib/rubocop/cop/layout/space_around_operators.rb +2 -2
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +14 -0
- data/lib/rubocop/cop/layout/space_before_comment.rb +1 -1
- data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +2 -2
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +1 -1
- data/lib/rubocop/cop/layout/trailing_empty_lines.rb +1 -1
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +1 -1
- data/lib/rubocop/cop/lint/constant_resolution.rb +89 -0
- data/lib/rubocop/cop/lint/float_out_of_range.rb +1 -1
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +6 -1
- data/lib/rubocop/cop/lint/percent_string_array.rb +1 -1
- data/lib/rubocop/cop/lint/percent_symbol_array.rb +1 -1
- data/lib/rubocop/cop/lint/raise_exception.rb +4 -4
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +4 -2
- data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +1 -1
- data/lib/rubocop/cop/metrics/abc_size.rb +1 -1
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +35 -3
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +1 -1
- data/lib/rubocop/cop/metrics/utils/iterating_block.rb +61 -0
- data/lib/rubocop/cop/mixin/configurable_naming.rb +1 -1
- data/lib/rubocop/cop/mixin/documentation_comment.rb +2 -2
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
- data/lib/rubocop/cop/mixin/first_element_line_break.rb +1 -1
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +1 -1
- data/lib/rubocop/cop/mixin/parentheses.rb +1 -2
- data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +1 -1
- data/lib/rubocop/cop/mixin/range_help.rb +1 -1
- data/lib/rubocop/cop/mixin/regexp_literal_help.rb +27 -0
- data/lib/rubocop/cop/mixin/string_literals_help.rb +1 -1
- data/lib/rubocop/cop/mixin/surrounding_space.rb +3 -3
- data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -1
- data/lib/rubocop/cop/mixin/uncommunicative_name.rb +2 -2
- data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
- data/lib/rubocop/cop/naming/file_name.rb +1 -3
- data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +1 -1
- data/lib/rubocop/cop/style/bare_percent_literals.rb +1 -1
- data/lib/rubocop/cop/style/block_delimiters.rb +2 -4
- data/lib/rubocop/cop/style/class_and_module_children.rb +1 -1
- data/lib/rubocop/cop/style/command_literal.rb +1 -1
- data/lib/rubocop/cop/style/commented_keyword.rb +2 -2
- data/lib/rubocop/cop/style/conditional_assignment.rb +1 -1
- data/lib/rubocop/cop/style/copyright.rb +3 -3
- data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +1 -1
- data/lib/rubocop/cop/style/documentation.rb +2 -2
- data/lib/rubocop/cop/style/empty_case_condition.rb +8 -6
- data/lib/rubocop/cop/style/encoding.rb +1 -1
- data/lib/rubocop/cop/style/exponential_notation.rb +2 -2
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +1 -1
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +1 -1
- data/lib/rubocop/cop/style/if_inside_else.rb +1 -1
- data/lib/rubocop/cop/style/inverse_methods.rb +1 -1
- data/lib/rubocop/cop/style/ip_addresses.rb +1 -1
- data/lib/rubocop/cop/style/multiline_if_then.rb +1 -1
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +17 -6
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +27 -0
- data/lib/rubocop/cop/style/next.rb +2 -2
- data/lib/rubocop/cop/style/numeric_literal_prefix.rb +2 -2
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
- data/lib/rubocop/cop/style/redundant_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/redundant_percent_q.rb +2 -2
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +2 -2
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +14 -23
- data/lib/rubocop/cop/style/redundant_self.rb +6 -9
- data/lib/rubocop/cop/style/sample.rb +1 -1
- data/lib/rubocop/cop/style/semicolon.rb +1 -1
- data/lib/rubocop/cop/style/struct_inheritance.rb +21 -0
- data/lib/rubocop/cop/style/symbol_array.rb +5 -5
- data/lib/rubocop/cop/style/ternary_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/word_array.rb +1 -1
- data/lib/rubocop/cop/util.rb +2 -2
- data/lib/rubocop/cop/utils/format_string.rb +1 -1
- data/lib/rubocop/formatter/disabled_config_formatter.rb +1 -1
- data/lib/rubocop/formatter/formatter_set.rb +1 -1
- data/lib/rubocop/name_similarity.rb +6 -0
- data/lib/rubocop/path_util.rb +2 -2
- data/lib/rubocop/platform.rb +1 -1
- data/lib/rubocop/rspec/expect_offense.rb +12 -2
- data/lib/rubocop/target_finder.rb +1 -1
- data/lib/rubocop/target_ruby.rb +1 -1
- metadata +10 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 575dc4f99f17504f68d1e06e7be4a0f50086cd89096bfeac5e0c5182aa46912a
|
|
4
|
+
data.tar.gz: 78d0d28fb807ce20c1faf65cb98b334dd1b485c689ddcb180e1caf75168c87b2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
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
|
|
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
|
data/assets/output.html.erb
CHANGED
|
@@ -254,7 +254,7 @@
|
|
|
254
254
|
<% end %>
|
|
255
255
|
</div>
|
|
256
256
|
<footer>
|
|
257
|
-
Generated by <a href="https://github.com/zspencer/rbhint">
|
|
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>
|
data/config/default.yml
CHANGED
|
@@ -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:
|
|
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.'
|
data/lib/rbhint.rb
CHANGED
|
@@ -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
|
data/lib/rbhint/version.rb
CHANGED
data/lib/rubocop.rb
CHANGED
|
@@ -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'
|
data/lib/rubocop/config.rb
CHANGED
|
@@ -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
|
-
|
|
155
|
+
/[A-Z]/.match?(pattern.to_s) &&
|
|
156
156
|
(match_path?(pattern, relative_path) ||
|
|
157
157
|
match_path?(pattern, absolute_path))
|
|
158
158
|
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module RuboCop
|
|
4
4
|
module Cop
|
|
5
5
|
module Layout
|
|
6
|
-
# This
|
|
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
|
|
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
|
|
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,10 +3,10 @@
|
|
|
3
3
|
module RuboCop
|
|
4
4
|
module Cop
|
|
5
5
|
module Layout
|
|
6
|
-
# This
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
132
|
+
/^\s*(end\b|[)}\]])/.match?(line)
|
|
133
133
|
end
|
|
134
134
|
|
|
135
135
|
def two_alternatives?(line)
|
|
136
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
14
|
+
# one-line method definitions are considered a flag.
|
|
15
15
|
#
|
|
16
16
|
# @example
|
|
17
17
|
#
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
module RuboCop
|
|
4
4
|
module Cop
|
|
5
5
|
module Layout
|
|
6
|
-
# This
|
|
7
|
-
# sections. This
|
|
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.
|