rubocop-i18n 3.1.0 → 3.2.0
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/.gitignore +2 -0
- data/.rubocop.yml +4 -3
- data/.rubocop_todo.yml +9 -1
- data/CHANGELOG.md +4 -0
- data/README.md +8 -4
- data/lib/rubocop/cop/i18n/gettext/decorate_string.rb +1 -1
- data/lib/rubocop/cop/i18n/gettext/decorate_string_formatting_using_interpolation.rb +1 -1
- data/lib/rubocop/cop/i18n/gettext/decorate_string_formatting_using_percent.rb +1 -1
- data/lib/rubocop/cop/i18n/rails_i18n/decorate_string.rb +1 -1
- data/lib/rubocop/cop/i18n/rails_i18n/decorate_string_formatting_using_interpolation.rb +1 -1
- data/lib/rubocop/i18n/plugin.rb +31 -0
- data/lib/rubocop/i18n.rb +0 -4
- data/lib/rubocop-i18n.rb +1 -4
- data/rubocop-i18n.gemspec +6 -4
- metadata +21 -7
- data/.ruby-version +0 -1
- data/lib/rubocop/i18n/inject.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40440c74a9f3245bc18bc95f36f3fddc4512249611f680ba0a8a8ee3027411a0
|
4
|
+
data.tar.gz: f4c16aa614332d0f7938deaee0feedfc6d13bbca695f54a42147aa6911d5226b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06b836f7100a74801a7d3f3c46e2df2a9d620fad44bc5279b92ec3e1748daa1d7b938cdbf496b00f4b8edd541c0d44e3c704720990ebf746f031fc8707b69d94
|
7
|
+
data.tar.gz: 0cc9e35e18192a913138a20f442e5f8bbb927aab67caa6a1b381df27e2b126792db86cd21e6842ce76dac165a526416aa27fca447b91d507eb5b722df2c735b4
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
2
|
-
|
3
|
-
|
2
|
+
|
3
|
+
plugins:
|
4
|
+
- rubocop-internal_affairs
|
4
5
|
- rubocop-rake
|
5
6
|
- rubocop-rspec
|
6
7
|
- rubocop-performance
|
7
8
|
|
8
9
|
AllCops:
|
9
|
-
TargetRubyVersion: 2.
|
10
|
+
TargetRubyVersion: 2.7
|
10
11
|
NewCops: enable
|
11
12
|
|
12
13
|
# rubocop-i18n does not have config/default.
|
data/.rubocop_todo.yml
CHANGED
@@ -1,11 +1,19 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2025-01-
|
3
|
+
# on 2025-01-23 02:17:39 UTC using RuboCop version 1.71.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
+
# Offense count: 4
|
10
|
+
InternalAffairs/OnSendWithoutOnCSend:
|
11
|
+
Exclude:
|
12
|
+
- 'lib/rubocop/cop/i18n/gettext/decorate_function_message.rb'
|
13
|
+
- 'lib/rubocop/cop/i18n/gettext/decorate_string_formatting_using_interpolation.rb'
|
14
|
+
- 'lib/rubocop/cop/i18n/gettext/decorate_string_formatting_using_percent.rb'
|
15
|
+
- 'lib/rubocop/cop/i18n/rails_i18n/decorate_string_formatting_using_interpolation.rb'
|
16
|
+
|
9
17
|
# Offense count: 1
|
10
18
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
11
19
|
Lint/InterpolationCheck:
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
### [master (Unreleased)](https://github.com/rubocop/rubocop-i18n/compare/v3.1.0...master)
|
4
4
|
|
5
|
+
### [3.2.0](https://github.com/rubocop/rubocop-i18n/compare/v3.1.0...v3.2.0)
|
6
|
+
|
7
|
+
* Pluginfy rubocop-i18n (#65)
|
8
|
+
|
5
9
|
### [3.1.0](https://github.com/rubocop/rubocop-i18n/compare/v3.0.0...v3.1.0)
|
6
10
|
|
7
11
|
* Transfer ownership of rubocop-i18n from puppetlabs org to rubocop org (#62)
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Rubocop::I18n
|
2
2
|
|
3
|
-
[](https://github.com/rubocop/rubocop-i18n/actions/workflows/rubocop.yml)
|
4
4
|
|
5
5
|
A set of cops for detecting strings that need i18n decoration in your project.
|
6
6
|
|
@@ -28,8 +28,9 @@ Or install it yourself as:
|
|
28
28
|
## Usage
|
29
29
|
|
30
30
|
In your `rubocop.yml`:
|
31
|
-
|
32
|
-
|
31
|
+
|
32
|
+
```yaml
|
33
|
+
plugins:
|
33
34
|
- rubocop-i18n
|
34
35
|
...
|
35
36
|
# You *must* choose GetText or Rails-i18n style checking
|
@@ -58,6 +59,9 @@ I18n/RailsI18n/DecorateString:
|
|
58
59
|
Enabled: false
|
59
60
|
```
|
60
61
|
|
62
|
+
> [!NOTE]
|
63
|
+
> The plugin system is supported in RuboCop 1.72+. In earlier versions, use `require` instead of `plugins`.
|
64
|
+
|
61
65
|
## Cops
|
62
66
|
|
63
67
|
### I18n/GetText/DecorateString
|
@@ -331,4 +335,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
331
335
|
|
332
336
|
## Contributing
|
333
337
|
|
334
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/rubocop/rubocop-i18n. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [
|
338
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rubocop/rubocop-i18n. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [RuboCop Community Code of Conduct](CODE_OF_CONDUCT.md).
|
@@ -44,7 +44,7 @@ module RuboCop
|
|
44
44
|
def contains_string_formatting_with_interpolation?(node)
|
45
45
|
return node.any? { |n| contains_string_formatting_with_interpolation?(n) } if node.is_a?(Array)
|
46
46
|
|
47
|
-
return string_contains_interpolation_format?(node.source) if node.respond_to?(:type) &&
|
47
|
+
return string_contains_interpolation_format?(node.source) if node.respond_to?(:type) && node.type?(:str, :dstr)
|
48
48
|
|
49
49
|
return node.children.any? { |child| contains_string_formatting_with_interpolation?(child) } if node.respond_to?(:children)
|
50
50
|
|
@@ -48,7 +48,7 @@ module RuboCop
|
|
48
48
|
def contains_string_formatting_with_interpolation?(node)
|
49
49
|
return node.any? { |n| contains_string_formatting_with_interpolation?(n) } if node.is_a?(Array)
|
50
50
|
|
51
|
-
return string_contains_interpolation_format?(node.source) if node.respond_to?(:type) &&
|
51
|
+
return string_contains_interpolation_format?(node.source) if node.respond_to?(:type) && node.type?(:str, :dstr)
|
52
52
|
|
53
53
|
return node.children.any? { |child| contains_string_formatting_with_interpolation?(child) } if node.respond_to?(:children)
|
54
54
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'lint_roller'
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module I18n
|
7
|
+
# A plugin that integrates rubocop-i18n with RuboCop's plugin system.
|
8
|
+
class Plugin < LintRoller::Plugin
|
9
|
+
def about
|
10
|
+
LintRoller::About.new(
|
11
|
+
name: 'rubocop-i18n',
|
12
|
+
version: Version::STRING,
|
13
|
+
homepage: 'https://github.com/rubocop/rubocop-i18n',
|
14
|
+
description: 'RuboCop rules for i18n.'
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
def supported?(context)
|
19
|
+
context.engine == :rubocop
|
20
|
+
end
|
21
|
+
|
22
|
+
def rules(_context)
|
23
|
+
LintRoller::Rules.new(
|
24
|
+
type: :path,
|
25
|
+
config_format: :rubocop,
|
26
|
+
value: Pathname.new(__dir__).join('../../../config/default.yml')
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/rubocop/i18n.rb
CHANGED
@@ -3,9 +3,5 @@
|
|
3
3
|
module RuboCop
|
4
4
|
# RuboCop I18n project namespace
|
5
5
|
module I18n
|
6
|
-
PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
|
7
|
-
CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
|
8
|
-
|
9
|
-
private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
|
10
6
|
end
|
11
7
|
end
|
data/lib/rubocop-i18n.rb
CHANGED
data/rubocop-i18n.gemspec
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'rubocop-i18n'
|
8
|
-
spec.version = '3.
|
8
|
+
spec.version = '3.2.0'
|
9
9
|
spec.authors = ['Puppet', 'Brandon High', 'TP Honey', 'Helen Campbell']
|
10
10
|
|
11
11
|
spec.summary = 'RuboCop rules for i18n'
|
@@ -20,11 +20,13 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.required_ruby_version = '>= 2.
|
23
|
+
spec.required_ruby_version = '>= 2.7.0'
|
24
24
|
|
25
25
|
spec.metadata = {
|
26
|
-
'rubygems_mfa_required' => 'true'
|
26
|
+
'rubygems_mfa_required' => 'true',
|
27
|
+
'default_lint_roller_plugin' => 'RuboCop::I18n::Plugin'
|
27
28
|
}
|
28
29
|
|
29
|
-
spec.add_dependency '
|
30
|
+
spec.add_dependency 'lint_roller', '~> 1.1'
|
31
|
+
spec.add_dependency 'rubocop', '~> 1.72.1'
|
30
32
|
end
|
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: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
@@ -10,22 +10,36 @@ authors:
|
|
10
10
|
- Helen Campbell
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2025-
|
13
|
+
date: 2025-02-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: lint_roller
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.1'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '1.1'
|
15
29
|
- !ruby/object:Gem::Dependency
|
16
30
|
name: rubocop
|
17
31
|
requirement: !ruby/object:Gem::Requirement
|
18
32
|
requirements:
|
19
33
|
- - "~>"
|
20
34
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
35
|
+
version: 1.72.1
|
22
36
|
type: :runtime
|
23
37
|
prerelease: false
|
24
38
|
version_requirements: !ruby/object:Gem::Requirement
|
25
39
|
requirements:
|
26
40
|
- - "~>"
|
27
41
|
- !ruby/object:Gem::Version
|
28
|
-
version:
|
42
|
+
version: 1.72.1
|
29
43
|
description: RuboCop rules for detecting and autocorrecting undecorated strings for
|
30
44
|
i18n (gettext and rails-i18n)
|
31
45
|
executables: []
|
@@ -39,7 +53,6 @@ files:
|
|
39
53
|
- ".rspec"
|
40
54
|
- ".rubocop.yml"
|
41
55
|
- ".rubocop_todo.yml"
|
42
|
-
- ".ruby-version"
|
43
56
|
- CHANGELOG.md
|
44
57
|
- CODE_OF_CONDUCT.md
|
45
58
|
- Gemfile
|
@@ -60,13 +73,14 @@ files:
|
|
60
73
|
- lib/rubocop/cop/i18n/rails_i18n/decorate_string_formatting_using_interpolation.rb
|
61
74
|
- lib/rubocop/cop/i18n_cops.rb
|
62
75
|
- lib/rubocop/i18n.rb
|
63
|
-
- lib/rubocop/i18n/
|
76
|
+
- lib/rubocop/i18n/plugin.rb
|
64
77
|
- rubocop-i18n.gemspec
|
65
78
|
homepage: https://github.com/rubocop/rubocop-i18n
|
66
79
|
licenses:
|
67
80
|
- Apache-2.0
|
68
81
|
metadata:
|
69
82
|
rubygems_mfa_required: 'true'
|
83
|
+
default_lint_roller_plugin: RuboCop::I18n::Plugin
|
70
84
|
rdoc_options: []
|
71
85
|
require_paths:
|
72
86
|
- lib
|
@@ -74,7 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
88
|
requirements:
|
75
89
|
- - ">="
|
76
90
|
- !ruby/object:Gem::Version
|
77
|
-
version: 2.
|
91
|
+
version: 2.7.0
|
78
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - ">="
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
3.4.1
|
data/lib/rubocop/i18n/inject.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module I18n
|
5
|
-
# Because RuboCop doesn't yet support plugins, we have to monkey patch in a
|
6
|
-
# bit of our configuration.
|
7
|
-
module Inject
|
8
|
-
def self.defaults!
|
9
|
-
path = CONFIG_DEFAULT.to_s
|
10
|
-
hash = ConfigLoader.send(:load_yaml_configuration, path)
|
11
|
-
config = RuboCop::Config.new(hash, path)
|
12
|
-
puts "configuration from #{path}" if ConfigLoader.debug?
|
13
|
-
config = ConfigLoader.merge_with_default(config, path)
|
14
|
-
ConfigLoader.instance_variable_set(:@default_configuration, config)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|