danger-l10nlint 0.0.8 → 0.0.9

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: 7fecb0e23bb08a3ec1394c12ad2f3627e269234fb3fb64cf9b80e7e1cfcacdd0
4
- data.tar.gz: 74d00f34eb8332c9b58046c9681a65bb92026126f5d1eb4d07198361908912a8
3
+ metadata.gz: 972c6ce86946856a582a1dd5c2bc907dcaf4f177b58ed8542641866067d5fabb
4
+ data.tar.gz: 90ea8057794672accdc8a6f3c8e940757e03b0021ac1b84464d17c4cf0ccbae2
5
5
  SHA512:
6
- metadata.gz: 12e66784e5a236a5da1b16001278a2158fc0fe3de60b76960bf3bb359ffb42ce5e0778cb0480921d9da5019c017473a0e12ac0e7d35a76a1ae87111dadaa1912
7
- data.tar.gz: c67a524440b7bd432a4636014c6b26bcaf36d89d81baaf4a6429587e04028d9c9e1743463af41e79247d6a554a7b1519fafc03aa9d5b038f71fcc9fb7c654fbd
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.8)
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
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.8'
4
+ VERSION = '0.0.9'
5
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.8
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