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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1519b7393133fbbd4edcc8aa1fdeaa46bd93155b
4
- data.tar.gz: 2e16dc911733af1dc139d31b69c383b226c3db51
3
+ metadata.gz: 05f242d66df11b40d7d4e4e33bb98ae8be347062
4
+ data.tar.gz: b9e07ef3ce86a5c34f409620a2ce3eae4917341b
5
5
  SHA512:
6
- metadata.gz: 9f2110409579d9d8eae8d3d5501a841d6b75dae69b66048563808bb4ed40391256360d48c8700851979d32bf171757469429f5d3a98c7f0a26c4b879ac71ff7d
7
- data.tar.gz: 8b1fde24e8b0368d2e7139369e3a94e799266f3be6bbb7b79c4bd3a887118adc5c6023ade4413183791856b0dc473e305258e772a1445acb71d3438e32abfd6d
6
+ metadata.gz: c4afff3c8a1d356f37de79fd59c34a2ed4ad8e977692d888c265791ca180779c8145012b70c8b542fc251c68f1325a7370c729d9180b31c233f40fea623fcd82
7
+ data.tar.gz: da4a2892bb9a3450475afc776d435eae64f0be2766b3b5f061d824adc39dd9512e458555b018992f6222c4452b9445b82c52969985bb6447999e26ed8f1c555f
@@ -79,3 +79,7 @@ Style/IfUnlessModifier:
79
79
  # URISchemes: http, https
80
80
  Metrics/LineLength:
81
81
  Max: 174
82
+
83
+ Naming/FileName:
84
+ Exclude:
85
+ - 'lib/rubocop-i18n.rb'
@@ -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
 
@@ -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.0'
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-i18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet