danger-android_lint 0.0.10 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,4 +1,7 @@
1
1
  ---
2
+ SHA256:
3
+ metadata.gz: 1ef6802abdd658676a4f468420f61b6b8cb5f159308b5956d10669eb24a064af
4
+ data.tar.gz: 3e832d957ecd0a5340c47c5bf1a8aaaad48b487854eb5362d67dd3824d237d72
2
5
  SHA512:
3
- metadata.gz: ee6bc1e76ca2a7d11670cf1d0d50438a05aa62e93c6d81b289b48e4b2c2709181a234d6f6664439dc1aa531e5b1467722aa71752934662495cf992188227381c
4
- data.tar.gz: 0f0e99183aea7bbbda95cddeb56c29d9f939d948f627e8da60b2bf2711dd0d8a794d7349c534cf9c5fa3d6e940abbc7c1ef38e6c599792f4ee8ee5b2689b2643
6
+ metadata.gz: ea599c3805e6433fff6bea20f13dc8fc2019af37f3f9b9755715c5e17b3794a60ecff1b255858fe5e5d8ca5c33979ee32bbbf22f30559d671eace731556a42a0
7
+ data.tar.gz: 23c41cf0cbd6f266d6f3ae1b34aace297994858cc8498a6ffcd35a1a09b79e8bb363558f84938c92aca3fcf40cab7d9f3b846b8488000b4a6fb6327408735b63
data/.circleci/config.yml CHANGED
@@ -1,13 +1,13 @@
1
1
  version: 2.1
2
2
  orbs:
3
- ruby: circleci/ruby@1.0
3
+ ruby: circleci/ruby@2.0
4
4
 
5
5
  jobs:
6
6
  build:
7
7
  docker:
8
- - image: circleci/ruby:2.7
8
+ - image: cimg/ruby:3.2.0
9
9
  steps:
10
10
  - checkout
11
- - run: gem install bundler:2.2.10
11
+ - run: gem install bundler:2.4.3
12
12
  - run: bundle install
13
13
  - run: bundle exec rake spec
data/.github/CODEOWNERS CHANGED
@@ -1 +1 @@
1
- * @barbosa
1
+ * @loadsmart/mobile
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.0.2
1
+ 3.2.0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 0.0.12
2
+
3
+ - Support ruby 3.2.0, fix undefined method exists? for File:Class (#38) ([@irgaly](https://github.com/irgaly))
4
+
5
+ # 0.0.11
6
+
7
+ - Add `excluding_issue_ids` parameter to skip showing issues with the given IDs, e.g. "MissingTranslation" ([@petitJAM](https://github.com/petitJAM))
8
+
1
9
  # 0.0.10
2
10
 
3
11
  - 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.12)
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,19 +143,21 @@ 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)
145
155
  yard (0.9.26)
146
156
 
147
157
  PLATFORMS
158
+ arm64-darwin-21
148
159
  universal-darwin-20
160
+ x86_64-darwin-22
149
161
  x86_64-linux
150
162
 
151
163
  DEPENDENCIES
@@ -161,4 +173,4 @@ DEPENDENCIES
161
173
  yard (~> 0.9.11)
162
174
 
163
175
  BUNDLED WITH
164
- 2.2.10
176
+ 2.4.3
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
data/catalog-info.yaml ADDED
@@ -0,0 +1,14 @@
1
+ apiVersion: backstage.io/v1alpha1
2
+ kind: Component
3
+ metadata:
4
+ name: danger-android_lint
5
+ description: A Danger plugin for Android Lint
6
+ annotations:
7
+ github.com/project-slug: loadsmart/danger-android_lint
8
+ opslevel.com/tier: tier_3
9
+ tags:
10
+ - ruby
11
+ spec:
12
+ type: other
13
+ lifecycle: production
14
+ owner: mobile
@@ -1,3 +1,3 @@
1
1
  module AndroidLint
2
- VERSION = "0.0.10".freeze
2
+ VERSION = "0.0.12".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.
@@ -107,7 +110,7 @@ module Danger
107
110
  system "./gradlew #{gradle_task}"
108
111
  end
109
112
 
110
- unless File.exists?(report_file)
113
+ unless File.exist?(report_file)
111
114
  fail("Lint report not found at `#{report_file}`. "\
112
115
  "Have you forgot to add `xmlReport true` to your `build.gradle` file?")
113
116
  end
@@ -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)
@@ -47,7 +47,7 @@ module Danger
47
47
 
