danger-localizationlinter 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a4afdaf597ba934bea40d09e3b0fd3648a224466512c2c24b676093cce3ee40
4
- data.tar.gz: 4c69e69f4e56d1eaf50933469c97c18522b5d4db9347a1a3551144b75eeb4fe1
3
+ metadata.gz: ceb9d92872f544b3fa2e93706e8db77f41768087dd5e0d1fa8b8f21c007fa8ea
4
+ data.tar.gz: ec9b6d88a7eb6c451ee786c504efdb626216db6fb91926f7aafe9f27c56f2125
5
5
  SHA512:
6
- metadata.gz: 2a9728aa8b54a0120d00986eaa34321beb6109228f948cdff0c0c558465c7a7e0263811293c35a35cac3b302d727362887370dea1c0ec1ee5e055d17d0da48b0
7
- data.tar.gz: ba9a05927c1ef36c54386dae856b16099cd202b9052c4319d075fb2744ff1a5f563f4f12f9216c098a253e2bf8764128e17f579bb7e3911ddca66d383c56af5b
6
+ metadata.gz: c9fac08ecfc14db788cab6691d4b38d1bd246a2d5590d6a718cc0ba4f4646158f949d64154d4a1753f6253509efad3780ffbbc595bc4c91bbd50af86e38bb8c5
7
+ data.tar.gz: 4c15c67551e1538273f46f126723631875e016c96f78fb21dffdebda63800ae1d563275877cd650fb484f170424d64190b59de3aa3e2590485924491975fa748
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-localizationlinter (0.0.1)
4
+ danger-localizationlinter (0.0.3)
5
5
  danger-plugin-api (~> 1.0)
6
6
  json-diff (~> 0.4)
7
7
  xcodeproj (~> 1.19)
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # danger-localizationlinter
1
+ ### localizationlinter
2
2
 
3
3
  Verify consistency over your project localizable files (localizable.strings and Localizable.stringdict)
4
4
  It uses Swiftgen to generate a localizables output per target and language and compare the output with
