pronto-android_lint 0.1.1 → 0.1.2

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f424e52384b0982af1eed1c405a36a48f6a1347e
4
- data.tar.gz: 16e9416d51fff23b9e979438a4e4b536eb183cf9
3
+ metadata.gz: 0ed2c615ee48cdd9ce83f444524beb9f68d81aed
4
+ data.tar.gz: 15a0ef9d2463b34fdbd08657b0e6bbb13f2acf7e
5
5
  SHA512:
6
- metadata.gz: 35660a984bba2259b6e6fc064ca9f060884dc5d01a28b8eb29c974b6d1b35a3f7a77ab04fcdf47a8eabb10ccf4591d3a265d5303be2058dabceedd64a966565e
7
- data.tar.gz: 4cb6174238894ea08cf5f3d9e073d97e7e82056dc76d64e364486b28e37f040d174a8a074c912aa54df573d528ab8514a49c9c561ea139b8a9dc9f76ee44893c
6
+ metadata.gz: fac4d41fa2df23d73deeaaa248f78f3650c26806b0079385e6c0a52d3e68fbdc5ef749b070ae873cbddc6cacc2946f6fbe3f5096c68f3e8cc07bdb97f41f1068
7
+ data.tar.gz: 6128633d7a8275046c127e6a9590c113f2cca07065c5350574cb1337f8a12360bb5e199e4ffb76e8be6a8da366a07f6b467fde12e297433172d5a0d88910d80e
@@ -1,3 +1,4 @@
1
+ require 'active_support/core_ext/object/try'
1
2
  require 'nokogiri'
2
3
 
3
4
  module Pronto
@@ -16,32 +17,25 @@ module Pronto
16
17
 
17
18
  def parse
18
19
  lint_result = File.open(@path) { |f| Nokogiri::XML(f) }
19
- lint_result.xpath("//issue").map do |issue|
20
- {
21
- path: parse_path(issue.xpath(".//location").attribute("file").value),
22
- line: issue.xpath(".//location").attribute("line").value.to_i,
23
- level: TYPE_WARNINGS[issue.attribute("severity").value],
24
- message: create_message(issue)
25
- }
20
+ lint_result.xpath("//issue").flat_map do |issue|
21
+ issue.xpath(".//location").map do |location|
22
+ {
23
+ path: location.attribute("file").try(:value),
24
+ line: location.attribute("line").try(:value).to_i,
25
+ level: TYPE_WARNINGS[issue.attribute("severity").value],
26
+ message: create_message(issue)
27
+ }
28
+ end
26
29
  end
27
30
  rescue => e
28
31
  raise "Error while parsing file: #{@path}\n#{e.message}"
29
32
  end
30
33
 
31
34
  private
32
- # removed `/builds/group/project/` from path
33
- # to match pronto patch path
34
- def parse_path(path)
35
- path.split("/")
36
- .reject(&:empty?)
37
- .drop(ENV["PRONTO_ANDROID_LINT_PATH_SHIFT"].to_i)
38
- .join("/")
39
- end
40
-
41
35
  def create_message(issue)
42
- "#{issue.attribute("summary").value}\n\n#{issue.attribute("message").value}
36
+ "#{issue.attribute("summary").try(:value)}\n\n#{issue.attribute("message").try(:value)}
43
37
 
44
- #{issue.attribute("explanation").value}"
38
+ #{issue.attribute("explanation").try(:value)}"
45
39
  end
46
40
  end
47
41
  end
@@ -1,5 +1,5 @@
1
1
  module Pronto
2
2
  module AndroidLint
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -25,7 +25,7 @@ module Pronto
25
25
 
26
26
  messages = []
27
27
 
28
- offences.select { |offence| offence[:path] == patch_path }
28
+ offences.select { |offence| offence[:path].end_with?(patch_path) }
29
29
  .each do |offence|
30
30
  messages += patch.added_lines
31
31
  .select { |line| line.new_lineno == offence[:line] }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pronto-android_lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobiasz Małecki
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.5'
83
+ - !ruby/object:Gem::Dependency
84
+ name: activesupport
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '4.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '4.0'
83
97
  description:
84
98
  email:
85
99
  - tobiasz.malecki@appunite.com
@@ -111,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
125
  version: '0'
112
126
  requirements: []
113
127
  rubyforge_project:
114
- rubygems_version: 2.6.13
128
+ rubygems_version: 2.2.0
115
129
  signing_key:
116
130
  specification_version: 4
117
131
  summary: Pronto runner for android lint