danger-l10nlint 0.0.8 → 0.0.10

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: 7fecb0e23bb08a3ec1394c12ad2f3627e269234fb3fb64cf9b80e7e1cfcacdd0
4
- data.tar.gz: 74d00f34eb8332c9b58046c9681a65bb92026126f5d1eb4d07198361908912a8
3
+ metadata.gz: 9a2e571c132ce2d510728cd6d124d77fc9a1e7adfeacdc4cba72a6e8dd79fe15
4
+ data.tar.gz: 37dcb9eb3104b27c02a47114c86fcfbd320e2ab593522345cbc831a87ac3dc8b
5
5
  SHA512:
6
- metadata.gz: 12e66784e5a236a5da1b16001278a2158fc0fe3de60b76960bf3bb359ffb42ce5e0778cb0480921d9da5019c017473a0e12ac0e7d35a76a1ae87111dadaa1912
7
- data.tar.gz: c67a524440b7bd432a4636014c6b26bcaf36d89d81baaf4a6429587e04028d9c9e1743463af41e79247d6a554a7b1519fafc03aa9d5b038f71fcc9fb7c654fbd
6
+ metadata.gz: a707a4c598d861019d9f3f1749ed7fa79e8f4c5adb5dde18d2a81feca4dad860679699cd2e0d722cb474d17add7e363f90e634c45144bdc5a0ed0f4a4b78f018
7
+ data.tar.gz: aa14c486a956bbec5a21bc1233f5dbca89612479db4c44666f7192edae2ede7d8d05b3df87a1bdd907b0649d7a3ea965271c354db3b62b59240cf82eb3a6d57c
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.10)
5
5
  danger-plugin-api (~> 1.0)
6
6
 
7
7
  GEM
data/Makefile ADDED
@@ -0,0 +1,3 @@
1
+ .PHONY: release
2
+ release:
3
+ bundle exec rake release
data/lib/danger_plugin.rb CHANGED
@@ -23,33 +23,45 @@ 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
  #
52
- def lint_files(inline_mode: false, fail_on_error: false, additional_l10nlint_args: '')
64
+ def lint_files(inline_mode: false, fail_on_error: false, additional_l10nlint_args: '', subtitle: '')
53
65
  raise 'l10nlint is not installed' unless l10nlint.installed?
54
66
 
55
67
  config_file_path = config_file
@@ -76,20 +88,39 @@ 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
- message = "### L10nLint found issues\n\n".dup
122
+ subtitle_in_title = subtitle.empty? '' : "(#{subtitle})"
123
+ message = "### L10nLint found issues #{subtitle_in_title}\n\n".dup
93
124
  message << markdown_issues(warnings, 'Warnings') unless warnings.empty?
94
125
  message << markdown_issues(errors, 'Errors') unless errors.empty?
95
126
  message << "\n#{other_issues_message(other_issues_count)}" if other_issues_count > 0
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.10'
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.10
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-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger-plugin-api
@@ -168,6 +168,7 @@ files:
168
168
  - Gemfile.lock
169
169
  - Guardfile
170
170
  - LICENSE.txt
171
+ - Makefile
171
172
  - README.md
172
173
  - Rakefile
173
174
  - bin/danger-l10nlint