danger-l10nlint 0.0.7 → 0.0.9

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
  SHA256:
3
- metadata.gz: 9142a128b36dbe7407575b67434effc13be1068cb61b2c84844ccba1b14cc0e0
4
- data.tar.gz: 0d81b32a7419607b41b6e3047727245d317d565104049d5f9e6cf3945f2125eb
3
+ metadata.gz: 972c6ce86946856a582a1dd5c2bc907dcaf4f177b58ed8542641866067d5fabb
4
+ data.tar.gz: 90ea8057794672accdc8a6f3c8e940757e03b0021ac1b84464d17c4cf0ccbae2
5
5
  SHA512:
6
- metadata.gz: eb80eb32cd908e39be175b88e9d58017809dbe720bf5c514cdc7ebecd00f25f894b1e40ad5590c8257748af90225b23da4c8e8002d459fe005114887cc2b4228
7
- data.tar.gz: b5462b11890746f4a5217ce015a88ce75da89267964eab27d00c7ab4c3293384f2fef70ddacbfad255394692f6d735ec056fb05658d279bb49b9fb6307a45023
6
+ metadata.gz: 232564cbe6508cc0328235dfd3cb6802f6d9c65d32b8663c729f8ae4d0a3e6ad83267c9ecd345e1edde7c42948b7654dc16a9911c4a81f266999bd1ddca7d380
7
+ data.tar.gz: 71e1ea789467ea10f88a8979d9d990fcd4485ca109fb6c251b7a9041cd16ec531b0ca9d357f2fb7f501509fd4f95d1b71bdc310360af28c97798d4f4a4a8728a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-l10nlint (0.0.7)
4
+ danger-l10nlint (0.0.9)
5
5
  danger-plugin-api (~> 1.0)
6
6
 
7
7
  GEM
@@ -43,7 +43,7 @@ GEM
43
43
  faraday-net_http (3.0.2)
44
44
  ffi (1.15.5)
45
45
  formatador (1.1.0)
46
- git (1.13.2)
46
+ git (1.18.0)
47
47
  addressable (~> 2.8)
48
48
  rchardet (~> 1.8)
49
49
  guard (2.18.0)
data/lib/danger_plugin.rb CHANGED
@@ -23,29 +23,41 @@ module Danger
23
23
  #
24
24
  class DangerL10nlint < Plugin
25
25
  # The path to L10nLint's execution
26
+ # @return [String] binary_path
26
27
  attr_accessor :binary_path
27
28
 
28
29
  # The path to L10nLint's configuration file
30
+ # @return [String] config_file
29
31
  attr_accessor :config_file
30
32
 
31
33
  # Maximum number of issues to be reported.
34
+ # @return [Integer] max_num_violations
32
35
  attr_accessor :max_num_violations
33
36
 
34
37
  # Provides additional logging diagnostic information.
38
+ # @return [Boolean] verbose
35
39
  attr_accessor :verbose
36
40
 
37
41
  # Whether we should fail on warnings
42
+ # @return [Boolean] strict
38
43
  attr_accessor :strict
39
44
 
40
45
  # Warnings found
46
+ # @return [Array<Hash>] warnings
41
47
  attr_accessor :warnings
42
48
 
43
49
  # Errors found
50
+ # @return [Array<Hash>] errors
44
51
  attr_accessor :errors
45
52
 
46
53
  # All issues found
54
+ # @return [Array<Hash>] issues
47
55
  attr_accessor :issues
48
56
 
57
+ # Rules for not wanting to make inline comments
58
+ # @return [Array<String>] rule identifiers
59
+ attr_accessor :inline_except_rules
60
+
49
61
  # Lints Localizable.strings
50
62
  # @return [void]
51
63
  #
@@ -76,17 +88,35 @@ module Danger
76
88
  other_issues_count = issues.count - @max_num_violations if issues.count > @max_num_violations
77
89
  issues = issues.take(@max_num_violations)
78
90
  end
79
- log "Received from L10nLint: #{issues}"
91
+
92
+ log "Received issues from L10nLint: #{issues.count}"
80
93
 
81
94
  # Filter warnings and errors
82
95
  @warnings = issues.select { |issue| issue['severity'] == 'warning' }
83
96
  @errors = issues.select { |issue| issue['severity'] == 'error' }
84
97
 
85
98
  if inline_mode
99
+ # Separate each warnings and errors by inline_except_rules
100
+ if inline_except_rules
101
+ markdown_warnings = warnings.select { |issue| inline_except_rules.include?(issue['ruleIdentifier']) }
102
+ inline_warnings = warnings - markdown_warnings
103
+ markdown_errors = @errors.select { |issue| inline_except_rules.include?(issue['ruleIdentifier']) }
104
+ inline_errors = @errors - markdown_errors
105
+ end
106
+
86
107
  # Report with inline comment
87
- send_inline_comment(warnings, strict ? :fail : :warn)
88
- send_inline_comment(errors, (fail_on_error || strict) ? :fail : :warn)
108
+ send_inline_comment(inline_warnings, strict ? :fail : :warn)
109
+ send_inline_comment(inline_errors, (fail_on_error || strict) ? :fail : :warn)
110
+
111
+ if markdown_warnings.count > 0 || markdown_errors.count > 0
112
+ message = "### L10nLint found issues\n\n".dup
113
+ message << markdown_issues(markdown_warnings, 'Warnings') unless markdown_warnings.empty?
114
+ message << markdown_issues(markdown_errors, 'Errors') unless markdown_errors.empty?
115
+ markdown message
116
+ end
117
+
89
118
  warn other_issues_message(other_issues_count) if other_issues_count > 0
119
+
90
120
  elsif warnings.count > 0 || errors.count > 0
91
121
  # Report if any warning or error
92
122
  message = "### L10nLint found issues\n\n".dup
@@ -138,8 +168,6 @@ module Danger
138
168
  message << "| --- | ----- | ----- |\n"
139
169
 
140
170
  results.each do |r|
141
- puts r
142
-
143
171
  filename = r['location']['file'].split('/').last(2).join("/")
144
172
  line = r['location']['line']
145
173
  reason = r['reason']
@@ -166,7 +194,7 @@ module Danger
166
194
  message << "`#{r['ruleIdentifier']}`"
167
195
  message << " `#{filename}:#{r['location']['line']}`" # file:line for pasting into Xcode Quick Open
168
196
 
169
- send(method, message, file: github_filename, line: r['line'])
197
+ send(method, message, file: github_filename, line: r['location']['line'])
170
198
  end
171
199
  end
172
200
 
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DangerL10nLint
4
- VERSION = '0.0.7'
5
- L10NLINT_VERSION = '0.0.5'
4
+ VERSION = '0.0.9'
5
+ L10NLINT_VERSION = '0.0.6'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-l10nlint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazumasa Shimomura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-07 00:00:00.000000000 Z
11
+ date: 2023-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger-plugin-api