rubocop 0.84.0 → 0.85.1
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 +10 -14
- data/config/default.yml +33 -15
- data/lib/rubocop.rb +6 -0
- data/lib/rubocop/cli.rb +2 -2
- data/lib/rubocop/cli/command/auto_genenerate_config.rb +2 -2
- data/lib/rubocop/comment_config.rb +1 -1
- data/lib/rubocop/config.rb +3 -1
- data/lib/rubocop/config_loader.rb +1 -1
- data/lib/rubocop/config_loader_resolver.rb +18 -2
- data/lib/rubocop/config_store.rb +12 -2
- data/lib/rubocop/cop/bundler/gem_comment.rb +70 -1
- data/lib/rubocop/cop/commissioner.rb +0 -21
- data/lib/rubocop/cop/cop.rb +36 -21
- data/lib/rubocop/cop/corrector.rb +3 -1
- data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +3 -1
- data/lib/rubocop/cop/layout/case_indentation.rb +3 -3
- data/lib/rubocop/cop/layout/class_structure.rb +19 -16
- data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +2 -2
- data/lib/rubocop/cop/layout/end_of_line.rb +2 -2
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/first_array_element_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/first_parameter_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/hash_alignment.rb +6 -6
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +1 -1
- data/lib/rubocop/cop/layout/heredoc_indentation.rb +20 -103
- data/lib/rubocop/cop/layout/line_length.rb +17 -17
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +3 -1
- data/lib/rubocop/cop/layout/space_around_keyword.rb +2 -2
- data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +3 -1
- data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +3 -1
- data/lib/rubocop/cop/lint/ambiguous_operator.rb +2 -1
- data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +8 -4
- data/lib/rubocop/cop/lint/ensure_return.rb +1 -1
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +3 -1
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +33 -2
- data/lib/rubocop/cop/lint/loop.rb +1 -1
- data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +69 -0
- data/lib/rubocop/cop/lint/nested_percent_literal.rb +1 -1
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +7 -7
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +3 -1
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +3 -3
- data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
- data/lib/rubocop/cop/lint/suppressed_exception.rb +4 -2
- data/lib/rubocop/cop/lint/unreachable_code.rb +1 -1
- data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +1 -1
- data/lib/rubocop/cop/lint/useless_setter_call.rb +1 -1
- data/lib/rubocop/cop/migration/department_name.rb +9 -5
- data/lib/rubocop/cop/mixin/array_min_size.rb +3 -1
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +3 -1
- data/lib/rubocop/cop/mixin/configurable_formatting.rb +1 -1
- data/lib/rubocop/cop/mixin/ignored_pattern.rb +1 -1
- data/lib/rubocop/cop/mixin/line_length_help.rb +1 -1
- data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +3 -1
- data/lib/rubocop/cop/mixin/regexp_literal_help.rb +16 -0
- data/lib/rubocop/cop/mixin/surrounding_space.rb +3 -1
- data/lib/rubocop/cop/mixin/uncommunicative_name.rb +1 -1
- data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +11 -1
- data/lib/rubocop/cop/naming/file_name.rb +26 -11
- data/lib/rubocop/cop/naming/predicate_name.rb +1 -1
- data/lib/rubocop/cop/registry.rb +65 -8
- data/lib/rubocop/cop/style/array_join.rb +1 -1
- data/lib/rubocop/cop/style/bare_percent_literals.rb +1 -1
- data/lib/rubocop/cop/style/copyright.rb +2 -2
- data/lib/rubocop/cop/style/empty_method.rb +1 -1
- data/lib/rubocop/cop/style/exponential_notation.rb +3 -3
- data/lib/rubocop/cop/style/format_string_token.rb +2 -3
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +1 -2
- data/lib/rubocop/cop/style/hash_each_methods.rb +1 -1
- data/lib/rubocop/cop/style/hash_syntax.rb +5 -3
- data/lib/rubocop/cop/style/inline_comment.rb +1 -1
- data/lib/rubocop/cop/style/multiline_memoization.rb +1 -1
- data/lib/rubocop/cop/style/negated_if.rb +3 -3
- data/lib/rubocop/cop/style/negated_unless.rb +3 -3
- data/lib/rubocop/cop/style/non_nil_check.rb +1 -1
- data/lib/rubocop/cop/style/redundant_conditional.rb +4 -3
- data/lib/rubocop/cop/style/redundant_percent_q.rb +1 -1
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +89 -0
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +130 -0
- data/lib/rubocop/cop/style/symbol_array.rb +1 -1
- data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +3 -3
- data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +3 -3
- data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +13 -13
- data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +3 -3
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +3 -1
- data/lib/rubocop/cop/style/unless_else.rb +1 -1
- data/lib/rubocop/cop/style/when_then.rb +1 -1
- data/lib/rubocop/cop/team.rb +69 -25
- data/lib/rubocop/cop/util.rb +1 -1
- data/lib/rubocop/cop/utils/format_string.rb +18 -0
- data/lib/rubocop/cop/variable_force/branch.rb +3 -1
- data/lib/rubocop/formatter/junit_formatter.rb +14 -4
- data/lib/rubocop/magic_comment.rb +1 -1
- data/lib/rubocop/options.rb +17 -3
- data/lib/rubocop/result_cache.rb +4 -4
- data/lib/rubocop/rspec/cop_helper.rb +2 -23
- data/lib/rubocop/rspec/expect_offense.rb +45 -6
- data/lib/rubocop/rspec/shared_contexts.rb +2 -2
- data/lib/rubocop/runner.rb +14 -10
- data/lib/rubocop/target_finder.rb +3 -1
- data/lib/rubocop/target_ruby.rb +4 -1
- data/lib/rubocop/version.rb +1 -1
- metadata +23 -5
@@ -38,7 +38,9 @@ module RuboCop
|
|
38
38
|
def largest_brackets_size(style, ary_size)
|
39
39
|
self.class.largest_brackets ||= -Float::INFINITY
|
40
40
|
|
41
|
-
|
41
|
+
if style == :brackets && ary_size > self.class.largest_brackets
|
42
|
+
self.class.largest_brackets = ary_size
|
43
|
+
end
|
42
44
|
|
43
45
|
self.class.largest_brackets
|
44
46
|
end
|
@@ -131,7 +131,9 @@ module RuboCop
|
|
131
131
|
def contained_by_multiline_collection_that_could_be_broken_up?(node)
|
132
132
|
node.each_ancestor.find do |ancestor|
|
133
133
|
if ancestor.hash_type? || ancestor.array_type?
|
134
|
-
|
134
|
+
if breakable_collection?(ancestor, ancestor.children)
|
135
|
+
return children_could_be_broken_up?(ancestor.children)
|
136
|
+
end
|
135
137
|
end
|
136
138
|
|
137
139
|
next unless ancestor.send_type?
|
@@ -67,7 +67,9 @@ module RuboCop
|
|
67
67
|
styles << :consistent
|
68
68
|
styles << :special_inside_parentheses unless left_parenthesis
|
69
69
|
end
|
70
|
-
|
70
|
+
if left_parenthesis && column == left_parenthesis.column + 1
|
71
|
+
styles << :special_inside_parentheses
|
72
|
+
end
|
71
73
|
styles << brace_alignment_style if column == left_brace.column
|
72
74
|
styles
|
73
75
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
# Common functionality for handling Regexp literals.
|
6
|
+
module RegexpLiteralHelp
|
7
|
+
private
|
8
|
+
|
9
|
+
def freespace_mode_regexp?(node)
|
10
|
+
regopt = node.children.find(&:regopt_type?)
|
11
|
+
|
12
|
+
regopt.children.include?(:x)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -107,7 +107,9 @@ module RuboCop
|
|
107
107
|
|
108
108
|
def empty_offenses(node, left, right, message)
|
109
109
|
range = range_between(left.begin_pos, right.end_pos)
|
110
|
-
|
110
|
+
if offending_empty_space?(empty_config, left, right)
|
111
|
+
empty_offense(node, range, message, 'Use one')
|
112
|
+
end
|
111
113
|
return unless offending_empty_no_space?(empty_config, left, right)
|
112
114
|
|
113
115
|
empty_offense(node, range, message, 'Do not use')
|
@@ -18,7 +18,7 @@ module RuboCop
|
|
18
18
|
full_name = arg.children.first.to_s
|
19
19
|
next if full_name == '_'
|
20
20
|
|
21
|
-
name = full_name.gsub(/\A(
|
21
|
+
name = full_name.gsub(/\A(_+)/, '')
|
22
22
|
next if (arg.restarg_type? || arg.kwrestarg_type?) && name.empty?
|
23
23
|
next if allowed_names.include?(name)
|
24
24
|
|
@@ -6,6 +6,12 @@ module RuboCop
|
|
6
6
|
# This cop checks for class and module names with
|
7
7
|
# an underscore in them.
|
8
8
|
#
|
9
|
+
# `AllowedNames` config takes an array of permitted names.
|
10
|
+
# Its default value is `['module_parent']`.
|
11
|
+
# These names can be full class/module names or part of the name.
|
12
|
+
# eg. Adding `my_class` to the `AllowedNames` config will allow names like
|
13
|
+
# `my_class`, `my_class::User`, `App::my_class`, `App::my_class::User`, etc.
|
14
|
+
#
|
9
15
|
# @example
|
10
16
|
# # bad
|
11
17
|
# class My_Class
|
@@ -18,11 +24,15 @@ module RuboCop
|
|
18
24
|
# end
|
19
25
|
# module MyModule
|
20
26
|
# end
|
27
|
+
# class module_parent::MyModule
|
28
|
+
# end
|
21
29
|
class ClassAndModuleCamelCase < Cop
|
22
30
|
MSG = 'Use CamelCase for classes and modules.'
|
23
31
|
|
24
32
|
def on_class(node)
|
25
|
-
|
33
|
+
allowed = /#{cop_config['AllowedNames'].join('|')}/
|
34
|
+
name = node.loc.name.source.gsub(allowed, '')
|
35
|
+
return unless /_/.match?(name)
|
26
36
|
|
27
37
|
add_offense(node, location: :name)
|
28
38
|
end
|
@@ -49,25 +49,36 @@ module RuboCop
|
|
49
49
|
|
50
50
|
def for_bad_filename(file_path)
|
51
51
|
basename = File.basename(file_path)
|
52
|
-
msg = if filename_good?(basename)
|
53
|
-
return if matching_definition?(file_path)
|
54
52
|
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
if filename_good?(basename)
|
54
|
+
msg = perform_class_and_module_naming_checks(file_path, basename)
|
55
|
+
else
|
56
|
+
msg = other_message(basename) unless bad_filename_allowed?
|
57
|
+
end
|
58
58
|
|
59
|
-
|
60
|
-
|
59
|
+
yield source_range(processed_source.buffer, 1, 0), msg if msg
|
60
|
+
end
|
61
61
|
|
62
|
-
|
62
|
+
def perform_class_and_module_naming_checks(file_path, basename)
|
63
|
+
return unless expect_matching_definition?
|
64
|
+
|
65
|
+
if check_definition_path_hierarchy? &&
|
66
|
+
!matching_definition?(file_path)
|
67
|
+
msg = no_definition_message(basename, file_path)
|
68
|
+
elsif !matching_class?(basename)
|
69
|
+
msg = no_definition_message(basename, basename)
|
70
|
+
end
|
71
|
+
msg
|
63
72
|
end
|
64
73
|
|
65
74
|
def matching_definition?(file_path)
|
66
|
-
return true unless expect_matching_definition?
|
67
|
-
|
68
75
|
find_class_or_module(processed_source.ast, to_namespace(file_path))
|
69
76
|
end
|
70
77
|
|
78
|
+
def matching_class?(file_name)
|
79
|
+
find_class_or_module(processed_source.ast, to_namespace(file_name))
|
80
|
+
end
|
81
|
+
|
71
82
|
def bad_filename_allowed?
|
72
83
|
ignore_executable_scripts? && processed_source.start_with?('#!')
|
73
84
|
end
|
@@ -94,6 +105,10 @@ module RuboCop
|
|
94
105
|
cop_config['ExpectMatchingDefinition']
|
95
106
|
end
|
96
107
|
|
108
|
+
def check_definition_path_hierarchy?
|
109
|
+
cop_config['CheckDefinitionPathHierarchy']
|
110
|
+
end
|
111
|
+
|
97
112
|
def regex
|
98
113
|
cop_config['Regex']
|
99
114
|
end
|
@@ -104,7 +119,7 @@ module RuboCop
|
|
104
119
|
|
105
120
|
def filename_good?(basename)
|
106
121
|
basename = basename.sub(/^\./, '')
|
107
|
-
basename = basename.sub(/\.[
|
122
|
+
basename = basename.sub(/\.[^.]+$/, '')
|
108
123
|
# special handling for Action Pack Variants file names like
|
109
124
|
# some_file.xlsx+mobile.axlsx
|
110
125
|
basename = basename.sub('+', '_')
|
@@ -67,7 +67,7 @@ module RuboCop
|
|
67
67
|
private
|
68
68
|
|
69
69
|
def allowed_method_name?(method_name, prefix)
|
70
|
-
!method_name.match(/^#{prefix}[^0-9]/) ||
|
70
|
+
!method_name.match?(/^#{prefix}[^0-9]/) ||
|
71
71
|
method_name == expected_name(method_name, prefix) ||
|
72
72
|
method_name.end_with?('=') ||
|
73
73
|
allowed_methods.include?(method_name)
|
data/lib/rubocop/cop/registry.rb
CHANGED
@@ -22,34 +22,42 @@ module RuboCop
|
|
22
22
|
|
23
23
|
# Registry that tracks all cops by their badge and department.
|
24
24
|
class Registry
|
25
|
+
include Enumerable
|
26
|
+
|
27
|
+
attr_reader :options
|
28
|
+
|
25
29
|
def initialize(cops = [], options = {})
|
26
30
|
@registry = {}
|
27
31
|
@departments = {}
|
28
32
|
@cops_by_cop_name = Hash.new { |hash, key| hash[key] = [] }
|
29
33
|
|
30
|
-
|
34
|
+
@enrollment_queue = cops
|
31
35
|
@options = options
|
32
36
|
end
|
33
37
|
|
34
38
|
def enlist(cop)
|
35
|
-
@
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
+
@enrollment_queue << cop
|
40
|
+
end
|
41
|
+
|
42
|
+
def dismiss(cop)
|
43
|
+
raise "Cop #{cop} could not be dismissed" unless @enrollment_queue.delete(cop)
|
39
44
|
end
|
40
45
|
|
41
46
|
# @return [Array<Symbol>] list of departments for current cops.
|
42
47
|
def departments
|
48
|
+
clear_enrollment_queue
|
43
49
|
@departments.keys
|
44
50
|
end
|
45
51
|
|
46
52
|
# @return [Registry] Cops for that specific department.
|
47
53
|
def with_department(department)
|
54
|
+
clear_enrollment_queue
|
48
55
|
with(@departments.fetch(department, []))
|
49
56
|
end
|
50
57
|
|
51
58
|
# @return [Registry] Cops not for a specific department.
|
52
59
|
def without_department(department)
|
60
|
+
clear_enrollment_queue
|
53
61
|
without_department = @departments.dup
|
54
62
|
without_department.delete(department)
|
55
63
|
|
@@ -112,11 +120,14 @@ module RuboCop
|
|
112
120
|
|
113
121
|
def print_warning(name, path)
|
114
122
|
message = "#{path}: Warning: no department given for #{name}."
|
115
|
-
|
123
|
+
if path.end_with?('.rb')
|
124
|
+
message += ' Run `rubocop -a --only Migration/DepartmentName` to fix.'
|
125
|
+
end
|
116
126
|
warn message
|
117
127
|
end
|
118
128
|
|
119
129
|
def unqualified_cop_names
|
130
|
+
clear_enrollment_queue
|
120
131
|
@unqualified_cop_names ||=
|
121
132
|
Set.new(@cops_by_cop_name.keys.map { |qn| File.basename(qn) }) <<
|
122
133
|
'RedundantCopDisableDirective'
|
@@ -124,18 +135,21 @@ module RuboCop
|
|
124
135
|
|
125
136
|
# @return [Hash{String => Array<Class>}]
|
126
137
|
def to_h
|
138
|
+
clear_enrollment_queue
|
127
139
|
@cops_by_cop_name
|
128
140
|
end
|
129
141
|
|
130
142
|
def cops
|
143
|
+
clear_enrollment_queue
|
131
144
|
@registry.values
|
132
145
|
end
|
133
146
|
|
134
147
|
def length
|
148
|
+
clear_enrollment_queue
|
135
149
|
@registry.size
|
136
150
|
end
|
137
151
|
|
138
|
-
def enabled(config, only, only_safe = false)
|
152
|
+
def enabled(config, only = [], only_safe = false)
|
139
153
|
select do |cop|
|
140
154
|
only.include?(cop.cop_name) || enabled?(cop, config, only_safe)
|
141
155
|
end
|
@@ -170,6 +184,7 @@ module RuboCop
|
|
170
184
|
end
|
171
185
|
|
172
186
|
def sort!
|
187
|
+
clear_enrollment_queue
|
173
188
|
@registry = Hash[@registry.sort_by { |badge, _| badge.cop_name }]
|
174
189
|
|
175
190
|
self
|
@@ -186,16 +201,57 @@ module RuboCop
|
|
186
201
|
# @param [String] cop_name
|
187
202
|
# @return [Class, nil]
|
188
203
|
def find_by_cop_name(cop_name)
|
189
|
-
|
204
|
+
to_h[cop_name].first
|
205
|
+
end
|
206
|
+
|
207
|
+
@global = new
|
208
|
+
|
209
|
+
class << self
|
210
|
+
attr_reader :global
|
211
|
+
end
|
212
|
+
|
213
|
+
def self.all
|
214
|
+
global.without_department(:Test).cops
|
215
|
+
end
|
216
|
+
|
217
|
+
def self.qualified_cop_name(name, origin)
|
218
|
+
global.qualified_cop_name(name, origin)
|
219
|
+
end
|
220
|
+
|
221
|
+
# Changes momentarily the global registry
|
222
|
+
# Intended for testing purposes
|
223
|
+
def self.with_temporary_global(temp_global = global.dup)
|
224
|
+
previous = @global
|
225
|
+
@global = temp_global
|
226
|
+
yield
|
227
|
+
ensure
|
228
|
+
@global = previous
|
190
229
|
end
|
191
230
|
|
192
231
|
private
|
193
232
|
|
233
|
+
def initialize_copy(reg)
|
234
|
+
initialize(reg.cops, reg.options)
|
235
|
+
end
|
236
|
+
|
237
|
+
def clear_enrollment_queue
|
238
|
+
return if @enrollment_queue.empty?
|
239
|
+
|
240
|
+
@enrollment_queue.each do |cop|
|
241
|
+
@registry[cop.badge] = cop
|
242
|
+
@departments[cop.department] ||= []
|
243
|
+
@departments[cop.department] << cop
|
244
|
+
@cops_by_cop_name[cop.cop_name] << cop
|
245
|
+
end
|
246
|
+
@enrollment_queue = []
|
247
|
+
end
|
248
|
+
|
194
249
|
def with(cops)
|
195
250
|
self.class.new(cops)
|
196
251
|
end
|
197
252
|
|
198
253
|
def qualify_badge(badge)
|
254
|
+
clear_enrollment_queue
|
199
255
|
@departments
|
200
256
|
.map { |department, _| badge.with_department(department) }
|
201
257
|
.select { |potential_badge| registered?(potential_badge) }
|
@@ -212,6 +268,7 @@ module RuboCop
|
|
212
268
|
end
|
213
269
|
|
214
270
|
def registered?(badge)
|
271
|
+
clear_enrollment_queue
|
215
272
|
@registry.key?(badge)
|
216
273
|
end
|
217
274
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module RuboCop
|
4
4
|
module Cop
|
5
5
|
module Style
|
6
|
-
# This cop checks for uses of "
|
6
|
+
# This cop checks for uses of "*" as a substitute for _join_.
|
7
7
|
#
|
8
8
|
# Not all cases can reliably checked, due to Ruby's dynamic
|
9
9
|
# types, so we consider only cases when the first argument is an
|
@@ -8,8 +8,8 @@ module RuboCop
|
|
8
8
|
# The default regexp for an acceptable copyright notice can be found in
|
9
9
|
# config/default.yml. The default can be changed as follows:
|
10
10
|
#
|
11
|
-
#
|
12
|
-
#
|
11
|
+
# Style/Copyright:
|
12
|
+
# Notice: '^Copyright (\(c\) )?2\d{3} Acme Inc'
|
13
13
|
#
|
14
14
|
# This regex string is treated as an unanchored regex. For each file
|
15
15
|
# that RuboCop scans, a comment that matches this regex must be found or
|
@@ -8,7 +8,7 @@ module RuboCop
|
|
8
8
|
# line (compact style), but it can be configured to enforce the `end`
|
9
9
|
# to go on its own line (expanded style).
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# NOTE: A method definition is not considered empty if it contains
|
12
12
|
# comments.
|
13
13
|
#
|
14
14
|
# @example EnforcedStyle: compact (default)
|
@@ -5,12 +5,12 @@ module RuboCop
|
|
5
5
|
module Style
|
6
6
|
# This cop enforces consistency when using exponential notation
|
7
7
|
# for numbers in the code (eg 1.2e4). Different styles are supported:
|
8
|
-
#
|
8
|
+
# * `scientific` which enforces a mantissa between 1 (inclusive)
|
9
9
|
# and 10 (exclusive).
|
10
|
-
#
|
10
|
+
# * `engineering` which enforces the exponent to be a multiple of 3
|
11
11
|
# and the mantissa to be between 0.1 (inclusive)
|
12
12
|
# and 10 (exclusive).
|
13
|
-
#
|
13
|
+
# * `integral` which enforces the mantissa to always be a whole number
|
14
14
|
# without trailing zeroes.
|
15
15
|
#
|
16
16
|
# @example EnforcedStyle: scientific (default)
|
@@ -5,11 +5,10 @@ module RuboCop
|
|
5
5
|
module Style
|
6
6
|
# Use a consistent style for named format string tokens.
|
7
7
|
#
|
8
|
-
#
|
9
|
-
# `unannotated` style cop only works for strings
|
8
|
+
# NOTE: `unannotated` style cop only works for strings
|
10
9
|
# which are passed as arguments to those methods:
|
11
10
|
# `printf`, `sprintf`, `format`, `%`.
|
12
|
-
# The reason is that
|
11
|
+
# The reason is that _unannotated_ format is very similar
|
13
12
|
# to encoded URLs or Date/Time formatting strings.
|
14
13
|
#
|
15
14
|
# @example EnforcedStyle: annotated (default)
|
@@ -8,8 +8,7 @@ module RuboCop
|
|
8
8
|
# It will add the comment `# frozen_string_literal: true` to the top of
|
9
9
|
# files to enable frozen string literals. Frozen string literals may be
|
10
10
|
# default in future Ruby. The comment will be added below a shebang and
|
11
|
-
# encoding comment.
|
12
|
-
# Ruby 2.3+.
|
11
|
+
# encoding comment.
|
13
12
|
#
|
14
13
|
# Note that the cop will ignore files where the comment exists but is set
|
15
14
|
# to `false` instead of `true`.
|