@@ -8,15 +8,11 @@ Verify consistency over your project localizable files (localizable.strings and
8
8
  - additional keys
9
9
  - wrong parameters in string format
10
10
 
11
- ## Installation
12
-
13
- $ gem install danger-localizationlinter
11
+ <blockquote>Verify my project localizables consistency
12
+ <pre>localizationlinter.lint</pre>
13
+ </blockquote>
14
14
 
15
- ## Usage
16
15
 
17
- Methods and attributes from this plugin are available in your `Dangerfile` under the `localizationlinter` namespace.
18
-
19
- localizationlinter.lint
20
16
 
21
17
  #### Attributes
22
18
 
@@ -27,11 +23,13 @@ Methods and attributes from this plugin are available in your `Dangerfile` under
27
23
  `verbose` - Print execution logs
28
24
 
29
25
  `language_configuration_path` - Path to language configuration yml, defining main language per target
30
- example:
31
- My_target: en
32
- My_other_target: fr
33
-
34
- default value is Configuration/Defaults/all_target_main_language.yml
26
+ example:
27
+ ```yml
28
+ My_target: en
29
+ My_other_target: fr
30
+ ```
31
+ Default value is `Configuration/Defaults/all_target_main_language.yml`
32
+ If no file is provided, the default language for each target is `en`
35
33
 
36
34
  `swift_gen_path` - Path to swift gen, default value is Pods/SwiftGen/bin/swiftgen
37
35
 
@@ -41,6 +39,9 @@ default value is Configuration/Defaults/all_target_main_language.yml
41
39
 
42
40
  `project_path` - Path to xcode project, default is taking the first project in root folder
43
41
 
42
+
43
+
44
+
44
45
  #### Methods
45
46
 
46
47
  `lint` - Verify the localizable files integrity over the project
@@ -48,15 +49,25 @@ rubocop:disable Metrics/MethodLength
48
49
 
49
50
  `linter` - Returns the object in charge of verification
50
51
 
52
+
53
+
54
+
55
+ ## Installation
56
+
57
+ $ gem install danger-localizationlinter
58
+
59
+
60
+
61
+
51
62
  ## Development
52
63
 
53
- 1. Clone this repo
54
- 2. Run `bundle install` to setup dependencies.
55
- 3. Run `bundle exec rake spec` to run the tests.
56
- 4. Use `bundle exec guard` to automatically have tests run as you make changes.
57
- 5. Make your changes.
64
+ 1. Clone this repo
65
+ 2. Run `bundle install` to setup dependencies.
66
+ 3. Run `bundle exec rake spec` to run the tests.
67
+ 4. Use `bundle exec guard` to automatically have tests run as you make changes.
68
+ 5. Make your changes.
58
69
 
59
- To update swiftgen bin, use Test project in `spec`:
60
- 1. `cd spec/Test`
61
- 2. Open Podfile and update SwiftGen version
62
- 3. `pod update SwiftGen`
70
+ To update swiftgen bin, use Test project in `spec`:
71
+ 1. `cd spec/Test`
72
+ 2. Open Podfile and update SwiftGen version
73
+ 3. `pod update SwiftGen`
@@ -177,12 +177,14 @@ class LocalizationLinter
177
177
 
178
178
  def main_region_for_target(target)
179
179
  path = language_configuration_path
180
- return "File #{path} does not exist." unless File.exist?(path)
181
-
180
+ unless File.exist?(path)
181
+ log "Language configuration file not found, selecting default region 'en' for #{target}"
182
+ return 'en'
183
+ end
182
184
  languages = YAML.safe_load(File.read(path)) || {}
183
185
  unless languages[target]
184
- log "Missing main region for #{target} in file #{path}, put the same one as in Swiftgen Localizables build phase"
185
- return nil
186
+ log "Language configuration file not found, selecting default region 'en' for #{target}"
187
+ return 'en'
186
188
  end
187
189
 
188
190
  languages[target]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Localizationlinter
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
@@ -12,12 +12,11 @@ module Danger
12
12
  # - wrong parameters in string format
13
13
  #
14
14
  # @example Verify my project localizables consistency
15
- #
16
15
  # localizationlinter.lint
17
16
  #
18
17
  # @see https://github.com/fabernovel/danger-localizationlinter
19
18
  # @tags iOS, Localization
20
- #
19
+
21
20
  class DangerLocalizationlinter < Plugin
22
21
  # Keep or clean derived data after execution
23
22
  # @return [void]
@@ -33,11 +32,12 @@ module Danger
33
32
 
34
33
  # Path to language configuration yml, defining main language per target
35
34
  # example:
36
- #
35
+ #```yml
37
36
  # My_target: en
38
37
  # My_other_target: fr
39
- #
40
- # default value is Configuration/Defaults/all_target_main_language.yml
38
+ #```
39
+ # Default value is `Configuration/Defaults/all_target_main_language.yml`
40
+ # If no file is provided, the default language for each target is `en`
41
41
  # @return [void]
42
42
  attr_accessor :language_configuration_path
43
43
 
@@ -62,7 +62,9 @@ module Danger
62
62
  # rubocop:disable Metrics/MethodLength
63
63
  def lint
64
64
  differences = linter.find_differences
65
- if inline_mode
65
+ if differences.empty?
66
+ message "Localization Linter finished with no error"
67
+ elsif inline_mode
66
68
  differences.each do |issue|
67
69
  warn(
68
70
  issue[:message],
@@ -70,7 +72,7 @@ module Danger
70
72
  line: issue[:line]
71
73
  )
72
74
  end
73
- elsif !differences.empty?
75
+ else
74
76
  message = differences.map do |difference|
75
77
  "#{difference[:filename]}:#{difference[:line]} #{difference[:message]}"
76
78
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-localizationlinter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabernovel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-05 00:00:00.000000000 Z
11
+ date: 2021-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger-plugin-api