48
48
  it "Fails if severity is an unknown value" do
49
49
  allow(@android_lint).to receive(:`).with("ls gradlew").and_return("gradlew")
50
- allow(File).to receive(:exists?).with(@android_lint.report_file()).and_return(true)
50
+ allow(File).to receive(:exist?).with(@android_lint.report_file()).and_return(true)
51
51
 
52
52
  @android_lint.severity = "Dummy"
53
53
  @android_lint.lint
@@ -57,7 +57,7 @@ module Danger
57
57
 
58
58
  it "Sets severity to 'Warning' if no severity param is provided" do
59
59
  allow(@android_lint).to receive(:`).with("ls gradlew").and_return("gradlew")
60
- allow(File).to receive(:exists?).with(@android_lint.report_file).and_return(true)
60
+ allow(File).to receive(:exist?).with(@android_lint.report_file).and_return(true)
61
61
 
62
62
  fake_result = File.open("spec/fixtures/lint-result-with-everything.xml")
63
63
  allow(File).to receive(:open).with(@android_lint.report_file).and_return(fake_result)
@@ -68,7 +68,7 @@ module Danger
68
68
 
69
69
  it "Sets the report file to a default location if no param is provided" do
70
70
  allow(@android_lint).to receive(:`).with("ls gradlew").and_return("gradlew")
71
- allow(File).to receive(:exists?).with(@android_lint.report_file).and_return(true)
71
+ allow(File).to receive(:exist?).with(@android_lint.report_file).and_return(true)
72
72
 
73
73
  fake_result = File.open("spec/fixtures/lint-result-with-everything.xml")
74
74
  allow(File).to receive(:open).with(@android_lint.report_file).and_return(fake_result)
@@ -84,7 +84,7 @@ module Danger
84
84
 
85
85
  fake_result = File.open("spec/fixtures/lint-result-with-everything.xml")
86
86
  allow(File).to receive(:open).with(@android_lint.report_file).and_return(fake_result)
87
- allow(File).to receive(:exists?).with(@android_lint.report_file).and_return(true)
87
+ allow(File).to receive(:exist?).with(@android_lint.report_file).and_return(true)
88
88
 
89
89
  @android_lint.lint
90
90
 
@@ -93,7 +93,7 @@ module Danger
93
93
 
94
94
  it "Fails if report file does not exist" do
95
95
  allow(@android_lint).to receive(:`).with("ls gradlew").and_return("gradlew")
96
- allow(File).to receive(:exists?).with(@android_lint.report_file).and_return(false)
96
+ allow(File).to receive(:exist?).with(@android_lint.report_file).and_return(false)
97
97
 
98
98
  fake_result = File.open("spec/fixtures/lint-result-with-everything.xml")
99
99
  allow(File).to receive(:open).with(@android_lint.report_file).and_return(fake_result)
@@ -107,7 +107,7 @@ module Danger
107
107
  describe 'lint' do
108
108
  before do
109
109
  allow(@android_lint).to receive(:`).with("ls gradlew").and_return("gradlew")
110
- allow(File).to receive(:exists?).with(@android_lint.report_file).and_return(false)
110
+ allow(File).to receive(:exist?).with(@android_lint.report_file).and_return(false)
111
111
  end
112
112
 
113
113
  it 'Prints markdown if issues were found' do
@@ -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.12
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: 2023-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oga
@@ -183,6 +183,7 @@ files:
183
183
  - README.md
184
184
  - Rakefile
185
185
  - atlantis.yaml
186
+ - catalog-info.yaml
186
187
  - danger-android_lint.gemspec
187
188
  - lib/android_lint/gem_version.rb
188
189
  - lib/android_lint/plugin.rb
@@ -215,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
216
  - !ruby/object:Gem::Version
216
217
  version: '0'
217
218
  requirements: []
218
- rubygems_version: 3.0.9
219
+ rubygems_version: 3.4.1
219
220
  signing_key:
220
221
  specification_version: 4
221
222
  summary: Lint files of a gradle based Android project. This is done using the Android's