danger-android_lint 0.0.8 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +13 -0
- data/.github/CODEOWNERS +1 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +11 -0
- data/Gemfile.lock +83 -54
- data/README.md +18 -0
- data/Rakefile +1 -1
- data/atlantis.yaml +5 -0
- data/danger-android_lint.gemspec +2 -2
- data/lib/android_lint/gem_version.rb +1 -1
- data/lib/android_lint/plugin.rb +47 -6
- data/spec/android_lint_spec.rb +90 -2
- data/spec/fixtures/lint-result-for-pr.xml +62 -0
- data/spec/fixtures/lint-result-with-everything.xml +30 -0
- data/spec/fixtures/pr-diff.diff +14 -0
- metadata +18 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 79e5bfcae51d8156567b963bb7ac48ea67e0db8f2465c99746ffad9e922d4b12
|
4
|
+
data.tar.gz: b9e3527bba12cbd1d88713a6bd33ced049ad8edf630c2e5820eb8065fbe63267
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f8811a723a32f71f8e505259f0df20b737cf7e8aa545e0b825ac8840f4411214be825d195f0ba40baad8b35f91ab6aa153ba915deaafdc2b9aa732ff57b4ff3
|
7
|
+
data.tar.gz: 43e252db44f9d9254315b70c640c37edc4f8ee2996f279ab3afb4131a5ed371fa1734887afe776f48f4fabc39f3979e7127e2de38d18034e2009f4335276c004
|
data/.github/CODEOWNERS
CHANGED
@@ -1 +1 @@
|
|
1
|
-
* @
|
1
|
+
* @barbosa
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.2
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
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
|
+
|
5
|
+
# 0.0.10
|
6
|
+
|
7
|
+
- Fix `filtering_lines` parameter to also apply to when `inline_mode` is `false` ([@petitJAM](https://github.com/petitJAM))
|
8
|
+
|
9
|
+
# 0.0.9
|
10
|
+
- Add `filtering_lines` parameter, to show lint issues only on modified lines ([@ShivamPokhriyal](https://github.com/ShivamPokhriyal))
|
11
|
+
|
1
12
|
# 0.0.8
|
2
13
|
- Fix security issues ([@barbosa](https://github.com/barbosa))
|
3
14
|
- Expose report message ([@adamstrange])(https://github.com/adamstrange))
|
data/Gemfile.lock
CHANGED
@@ -1,50 +1,72 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danger-android_lint (0.0.
|
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.
|
11
|
+
addressable (2.8.0)
|
12
12
|
public_suffix (>= 2.0.2, < 5.0)
|
13
13
|
ansi (1.5.0)
|
14
|
-
ast (2.4.
|
15
|
-
claide (1.0
|
14
|
+
ast (2.4.2)
|
15
|
+
claide (1.1.0)
|
16
16
|
claide-plugins (0.9.2)
|
17
17
|
cork
|
18
18
|
nap
|
19
19
|
open4 (~> 1.3)
|
20
|
-
coderay (1.1.
|
20
|
+
coderay (1.1.3)
|
21
21
|
colored2 (3.1.2)
|
22
22
|
cork (0.3.0)
|
23
23
|
colored2 (~> 3.1)
|
24
|
-
danger (
|
24
|
+
danger (8.5.0)
|
25
25
|
claide (~> 1.0)
|
26
26
|
claide-plugins (>= 0.9.2)
|
27
27
|
colored2 (~> 3.1)
|
28
28
|
cork (~> 0.1)
|
29
|
-
faraday (
|
29
|
+
faraday (>= 0.9.0, < 2.0)
|
30
30
|
faraday-http-cache (~> 2.0)
|
31
|
-
git (~> 1.
|
32
|
-
kramdown (~> 2.
|
31
|
+
git (~> 1.7)
|
32
|
+
kramdown (~> 2.3)
|
33
33
|
kramdown-parser-gfm (~> 1.0)
|
34
34
|
no_proxy_fix
|
35
35
|
octokit (~> 4.7)
|
36
|
-
terminal-table (
|
36
|
+
terminal-table (>= 1, < 4)
|
37
37
|
danger-plugin-api (1.0.0)
|
38
38
|
danger (> 2.0)
|
39
|
-
diff-lcs (1.
|
40
|
-
faraday (
|
39
|
+
diff-lcs (1.4.4)
|
40
|
+
faraday (1.10.0)
|
41
|
+
faraday-em_http (~> 1.0)
|
42
|
+
faraday-em_synchrony (~> 1.0)
|
43
|
+
faraday-excon (~> 1.1)
|
44
|
+
faraday-httpclient (~> 1.0)
|
45
|
+
faraday-multipart (~> 1.0)
|
46
|
+
faraday-net_http (~> 1.0)
|
47
|
+
faraday-net_http_persistent (~> 1.0)
|
48
|
+
faraday-patron (~> 1.0)
|
49
|
+
faraday-rack (~> 1.0)
|
50
|
+
faraday-retry (~> 1.0)
|
51
|
+
ruby2_keywords (>= 0.0.4)
|
52
|
+
faraday-em_http (1.0.0)
|
53
|
+
faraday-em_synchrony (1.0.0)
|
54
|
+
faraday-excon (1.1.0)
|
55
|
+
faraday-http-cache (2.2.0)
|
56
|
+
faraday (>= 0.8)
|
57
|
+
faraday-httpclient (1.0.1)
|
58
|
+
faraday-multipart (1.0.3)
|
41
59
|
multipart-post (>= 1.2, < 3)
|
42
|
-
faraday-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
60
|
+
faraday-net_http (1.0.1)
|
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)
|
65
|
+
ffi (1.15.3)
|
66
|
+
formatador (0.3.0)
|
67
|
+
git (1.10.2)
|
68
|
+
rchardet (~> 1.8)
|
69
|
+
guard (2.17.0)
|
48
70
|
formatador (>= 0.2.4)
|
49
71
|
listen (>= 2.7, < 4.0)
|
50
72
|
lumberjack (>= 1.0.12, < 2.0)
|
@@ -58,14 +80,15 @@ GEM
|
|
58
80
|
guard (~> 2.1)
|
59
81
|
guard-compat (~> 1.1)
|
60
82
|
rspec (>= 2.99.0, < 4.0)
|
61
|
-
kramdown (2.
|
83
|
+
kramdown (2.3.2)
|
84
|
+
rexml
|
62
85
|
kramdown-parser-gfm (1.1.0)
|
63
86
|
kramdown (~> 2.0)
|
64
87
|
listen (3.0.7)
|
65
88
|
rb-fsevent (>= 0.9.3)
|
66
89
|
rb-inotify (>= 0.9.7)
|
67
|
-
lumberjack (1.
|
68
|
-
method_source (0.
|
90
|
+
lumberjack (1.2.8)
|
91
|
+
method_source (1.0.0)
|
69
92
|
multipart-post (2.1.1)
|
70
93
|
nap (1.1.0)
|
71
94
|
nenv (0.3.0)
|
@@ -73,39 +96,42 @@ GEM
|
|
73
96
|
notiffany (0.1.3)
|
74
97
|
nenv (~> 0.1)
|
75
98
|
shellany (~> 0.0)
|
76
|
-
octokit (4.
|
99
|
+
octokit (4.22.0)
|
100
|
+
faraday (>= 0.9)
|
77
101
|
sawyer (~> 0.8.0, >= 0.5.3)
|
78
|
-
oga (3.
|
102
|
+
oga (3.3)
|
79
103
|
ast
|
80
104
|
ruby-ll (~> 2.1)
|
81
105
|
open4 (1.3.4)
|
82
|
-
parallel (1.
|
83
|
-
parser (2.
|
84
|
-
ast (~> 2.4.
|
85
|
-
powerpack (0.1.
|
86
|
-
pry (0.
|
87
|
-
coderay (~> 1.1
|
88
|
-
method_source (~>
|
89
|
-
public_suffix (4.0.
|
106
|
+
parallel (1.20.1)
|
107
|
+
parser (2.7.2.0)
|
108
|
+
ast (~> 2.4.1)
|
109
|
+
powerpack (0.1.3)
|
110
|
+
pry (0.14.1)
|
111
|
+
coderay (~> 1.1)
|
112
|
+
method_source (~> 1.0)
|
113
|
+
public_suffix (4.0.6)
|
90
114
|
rainbow (2.2.2)
|
91
115
|
rake
|
92
|
-
rake (
|
93
|
-
rb-fsevent (0.
|
116
|
+
rake (13.0.3)
|
117
|
+
rb-fsevent (0.11.0)
|
94
118
|
rb-inotify (0.10.1)
|
95
119
|
ffi (~> 1.0)
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
rspec-
|
100
|
-
|
101
|
-
rspec-
|
102
|
-
rspec-
|
120
|
+
rchardet (1.8.0)
|
121
|
+
rexml (3.2.5)
|
122
|
+
rspec (3.10.0)
|
123
|
+
rspec-core (~> 3.10.0)
|
124
|
+
rspec-expectations (~> 3.10.0)
|
125
|
+
rspec-mocks (~> 3.10.0)
|
126
|
+
rspec-core (3.10.1)
|
127
|
+
rspec-support (~> 3.10.0)
|
128
|
+
rspec-expectations (3.10.1)
|
103
129
|
diff-lcs (>= 1.2.0, < 2.0)
|
104
|
-
rspec-support (~> 3.
|
105
|
-
rspec-mocks (3.
|
130
|
+
rspec-support (~> 3.10.0)
|
131
|
+
rspec-mocks (3.10.2)
|
106
132
|
diff-lcs (>= 1.2.0, < 2.0)
|
107
|
-
rspec-support (~> 3.
|
108
|
-
rspec-support (3.
|
133
|
+
rspec-support (~> 3.10.0)
|
134
|
+
rspec-support (3.10.2)
|
109
135
|
rubocop (0.49.1)
|
110
136
|
parallel (~> 1.10)
|
111
137
|
parser (>= 2.3.3.1, < 3.0)
|
@@ -116,31 +142,34 @@ GEM
|
|
116
142
|
ruby-ll (2.1.2)
|
117
143
|
ansi
|
118
144
|
ast
|
119
|
-
ruby-progressbar (1.
|
145
|
+
ruby-progressbar (1.11.0)
|
146
|
+
ruby2_keywords (0.0.5)
|
120
147
|
sawyer (0.8.2)
|
121
148
|
addressable (>= 2.3.5)
|
122
149
|
faraday (> 0.8, < 2.0)
|
123
150
|
shellany (0.0.1)
|
124
|
-
terminal-table (
|
125
|
-
unicode-display_width (
|
126
|
-
thor (1.0
|
127
|
-
unicode-display_width (1.
|
128
|
-
yard (0.9.
|
151
|
+
terminal-table (3.0.2)
|
152
|
+
unicode-display_width (>= 1.1.1, < 3)
|
153
|
+
thor (1.1.0)
|
154
|
+
unicode-display_width (1.7.0)
|
155
|
+
yard (0.9.26)
|
129
156
|
|
130
157
|
PLATFORMS
|
131
|
-
|
158
|
+
universal-darwin-20
|
159
|
+
x86_64-darwin-21
|
160
|
+
x86_64-linux
|
132
161
|
|
133
162
|
DEPENDENCIES
|
134
|
-
bundler (
|
163
|
+
bundler (>= 2.2.10)
|
135
164
|
danger-android_lint!
|
136
165
|
guard (~> 2.14)
|
137
166
|
guard-rspec (~> 4.7)
|
138
167
|
listen (= 3.0.7)
|
139
168
|
pry
|
140
|
-
rake (~>
|
169
|
+
rake (~> 13.0)
|
141
170
|
rspec (~> 3.4)
|
142
171
|
rubocop (~> 0.49.0)
|
143
172
|
yard (~> 0.9.11)
|
144
173
|
|
145
174
|
BUNDLED WITH
|
146
|
-
|
175
|
+
2.2.22
|
data/README.md
CHANGED
@@ -85,6 +85,24 @@ android_lint.filtering = true
|
|
85
85
|
android_lint.lint
|
86
86
|
```
|
87
87
|
|
88
|
+
Additionally, you can further filter to only the modified lines by setting the `filtering_lines` parameter to `true`.
|
89
|
+
|
90
|
+
```rb
|
91
|
+
android_lint.filtering_lines = true
|
92
|
+
android_lint.lint
|
93
|
+
```
|
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
|
+
|
88
106
|
#### Make Danger comment directly on the line instead of printing a Markdown table (GitHub only)
|
89
107
|
|
90
108
|
```rb
|
data/Rakefile
CHANGED
data/atlantis.yaml
ADDED
data/danger-android_lint.gemspec
CHANGED
@@ -23,8 +23,8 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_runtime_dependency 'danger-plugin-api', '~> 1.0'
|
24
24
|
|
25
25
|
# General ruby development
|
26
|
-
spec.add_development_dependency 'bundler', '
|
27
|
-
spec.add_development_dependency 'rake', '~>
|
26
|
+
spec.add_development_dependency 'bundler', '>= 2.2.10'
|
27
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
28
28
|
|
29
29
|
# Testing support
|
30
30
|
spec.add_development_dependency 'rspec', '~> 3.4'
|
data/lib/android_lint/plugin.rb
CHANGED
@@ -84,6 +84,12 @@ module Danger
|
|
84
84
|
# Only show messages within changed files.
|
85
85
|
attr_accessor :filtering
|
86
86
|
|
87
|
+
# Only show messages for the modified lines.
|
88
|
+
attr_accessor :filtering_lines
|
89
|
+
|
90
|
+
# Only show messages for issues not in this list.
|
91
|
+
attr_accessor :excluding_issue_ids
|
92
|
+
|
87
93
|
# Calls lint task of your gradle project.
|
88
94
|
# It fails if `gradlew` cannot be found inside current directory.
|
89
95
|
# It fails if `severity` level is not a valid option.
|
@@ -113,7 +119,7 @@ module Danger
|
|
113
119
|
filtered_issues = filter_issues_by_severity(issues)
|
114
120
|
|
115
121
|
message = ""
|
116
|
-
|
122
|
+
|
117
123
|
if inline_mode
|
118
124
|
# Report with inline comment
|
119
125
|
send_inline_comment(filtered_issues)
|
@@ -121,7 +127,7 @@ module Danger
|
|
121
127
|
message = message_for_issues(filtered_issues)
|
122
128
|
markdown("### AndroidLint found issues\n\n" + message) unless message.to_s.empty?
|
123
129
|
end
|
124
|
-
|
130
|
+
|
125
131
|
message
|
126
132
|
end
|
127
133
|
|
@@ -164,11 +170,17 @@ module Danger
|
|
164
170
|
message = ""
|
165
171
|
|
166
172
|
results.each do |r|
|
173
|
+
issue_id = r.get('id')
|
174
|
+
next if excluding_issue_ids && excluding_issue_ids.include?(issue_id)
|
167
175
|
location = r.xpath('location').first
|
168
176
|
filename = location.get('file').gsub(dir, "")
|
169
|
-
next unless !filtering || (target_files.include? filename)
|
170
|
-
line = location.get('line') || 'N/A'
|
177
|
+
next unless (!filtering && !filtering_lines) || (target_files.include? filename)
|
178
|
+
line = location.get('line').to_i || 'N/A'
|
171
179
|
reason = r.get('message')
|
180
|
+
if filtering_lines
|
181
|
+
added_lines = parse_added_line_numbers(git.diff[filename].patch)
|
182
|
+
next unless added_lines.include? line
|
183
|
+
end
|
172
184
|
count = count + 1
|
173
185
|
message << "`#{filename}` | #{line} | #{reason} \n"
|
174
186
|
end
|
@@ -186,7 +198,7 @@ module Danger
|
|
186
198
|
# Send inline comment with danger's warn or fail method
|
187
199
|
#
|
188
200
|
# @return [void]
|
189
|
-
def send_inline_comment
|
201
|
+
def send_inline_comment(issues)
|
190
202
|
target_files = (git.modified_files - git.deleted_files) + git.added_files
|
191
203
|
dir = "#{Dir.pwd}/"
|
192
204
|
SEVERITY_LEVELS.reverse.each do |level|
|
@@ -195,13 +207,42 @@ module Danger
|
|
195
207
|
filtered.each do |r|
|
196
208
|
location = r.xpath('location').first
|
197
209
|
filename = location.get('file').gsub(dir, "")
|
198
|
-
next unless !filtering || (target_files.include? filename)
|
210
|
+
next unless (!filtering && !filtering_lines) || (target_files.include? filename)
|
199
211
|
line = (location.get('line') || "0").to_i
|
212
|
+
if filtering_lines
|
213
|
+
added_lines = parse_added_line_numbers(git.diff[filename].patch)
|
214
|
+
next unless added_lines.include? line
|
215
|
+
end
|
200
216
|
send(level === "Warning" ? "warn" : "fail", r.get('message'), file: filename, line: line)
|
201
217
|
end
|
202
218
|
end
|
203
219
|
end
|
204
220
|
|
221
|
+
# Parses git diff of a file and retuns an array of added line numbers.
|
222
|
+
def parse_added_line_numbers(diff)
|
223
|
+
current_line_number = nil
|
224
|
+
added_line_numbers = []
|
225
|
+
diff_lines = diff.strip.split("\n")
|
226
|
+
diff_lines.each_with_index do |line, index|
|
227
|
+
if m = /\+(\d+)(?:,\d+)? @@/.match(line)
|
228
|
+
# (e.g. @@ -32,10 +32,7 @@)
|
229
|
+
current_line_number = Integer(m[1])
|
230
|
+
else
|
231
|
+
if !current_line_number.nil?
|
232
|
+
if line.start_with?('+')
|
233
|
+
# added line
|
234
|
+
added_line_numbers.push current_line_number
|
235
|
+
current_line_number += 1
|
236
|
+
elsif !line.start_with?('-')
|
237
|
+
# unmodified line
|
238
|
+
current_line_number += 1
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
added_line_numbers
|
244
|
+
end
|
245
|
+
|
205
246
|
def gradlew_exists?
|
206
247
|
`ls gradlew`.strip.empty? == false
|
207
248
|
end
|
data/spec/android_lint_spec.rb
CHANGED
@@ -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,8 +188,96 @@ 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
|
-
|
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
|
192
207
|
|
208
|
+
describe "for a modified file" do
|
209
|
+
before do
|
210
|
+
allow(Dir).to receive(:pwd).and_return("/Users/shivampokhriyal/Documents/projects/Commcare/commcare-android")
|
211
|
+
|
212
|
+
allow(@android_lint.git).to receive(:modified_files).and_return([
|
213
|
+
"app/build.gradle",
|
214
|
+
])
|
215
|
+
|
216
|
+
fake_patch = File.read("spec/fixtures/pr-diff.diff")
|
217
|
+
diff = [OpenStruct.new(type: "modified", path: "app/build.gradle")]
|
218
|
+
allow(@android_lint.git).to receive(:diff).and_return(diff)
|
219
|
+
diff_for_file = OpenStruct.new(insertions: 3)
|
220
|
+
allow(diff).to receive(:[]).with("app/build.gradle").and_return(diff_for_file)
|
221
|
+
allow(diff_for_file).to receive(:patch).and_return(fake_patch)
|
222
|
+
|
223
|
+
fake_result = File.open("spec/fixtures/lint-result-for-pr.xml")
|
224
|
+
allow(File).to receive(:open).with(@android_lint.report_file).and_return(fake_result)
|
225
|
+
end
|
226
|
+
|
227
|
+
context 'when inline_mode: true' do
|
228
|
+
it 'with filtering_lines, only show issues in modified lines' do
|
229
|
+
@android_lint.filtering_lines = true
|
230
|
+
@android_lint.lint inline_mode: true
|
231
|
+
|
232
|
+
error = @android_lint.status_report[:errors]
|
233
|
+
expect(error).to include("fake message three")
|
234
|
+
|
235
|
+
expect(error).not_to include("fake message one")
|
236
|
+
expect(error).not_to include("fake message two")
|
237
|
+
expect(error).not_to include("fake message in unmodified file")
|
238
|
+
end
|
239
|
+
|
240
|
+
it 'with filtering, show all issues in modified files' do
|
241
|
+
@android_lint.filtering = true
|
242
|
+
@android_lint.lint inline_mode: true
|
243
|
+
|
244
|
+
error = @android_lint.status_report[:errors]
|
245
|
+
expect(error).to include("fake message one")
|
246
|
+
expect(error).to include("fake message two")
|
247
|
+
expect(error).to include("fake message three")
|
248
|
+
|
249
|
+
expect(error).not_to include("fake message in unmodified file")
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
context 'when inline_mode: false' do
|
254
|
+
it 'with filtering_lines, only show issues in modified lines' do
|
255
|
+
@android_lint.filtering_lines = true
|
256
|
+
@android_lint.lint inline_mode: false
|
257
|
+
|
258
|
+
puts @android_lint.status_report[:markdowns]
|
259
|
+
message = @android_lint.status_report[:markdowns][0].to_s
|
260
|
+
expect(message).to include("fake message three")
|
261
|
+
|
262
|
+
expect(message).not_to include("fake message one")
|
263
|
+
expect(message).not_to include("fake message two")
|
264
|
+
expect(message).not_to include("fake message in unmodified file")
|
265
|
+
end
|
266
|
+
|
267
|
+
it 'with filtering, show all issues in modified files' do
|
268
|
+
@android_lint.filtering = true
|
269
|
+
@android_lint.lint inline_mode: false
|
270
|
+
|
271
|
+
message = @android_lint.status_report[:markdowns][0].to_s
|
272
|
+
expect(message).to include("fake message one")
|
273
|
+
expect(message).to include("fake message two")
|
274
|
+
expect(message).to include("fake message three")
|
275
|
+
|
276
|
+
expect(message).not_to include("fake message in unmodified file")
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
193
281
|
end
|
194
282
|
end
|
195
283
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<issues format="5" by="lint 4.0.0">
|
3
|
+
<issue
|
4
|
+
id="DuplicatePlatformClasses"
|
5
|
+
severity="Error"
|
6
|
+
message="fake message one"
|
7
|
+
category="Correctness"
|
8
|
+
priority="8"
|
9
|
+
summary="Duplicate Platform Classes"
|
10
|
+
explanation="There are a number of libraries that duplicate not just functionality of the Android platform but using the exact same class names as the ones provided in Android -- for example the apache http classes. This can lead to unexpected crashes.

To solve this, you need to either find a newer version of the library which no longer has this problem, or to repackage the library (and all of its dependencies) using something like the `jarjar` tool, or finally, rewriting the code to use different APIs (for example, for http code, consider using `HttpUrlConnection` or a library like `okhttp`).">
|
11
|
+
<location
|
12
|
+
file="/Users/shivampokhriyal/Documents/projects/Commcare/commcare-android/app/build.gradle"/>
|
13
|
+
</issue>
|
14
|
+
|
15
|
+
<issue
|
16
|
+
id="DuplicatePlatformClasses"
|
17
|
+
severity="Error"
|
18
|
+
message="fake message two"
|
19
|
+
category="Correctness"
|
20
|
+
priority="8"
|
21
|
+
summary="Duplicate Platform Classes"
|
22
|
+
explanation="There are a number of libraries that duplicate not just functionality of the Android platform but using the exact same class names as the ones provided in Android -- for example the apache http classes. This can lead to unexpected crashes.

To solve this, you need to either find a newer version of the library which no longer has this problem, or to repackage the library (and all of its dependencies) using something like the `jarjar` tool, or finally, rewriting the code to use different APIs (for example, for http code, consider using `HttpUrlConnection` or a library like `okhttp`)."
|
23
|
+
errorLine1=" testImplementation 'org.json:json:20140107'"
|
24
|
+
errorLine2=" ~~~~~~~~~~~~~">
|
25
|
+
<location
|
26
|
+
file="/Users/shivampokhriyal/Documents/projects/Commcare/commcare-android/app/build.gradle"
|
27
|
+
line="52"
|
28
|
+
column="25"/>
|
29
|
+
</issue>
|
30
|
+
|
31
|
+
<issue
|
32
|
+
id="FakeId"
|
33
|
+
severity="Error"
|
34
|
+
message="fake message three"
|
35
|
+
category="Correctness"
|
36
|
+
priority="8"
|
37
|
+
summary="Fake summary"
|
38
|
+
explanation="Fake explanation."
|
39
|
+
errorLine1="// debugImplementation because LeakCanary should only run in debug builds."
|
40
|
+
errorLine2=" ~~~~~~~~~~~~~">
|
41
|
+
<location
|
42
|
+
file="/Users/shivampokhriyal/Documents/projects/Commcare/commcare-android/app/build.gradle"
|
43
|
+
line="36"
|
44
|
+
column="10"/>
|
45
|
+
</issue>
|
46
|
+
|
47
|
+
<issue
|
48
|
+
id="2"
|
49
|
+
severity="Error"
|
50
|
+
message="fake message in unmodified file"
|
51
|
+
category="Correctness"
|
52
|
+
priority="8"
|
53
|
+
summary="Fake summary"
|
54
|
+
explanation="Fake explanation."
|
55
|
+
errorLine1="// debugImplementation because LeakCanary should only run in debug builds."
|
56
|
+
errorLine2=" ~~~~~~~~~~~~~">
|
57
|
+
<location
|
58
|
+
file="/Users/shivampokhriyal/Documents/projects/Commcare/commcare-android/app/AndroidManifest.xml"
|
59
|
+
line="36"
|
60
|
+
column="10"/>
|
61
|
+
</issue>
|
62
|
+
</issues>
|
@@ -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=""someStringResource" is not translated in "de" (German), "fi" (Finnish), "ru" (Russian), "sv" (Swedish), &q
|
68
|
+
uot;ko" (Korean), "pt" (Portuguese), "el" (Greek), "en" (English), "it" (Italian), "fr" (French), "es" (Spanish), "cs&q
|
69
|
+
uot; (Czech), "nb" (Norwegian Bokmål), "ja" (Japanese), "da" (Danish), "ca" (Catalan), "nl" (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.

If the string should **not** be translated, you can add the attribute `translatable="false"` on the `<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="MissingTranslation"` attribute.

You can tell lint (and other tools) which language is the default language in your `res/values/` folder by specifying `tools:locale="languageCode"` for the root `<resources>` element in your resource file. (The `tools` prefix refers to the namespace declaration `http://schemas.android.com/tools`.)"
|
74
|
+
errorLine1=" <string name="someStringResource">Hello this is a string resource.</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 `<application>` element.

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>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
diff --git a/app/build.gradle b/app/build.gradle
|
2
|
+
index 6dcc647b8..a1365bd75 100644
|
3
|
+
--- a/app/build.gradle
|
4
|
+
+++ b/app/build.gradle
|
5
|
+
@@ -33,6 +33,9 @@ configurations {
|
6
|
+
}
|
7
|
+
|
8
|
+
dependencies {
|
9
|
+
+ // debugImplementation because LeakCanary should only run in debug builds.
|
10
|
+
+ debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
|
11
|
+
+
|
12
|
+
testImplementation 'junit:junit:4.12'
|
13
|
+
testImplementation('org.robolectric:robolectric:4.3.1') {
|
14
|
+
exclude(group: 'org.bouncycastle', module: 'bcprov-jdk15on')
|
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.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gustavo Barbosa
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oga
|
@@ -42,30 +42,30 @@ dependencies:
|
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.2.10
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.2.10
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '13.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '13.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,6 +171,7 @@ executables: []
|
|
171
171
|
extensions: []
|
172
172
|
extra_rdoc_files: []
|
173
173
|
files:
|
174
|
+
- ".circleci/config.yml"
|
174
175
|
- ".github/CODEOWNERS"
|
175
176
|
- ".gitignore"
|
176
177
|
- ".ruby-version"
|
@@ -181,6 +182,7 @@ files:
|
|
181
182
|
- LICENSE.txt
|
182
183
|
- README.md
|
183
184
|
- Rakefile
|
185
|
+
- atlantis.yaml
|
184
186
|
- danger-android_lint.gemspec
|
185
187
|
- lib/android_lint/gem_version.rb
|
186
188
|
- lib/android_lint/plugin.rb
|
@@ -188,15 +190,17 @@ files:
|
|
188
190
|
- lib/danger_plugin.rb
|
189
191
|
- spec/android_lint_spec.rb
|
190
192
|
- spec/fixtures/lint-result-empty.xml
|
193
|
+
- spec/fixtures/lint-result-for-pr.xml
|
191
194
|
- spec/fixtures/lint-result-with-everything.xml
|
192
195
|
- spec/fixtures/lint-result-with-special-chars.xml
|
193
196
|
- spec/fixtures/lint-result-without-fatal.xml
|
197
|
+
- spec/fixtures/pr-diff.diff
|
194
198
|
- spec/spec_helper.rb
|
195
199
|
homepage: https://github.com/loadsmart/danger-android_lint
|
196
200
|
licenses:
|
197
201
|
- MIT
|
198
202
|
metadata: {}
|
199
|
-
post_install_message:
|
203
|
+
post_install_message:
|
200
204
|
rdoc_options: []
|
201
205
|
require_paths:
|
202
206
|
- lib
|
@@ -211,16 +215,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
215
|
- !ruby/object:Gem::Version
|
212
216
|
version: '0'
|
213
217
|
requirements: []
|
214
|
-
|
215
|
-
|
216
|
-
signing_key:
|
218
|
+
rubygems_version: 3.2.22
|
219
|
+
signing_key:
|
217
220
|
specification_version: 4
|
218
221
|
summary: Lint files of a gradle based Android project. This is done using the Android's
|
219
222
|
Lint tool. Results are passed out as tables in markdown.
|
220
223
|
test_files:
|
221
224
|
- spec/android_lint_spec.rb
|
222
225
|
- spec/fixtures/lint-result-empty.xml
|
226
|
+
- spec/fixtures/lint-result-for-pr.xml
|
223
227
|
- spec/fixtures/lint-result-with-everything.xml
|
224
228
|
- spec/fixtures/lint-result-with-special-chars.xml
|
225
229
|
- spec/fixtures/lint-result-without-fatal.xml
|
230
|
+
- spec/fixtures/pr-diff.diff
|
226
231
|
- spec/spec_helper.rb
|