i18n-hygiene 1.0.2 → 1.3.0

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
- SHA1:
3
- metadata.gz: 5196e6d4895aef84331a2d712407804f1321be69
4
- data.tar.gz: a225dd27fb0343c5e9aa5f86ba2455a125b44c69
2
+ SHA256:
3
+ metadata.gz: e3c53479923c99d76ef782d6fc7fd8db7644eae5263f6059fcfd361147089828
4
+ data.tar.gz: c9286746cd56eb8f66ad1d94e6870c2052ca4e5f7e7470f9a146b8d6a38a6b38
5
5
  SHA512:
6
- metadata.gz: 5d7e1602574e4017cbdc3bd2f694f8ec04278054b9579e31f931ea2bfb096952dfc718ae98f3e6f39febe1a5df78576ea565638b575be9f97452ee5263cc9dc4
7
- data.tar.gz: 697c135a5c377d3e580abd6f6fab084f891676b1b5181a444fbe8dfa7252cc3928b1dc2145fab3f525c1fb1576cfebeb97af2f5816cb707c0e8ff74f1616adca
6
+ metadata.gz: 7e3c45056abed66828c1f3ffd496792e38e5377ebb839508814cad070bc1fd0a14948976de6c4100232333cdd8629ac5cb5dccb5517e8594d05c386f758df425
7
+ data.tar.gz: c778a7c457e99a3d268bfea8dd5cd9be9e4c76db146012887a938904e6189d86f0287a23339855b739dfc1e6d572a400c771f2d5a5fb45d9a9621328f205f990
@@ -11,7 +11,10 @@ module I18n
11
11
  # Looks for translations which are missing interpolation variables.
12
12
  class MissingInterpolationVariable < Base
13
13
  def run
14
- wrapper = I18n::Hygiene::Wrapper.new(exclude_scopes: config.exclude_scopes)
14
+ wrapper = I18n::Hygiene::Wrapper.new(
15
+ exclude_keys: config.exclude_keys,
16
+ exclude_scopes: config.exclude_scopes
17
+ )
15
18
 
16
19
  wrapper.keys_to_check(config.primary_locale).select do |key|
17
20
  checker = I18n::Hygiene::VariableChecker.new(key, wrapper, config.primary_locale, config.locales)
@@ -8,7 +8,7 @@ module I18n
8
8
  @exclude_files = exclude_files
9
9
  @file_extensions = file_extensions
10
10
 
11
- raise "Must have git installed!" unless system("which git > /dev/null")
11
+ raise "Must have grep installed!" unless system("which grep > /dev/null")
12
12
  end
13
13
 
14
14
  def used?(key)
@@ -21,32 +21,22 @@ module I18n
21
21
  if pluralized_key_used?(key)
22
22
  fully_qualified_key_used?(without_last_part(key))
23
23
  else
24
- %x<git grep #{key} #{git_grep_options} | wc -l>.strip.to_i > 0
24
+ directories = @directories.join(" ")
25
+ include_argument = @file_extensions.map { |extension| "--include=\"*.#{extension}\"" }.join(" ")
26
+ exclude_argument = @exclude_files.map { |file| "--exclude=\"#{file}\"" }.join(" ")
27
+
28
+ grep_command = [
29
+ "grep --recursive",
30
+ key,
31
+ include_argument,
32
+ exclude_argument,
33
+ directories
34
+ ].reject(&:empty?).join(" ")
35
+
36
+ %x<#{grep_command} | wc -l>.strip.to_i > 0
25
37
  end
26
38
  end
27
39
 
28
- def git_grep_options
29
- [git_grep_include, git_grep_exclude].reject(&:empty?).join(" ")
30
- end
31
-
32
- def git_grep_include
33
- @directories.map { |dir|
34
- if @file_extensions.empty?
35
- dir
36
- else
37
- @file_extensions.map { |ext|
38
- "'#{dir}/*.#{ext}'"
39
- }
40
- end
41
- }.flatten.join(" ")
42
- end
43
-
44
- def git_grep_exclude
45
- @exclude_files.map { |file|
46
- "':(exclude)*#{file}'"
47
- }.join(" ")
48
- end
49
-
50
40
  def pluralized_key_used?(key)
51
41
  [ "zero", "one", "other" ].include?(key.split(".").last)
52
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-hygiene
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eleanor Kiefel Haggerty
@@ -10,28 +10,28 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-10-26 00:00:00.000000000 Z
13
+ date: 2022-02-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: i18n
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - "~>"
20
- - !ruby/object:Gem::Version
21
- version: '0.6'
22
19
  - - ">="
23
20
  - !ruby/object:Gem::Version
24
21
  version: 0.6.9
22
+ - - "<"
23
+ - !ruby/object:Gem::Version
24
+ version: '2'
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
28
28
  requirements:
29
- - - "~>"
30
- - !ruby/object:Gem::Version
31
- version: '0.6'
32
29
  - - ">="
33
30
  - !ruby/object:Gem::Version
34
31
  version: 0.6.9
32
+ - - "<"
33
+ - !ruby/object:Gem::Version
34
+ version: '2'
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: parallel
37
37
  requirement: !ruby/object:Gem::Requirement
@@ -158,8 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  requirements: []
161
- rubyforge_project:
162
- rubygems_version: 2.6.13
161
+ rubygems_version: 3.1.6
163
162
  signing_key:
164
163
  specification_version: 4
165
164
  summary: A linter for translation data in ruby applications