diff --git a/CHANGELOG.md b/CHANGELOG.md
index 24be5ed..d39837a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+# 0.0.11
+
+- Add `excluding_issue_ids` parameter to skip showing issues with the given IDs, e.g. "MissingTranslation" ([@petitJAM](https://github.com/petitJAM))
+
# 0.0.10
- Fix `filtering_lines` parameter to also apply to when `inline_mode` is `false` ([@petitJAM](https://github.com/petitJAM))
diff --git a/Gemfile.lock b/Gemfile.lock
index e63f768..cf22da9 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,18 +1,18 @@
PATH
remote: .
specs:
- danger-android_lint (0.0.9)
+ danger-android_lint (0.0.11)
danger-plugin-api (~> 1.0)
oga
GEM
remote: https://rubygems.org/
specs:
- addressable (2.7.0)
+ addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
ansi (1.5.0)
ast (2.4.2)
- claide (1.0.3)
+ claide (1.1.0)
claide-plugins (0.9.2)
cork
nap
@@ -21,7 +21,7 @@ GEM
colored2 (3.1.2)
cork (0.3.0)
colored2 (~> 3.1)
- danger (8.2.3)
+ danger (8.5.0)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
@@ -37,24 +37,34 @@ GEM
danger-plugin-api (1.0.0)
danger (> 2.0)
diff-lcs (1.4.4)
- faraday (1.4.2)
+ faraday (1.10.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
+ faraday-httpclient (~> 1.0)
+ faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0)
- faraday-net_http_persistent (~> 1.1)
- multipart-post (>= 1.2, < 3)
+ faraday-net_http_persistent (~> 1.0)
+ faraday-patron (~> 1.0)
+ faraday-rack (~> 1.0)
+ faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-http-cache (2.2.0)
faraday (>= 0.8)
+ faraday-httpclient (1.0.1)
+ faraday-multipart (1.0.3)
+ multipart-post (>= 1.2, < 3)
faraday-net_http (1.0.1)
- faraday-net_http_persistent (1.1.0)
+ faraday-net_http_persistent (1.2.0)
+ faraday-patron (1.0.0)
+ faraday-rack (1.0.0)
+ faraday-retry (1.0.3)
ffi (1.15.3)
formatador (0.3.0)
- git (1.8.1)
+ git (1.10.2)
rchardet (~> 1.8)
guard (2.17.0)
formatador (>= 0.2.4)
@@ -70,7 +80,7 @@ GEM
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
- kramdown (2.3.1)
+ kramdown (2.3.2)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
@@ -86,7 +96,7 @@ GEM
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
- octokit (4.21.0)
+ octokit (4.22.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
oga (3.3)
@@ -133,12 +143,12 @@ GEM
ansi
ast
ruby-progressbar (1.11.0)
- ruby2_keywords (0.0.4)
+ ruby2_keywords (0.0.5)
sawyer (0.8.2)
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
shellany (0.0.1)
- terminal-table (3.0.1)
+ terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thor (1.1.0)
unicode-display_width (1.7.0)
diff --git a/README.md b/README.md
index 92af50a..d49b28f 100644
--- a/README.md
+++ b/README.md
@@ -92,6 +92,17 @@ android_lint.filtering_lines = true
android_lint.lint
```
+#### Filter issues by ID
+
+In some cases you may want to conditionally ignore specific lint warnings without fully disabling
+them in your `lintOptions` configuration. To do that, you can pass a list of IDs to the
+`excluding_issue_ids` parameter.
+
+```rb
+android_lint.excluding_issue_ids = ["MissingTranslation"]
+android_lint.lint
+```
+
#### Make Danger comment directly on the line instead of printing a Markdown table (GitHub only)
```rb
diff --git a/lib/android_lint/gem_version.rb b/lib/android_lint/gem_version.rb
index 2d35abe..5a97626 100644
--- a/lib/android_lint/gem_version.rb
+++ b/lib/android_lint/gem_version.rb
@@ -1,3 +1,3 @@
module AndroidLint
- VERSION = "0.0.10".freeze
+ VERSION = "0.0.11".freeze
end
diff --git a/lib/android_lint/plugin.rb b/lib/android_lint/plugin.rb
index 356847b..475d0a3 100644
--- a/lib/android_lint/plugin.rb
+++ b/lib/android_lint/plugin.rb
@@ -84,9 +84,12 @@ def severity
# Only show messages within changed files.
attr_accessor :filtering
- # Only shows messages for the modified lines.
+ # Only show messages for the modified lines.
attr_accessor :filtering_lines
+ # Only show messages for issues not in this list.
+ attr_accessor :excluding_issue_ids
+
# Calls lint task of your gradle project.
# It fails if `gradlew` cannot be found inside current directory.
# It fails if `severity` level is not a valid option.
@@ -167,6 +170,8 @@ def parse_results(results, heading)
message = ""
results.each do |r|
+ issue_id = r.get('id')
+ next if excluding_issue_ids && excluding_issue_ids.include?(issue_id)
location = r.xpath('location').first
filename = location.get('file').gsub(dir, "")
next unless (!filtering && !filtering_lines) || (target_files.include? filename)
diff --git a/spec/android_lint_spec.rb b/spec/android_lint_spec.rb
index 2685f5d..d485d9e 100644
--- a/spec/android_lint_spec.rb
+++ b/spec/android_lint_spec.rb
@@ -146,7 +146,7 @@ module Danger
expect(markdown).to be_nil
end
- it 'Doesn`t print anything if no errors were found' do
+ it 'Doesn`t print anything if no errors were found at the set minimum severity level' do
fake_result = File.open("spec/fixtures/lint-result-without-fatal.xml")
allow(File).to receive(:open).with(@android_lint.report_file).and_return(fake_result)
@@ -188,6 +188,23 @@ module Danger
expect(warn).not_to include("Implicitly using the default locale is a common source of bugs: Use `String.format(Locale, ...)` instead")
end
+ describe 'excluding_issue_ids' do
+ before do
+ fake_result = File.open("spec/fixtures/lint-result-with-everything.xml")
+ allow(File).to receive(:open).with(@android_lint.report_file).and_return(fake_result)
+ end
+
+ it 'Does not print ignored issues' do
+ @android_lint.excluding_issue_ids = ["MissingTranslation", "RtlEnabled"]
+ @android_lint.lint
+
+ markdown = @android_lint.status_report[:markdowns].first.message
+ expect(markdown).to include("Implicitly using the default locale")
+ expect(markdown).not_to include("is not translated in")
+ 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")
+ end
+ end
+
describe "for a modified file" do
before do
allow(Dir).to receive(:pwd).and_return("/Users/shivampokhriyal/Documents/projects/Commcare/commcare-android")
diff --git a/spec/fixtures/lint-result-with-everything.xml b/spec/fixtures/lint-result-with-everything.xml
index 3bc0e16..3911591 100644
--- a/spec/fixtures/lint-result-with-everything.xml
+++ b/spec/fixtures/lint-result-with-everything.xml
@@ -61,4 +61,34 @@ If you want the methods to just perform ASCII replacement, for example to conver
column="16"/>
+
+
+
+
+
+
+
+