rubocop-i18n 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +4 -0
- data/lib/rubocop/cop/i18n/gettext/decorate_function_message.rb +3 -0
- data/lib/rubocop/cop/i18n/gettext/decorate_string_formatting_using_interpolation.rb +2 -0
- data/lib/rubocop/cop/i18n/gettext/decorate_string_formatting_using_percent.rb +2 -0
- data/lib/rubocop/rspec/cop_helper.rb +4 -0
- data/rubocop-i18n.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05f242d66df11b40d7d4e4e33bb98ae8be347062
|
4
|
+
data.tar.gz: b9e07ef3ce86a5c34f409620a2ce3eae4917341b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4afff3c8a1d356f37de79fd59c34a2ed4ad8e977692d888c265791ca180779c8145012b70c8b542fc251c68f1325a7370c729d9180b31c233f40fea623fcd82
|
7
|
+
data.tar.gz: da4a2892bb9a3450475afc776d435eae64f0be2766b3b5f061d824adc39dd9512e458555b018992f6222c4452b9445b82c52969985bb6447999e26ed8f1c555f
|
data/.rubocop_todo.yml
CHANGED
@@ -6,6 +6,7 @@ module RuboCop
|
|
6
6
|
def on_send(node)
|
7
7
|
method_name = node.loc.selector.source
|
8
8
|
return unless GetText.supported_method?(method_name)
|
9
|
+
|
9
10
|
_, method_name, *arg_nodes = *node
|
10
11
|
if !arg_nodes.empty? && !already_decorated?(node) && (contains_string?(arg_nodes) || string_constant?(arg_nodes))
|
11
12
|
message_section = if string_constant?(arg_nodes)
|
@@ -51,6 +52,7 @@ module RuboCop
|
|
51
52
|
def detect_and_report(_node, message_section, method_name)
|
52
53
|
errors = how_bad_is_it(message_section)
|
53
54
|
return if errors.empty?
|
55
|
+
|
54
56
|
error_message = "'#{method_name}' function, "
|
55
57
|
errors.each do |error|
|
56
58
|
error_message << 'message string should be decorated. ' if error == :simple
|
@@ -115,6 +117,7 @@ module RuboCop
|
|
115
117
|
# dstrs are split into "str" segments and other segments.
|
116
118
|
# The "other" segments are the interpolated values.
|
117
119
|
next unless child.begin_type?
|
120
|
+
|
118
121
|
value = child.children[0]
|
119
122
|
hash_key = 'value'
|
120
123
|
if value.lvar_type?
|
@@ -24,6 +24,7 @@ module RuboCop
|
|
24
24
|
def on_send(node)
|
25
25
|
decorator_name = node.loc.selector.source
|
26
26
|
return unless GetText.supported_decorator?(decorator_name)
|
27
|
+
|
27
28
|
_, method_name, *arg_nodes = *node
|
28
29
|
if !arg_nodes.empty? && contains_string_formatting_with_interpolation?(arg_nodes)
|
29
30
|
message_section = arg_nodes[0]
|
@@ -51,6 +52,7 @@ module RuboCop
|
|
51
52
|
if node.respond_to?(:children)
|
52
53
|
return node.children.any? { |child| contains_string_formatting_with_interpolation?(child) }
|
53
54
|
end
|
55
|
+
|
54
56
|
false
|
55
57
|
end
|
56
58
|
end
|
@@ -27,6 +27,7 @@ module RuboCop
|
|
27
27
|
def on_send(node)
|
28
28
|
decorator_name = node.loc.selector.source
|
29
29
|
return unless GetText.supported_decorator?(decorator_name)
|
30
|
+
|
30
31
|
_, method_name, *arg_nodes = *node
|
31
32
|
if !arg_nodes.empty? && contains_string_with_percent_format?(arg_nodes)
|
32
33
|
message_section = arg_nodes[0]
|
@@ -54,6 +55,7 @@ module RuboCop
|
|
54
55
|
if node.respond_to?(:children)
|
55
56
|
return node.children.any? { |child| contains_string_with_percent_format?(child) }
|
56
57
|
end
|
58
|
+
|
57
59
|
false
|
58
60
|
end
|
59
61
|
end
|
@@ -22,10 +22,12 @@ module CopHelper
|
|
22
22
|
if source.is_a?(Array) && source.size == 1
|
23
23
|
raise "Don't use an array for a single line of code: #{source}"
|
24
24
|
end
|
25
|
+
|
25
26
|
RuboCop::Formatter::DisabledConfigFormatter.config_to_allow_offenses = {}
|
26
27
|
RuboCop::Formatter::DisabledConfigFormatter.detected_styles = {}
|
27
28
|
processed_source = parse_source(source, file)
|
28
29
|
raise 'Error parsing example code' unless processed_source.valid_syntax?
|
30
|
+
|
29
31
|
_investigate(cop, processed_source)
|
30
32
|
end
|
31
33
|
|
@@ -60,6 +62,7 @@ module CopHelper
|
|
60
62
|
cop.instance_variable_set(:@corrections, [])
|
61
63
|
new_source = autocorrect_source(source, file)
|
62
64
|
return new_source if new_source == source
|
65
|
+
|
63
66
|
source = new_source
|
64
67
|
end
|
65
68
|
end
|
@@ -67,6 +70,7 @@ module CopHelper
|
|
67
70
|
def _investigate(cop, processed_source)
|
68
71
|
forces = RuboCop::Cop::Force.all.each_with_object([]) do |klass, instances|
|
69
72
|
next unless cop.join_force?(klass)
|
73
|
+
|
70
74
|
instances << klass.new([cop])
|
71
75
|
end
|
72
76
|
|
data/rubocop-i18n.gemspec
CHANGED
@@ -4,7 +4,7 @@ rubocop_version = '~> 0.51'
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'rubocop-i18n'
|
7
|
-
spec.version = '1.3.
|
7
|
+
spec.version = '1.3.1'
|
8
8
|
spec.authors = ['Puppet', 'Brandon High', 'TP Honey', 'Helen Campbell']
|
9
9
|
spec.email = ['team-modules@puppet.com', 'brandon.high@puppet.com', 'tp@puppet.com', 'helen@puppet.com']
|
10
10
|
|