danger-android_lint 0.0.10 → 0.0.11

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,4 +1,7 @@
1
1
  ---
2
+ SHA256:
3
+ metadata.gz: 79e5bfcae51d8156567b963bb7ac48ea67e0db8f2465c99746ffad9e922d4b12
4
+ data.tar.gz: b9e3527bba12cbd1d88713a6bd33ced049ad8edf630c2e5820eb8065fbe63267
2
5
  SHA512:
3
- metadata.gz: ee6bc1e76ca2a7d11670cf1d0d50438a05aa62e93c6d81b289b48e4b2c2709181a234d6f6664439dc1aa531e5b1467722aa71752934662495cf992188227381c
4
- data.tar.gz: 0f0e99183aea7bbbda95cddeb56c29d9f939d948f627e8da60b2bf2711dd0d8a794d7349c534cf9c5fa3d6e940abbc7c1ef38e6c599792f4ee8ee5b2689b2643
6
+ metadata.gz: 1f8811a723a32f71f8e505259f0df20b737cf7e8aa545e0b825ac8840f4411214be825d195f0ba40baad8b35f91ab6aa153ba915deaafdc2b9aa732ff57b4ff3
7
+ data.tar.gz: 43e252db44f9d9254315b70c640c37edc4f8ee2996f279ab3afb4131a5ed371fa1734887afe776f48f4fabc39f3979e7127e2de38d18034e2009f4335276c004
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.0.11
2
+
3
+ - Add `excluding_issue_ids` parameter to skip showing issues with the given IDs, e.g. "MissingTranslation" ([@petitJAM](https://github.com/petitJAM))
4
+
1
5
  # 0.0.10
2
6
 
3
7
  - Fix `filtering_lines` parameter to also apply to when `inline_mode` is `false` ([@petitJAM](https://github.com/petitJAM))
data/Gemfile.lock CHANGED
@@ -1,18 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-android_lint (0.0.9)
4
+ danger-android_lint (0.0.11)
5
5
  danger-plugin-api (~> 1.0)
6
6
  oga
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.7.0)
11
+ addressable (2.8.0)
12
12
  public_suffix (>= 2.0.2, < 5.0)
13
13
  ansi (1.5.0)
14
14
  ast (2.4.2)
15
- claide (1.0.3)
15
+ claide (1.1.0)
16
16
  claide-plugins (0.9.2)
17
17
  cork
18
18
  nap
@@ -21,7 +21,7 @@ GEM
21
21
  colored2 (3.1.2)
22
22
  cork (0.3.0)
23
23
  colored2 (~> 3.1)
24
- danger (8.2.3)
24
+ danger (8.5.0)
25
25
  claide (~> 1.0)
26
26
  claide-plugins (>= 0.9.2)
27
27
  colored2 (~> 3.1)
@@ -37,24 +37,34 @@ GEM
37
37
  danger-plugin-api (1.0.0)
38
38
  danger (> 2.0)
39
39
  diff-lcs (1.4.4)
40
- faraday (1.4.2)
40
+ faraday (1.10.0)
41
41
  faraday-em_http (~> 1.0)
42
42
  faraday-em_synchrony (~> 1.0)
43
43
  faraday-excon (~> 1.1)
44
+ faraday-httpclient (~> 1.0)
45
+ faraday-multipart (~> 1.0)
44
46
  faraday-net_http (~> 1.0)
45
- faraday-net_http_persistent (~> 1.1)
46
- multipart-post (>= 1.2, < 3)
47
+ faraday-net_http_persistent (~> 1.0)
48
+ faraday-patron (~> 1.0)
49
+ faraday-rack (~> 1.0)
50
+ faraday-retry (~> 1.0)
47
51
  ruby2_keywords (>= 0.0.4)
48
52
  faraday-em_http (1.0.0)
49
53
  faraday-em_synchrony (1.0.0)
50
54
  faraday-excon (1.1.0)
51
55
  faraday-http-cache (2.2.0)
52
56
  faraday (>= 0.8)
57
+ faraday-httpclient (1.0.1)
58
+ faraday-multipart (1.0.3)
59
+ multipart-post (>= 1.2, < 3)
53
60
  faraday-net_http (1.0.1)
54
- faraday-net_http_persistent (1.1.0)
61
+ faraday-net_http_persistent (1.2.0)
62
+ faraday-patron (1.0.0)
63
+ faraday-rack (1.0.0)
64
+ faraday-retry (1.0.3)
55
65
  ffi (1.15.3)
56
66
  formatador (0.3.0)
57
- git (1.8.1)
67
+ git (1.10.2)
58
68
  rchardet (~> 1.8)
59
69
  guard (2.17.0)
60
70
  formatador (>= 0.2.4)
@@ -70,7 +80,7 @@ GEM
70
80
  guard (~> 2.1)
71
81
  guard-compat (~> 1.1)
72
82
  rspec (>= 2.99.0, < 4.0)
73
- kramdown (2.3.1)
83
+ kramdown (2.3.2)
74
84
  rexml
75
85
  kramdown-parser-gfm (1.1.0)
76
86
  kramdown (~> 2.0)
@@ -86,7 +96,7 @@ GEM
86
96
  notiffany (0.1.3)
87
97
  nenv (~> 0.1)
88
98
  shellany (~> 0.0)
89
- octokit (4.21.0)
99
+ octokit (4.22.0)
90
100
  faraday (>= 0.9)
91
101
  sawyer (~> 0.8.0, >= 0.5.3)
92
102
  oga (3.3)
@@ -133,12 +143,12 @@ GEM
133
143
  ansi
134
144
  ast
135
145
  ruby-progressbar (1.11.0)
136
- ruby2_keywords (0.0.4)
146
+ ruby2_keywords (0.0.5)
137
147
  sawyer (0.8.2)
138
148
  addressable (>= 2.3.5)
139
149
  faraday (> 0.8, < 2.0)
140
150
  shellany (0.0.1)
141
- terminal-table (3.0.1)
151
+ terminal-table (3.0.2)
142
152
  unicode-display_width (>= 1.1.1, < 3)
143
153
  thor (1.1.0)
144
154
  unicode-display_width (1.7.0)
@@ -146,6 +156,7 @@ GEM
146
156
 
147
157
  PLATFORMS
148
158
  universal-darwin-20
159
+ x86_64-darwin-21
149
160
  x86_64-linux
150
161
 
151
162
  DEPENDENCIES
@@ -161,4 +172,4 @@ DEPENDENCIES
161
172
  yard (~> 0.9.11)
162
173
 
163
174
  BUNDLED WITH
164
- 2.2.10
175
+ 2.2.22
data/README.md CHANGED
@@ -92,6 +92,17 @@ android_lint.filtering_lines = true
92
92
  android_lint.lint
93
93
  ```
94
94
 
95
+ #### Filter issues by ID
96
+
97
+ In some cases you may want to conditionally ignore specific lint warnings without fully disabling
98
+ them in your `lintOptions` configuration. To do that, you can pass a list of IDs to the
99
+ `excluding_issue_ids` parameter.
100
+
101
+ ```rb
102
+ android_lint.excluding_issue_ids = ["MissingTranslation"]
103
+ android_lint.lint
104
+ ```
105
+
95
106
  #### Make Danger comment directly on the line instead of printing a Markdown table (GitHub only)
96
107
 
97
108
  ```rb
@@ -1,3 +1,3 @@
1
1
  module AndroidLint
2
- VERSION = "0.0.10".freeze
2
+ VERSION = "0.0.11".freeze
3
3
  end
@@ -84,9 +84,12 @@ module Danger
84
84
  # Only show messages within changed files.
85
85
  attr_accessor :filtering
86
86
 
87
- # Only shows messages for the modified lines.
87
+ # Only show messages for the modified lines.
88
88
  attr_accessor :filtering_lines
89
89
 
90
+ # Only show messages for issues not in this list.
91
+ attr_accessor :excluding_issue_ids
92
+
90
93
  # Calls lint task of your gradle project.
91
94
  # It fails if `gradlew` cannot be found inside current directory.
92
95
  # It fails if `severity` level is not a valid option.
@@ -167,6 +170,8 @@ module Danger
167
170
  message = ""
168
171
 
169
172
  results.each do |r|
173
+ issue_id = r.get('id')
174
+ next if excluding_issue_ids && excluding_issue_ids.include?(issue_id)
170
175
  location = r.xpath('location').first
171
176
  filename = location.get('file').gsub(dir, "")
172
177
  next unless (!filtering && !filtering_lines) || (target_files.include? filename)
@@ -146,7 +146,7 @@ module Danger
146
146
  expect(markdown).to be_nil
147
147
  end
148
148
 
149
- it 'Doesn`t print anything if no errors were found' do
149
+ it 'Doesn`t print anything if no errors were found at the set minimum severity level' do
150
150
  fake_result = File.open("spec/fixtures/lint-result-without-fatal.xml")
151
151
  allow(File).to receive(:open).with(@android_lint.report_file).and_return(fake_result)
152
152
 
@@ -188,6 +188,23 @@ module Danger
188
188
  expect(warn).not_to include("Implicitly using the default locale is a common source of bugs: Use `String.format(Locale, ...)` instead")
189
189
  end
190
190
 
191
+ describe 'excluding_issue_ids' do
192
+ before do
193
+ fake_result = File.open("spec/fixtures/lint-result-with-everything.xml")
194
+ allow(File).to receive(:open).with(@android_lint.report_file).and_return(fake_result)
195
+ end
196
+
197
+ it 'Does not print ignored issues' do
198
+ @android_lint.excluding_issue_ids = ["MissingTranslation", "RtlEnabled"]
199
+ @android_lint.lint
200
+
201
+ markdown = @android_lint.status_report[:markdowns].first.message
202
+ expect(markdown).to include("Implicitly using the default locale")
203
+ expect(markdown).not_to include("is not translated in")
204
+ expect(markdown).not_to include("The project references RTL attributes, but does not explicitly enable or disable RTL support with `android:supportsRtl` in the manifest")
205
+ end
206
+ end
207
+
191
208
  describe "for a modified file" do
192
209
  before do
193
210
  allow(Dir).to receive(:pwd).and_return("/Users/shivampokhriyal/Documents/projects/Commcare/commcare-android")
@@ -61,4 +61,34 @@ If you want the methods to just perform ASCII replacement, for example to conver
61
61
  column="16"/>
62
62
  </issue>
63
63
 
64
+ <issue
65
+ id="MissingTranslation"
66
+ severity="Error"
67
+ message="&quot;someStringResource&quot; is not translated in &quot;de&quot; (German), &quot;fi&quot; (Finnish), &quot;ru&quot; (Russian), &quot;sv&quot; (Swedish), &q
68
+ uot;ko&quot; (Korean), &quot;pt&quot; (Portuguese), &quot;el&quot; (Greek), &quot;en&quot; (English), &quot;it&quot; (Italian), &quot;fr&quot; (French), &quot;es&quot; (Spanish), &quot;cs&q
69
+ uot; (Czech), &quot;nb&quot; (Norwegian Bokmål), &quot;ja&quot; (Japanese), &quot;da&quot; (Danish), &quot;ca&quot; (Catalan), &quot;nl&quot; (Dutch)"
70
+ category="Correctness:Messages"
71
+ priority="8"
72
+ summary="Incomplete translation"
73
+ explanation="If an application has more than one locale, then all the strings declared in one language should also be translated in all other languages.&#xA;&#xA;If the string should **not** be translated, you can add the attribute `translatable=&quot;false&quot;` on the `&lt;string>` element, or you can define all your non-translatable strings in a resource file called `donottranslate.xml`. Or, you can ignore the issue with a `tools:ignore=&quot;MissingTranslation&quot;` attribute.&#xA;&#xA;You can tell lint (and other tools) which language is the default language in your `res/values/` folder by specifying `tools:locale=&quot;languageCode&quot;` for the root `&lt;resources>` element in your resource file. (The `tools` prefix refers to the namespace declaration `http://schemas.android.com/tools`.)"
74
+ errorLine1=" &lt;string name=&quot;someStringResource&quot;>Hello this is a string resource.&lt;/string>"
75
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
76
+ <location
77
+ file="/Users/gustavo/Developer/app-android/app/src/main/res/values/strings.xml"
78
+ line="10"
79
+ column="13"/>
80
+ </issue>
81
+
82
+ <issue
83
+ id="RtlEnabled"
84
+ severity="Warning"
85
+ message="The project references RTL attributes, but does not explicitly enable or disable RTL support with `android:supportsRtl` in the manifest"
86
+ category="Internationalization:Bidirectional Text"
87
+ priority="3"
88
+ summary="Using RTL attributes without enabling RTL support"
89
+ explanation="To enable right-to-left support, when running on API 17 and higher, you must set the `android:supportsRtl` attribute in the manifest `&lt;application>` element.&#xA;&#xA;If you have started adding RTL attributes, but have not yet finished the migration, you can set the attribute to false to satisfy this lint check.">
90
+ <location
91
+ file="/Users/gustavo/Developer/app-android/app/src/main/AndroidManifest.xml"/>
92
+ </issue>
93
+
64
94
  </issues>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-android_lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gustavo Barbosa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-22 00:00:00.000000000 Z
11
+ date: 2022-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oga
@@ -215,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
215
  - !ruby/object:Gem::Version
216
216
  version: '0'
217
217
  requirements: []
218
- rubygems_version: 3.0.9
218
+ rubygems_version: 3.2.22
219
219
  signing_key:
220
220
  specification_version: 4
221
221
  summary: Lint files of a gradle based Android project. This is done using the Android's