danger-spotbugs 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9961e4cd791f6d0ccdc80ecdad48aede2197f160c98e57627bcfd0808b44c5e0
4
- data.tar.gz: 62bc0d1208a0fadc6458d84a75bfa3d4cee8ee72c1090d2c9e90d9bc63e2769c
3
+ metadata.gz: 8813e879ca3e2f0574b73b106872369a3b341d46e1b08ec7ac0ee9c89b8ff73d
4
+ data.tar.gz: b4b6566b2234e34cca5950cae9a8dada5398a7f4ef3627abe9871ac611f6f3bd
5
5
  SHA512:
6
- metadata.gz: 8e4fae36b5a28e4a3564d8ff353c18e05f7d875784143760341d8bf188158cc962939d2d8600e28137d21cdedee259c0714bde8905775a505667d8364951a188
7
- data.tar.gz: f77ee2d02b2fb6dda7a3fd4af76cddb69d4dfb370a2edb0793586e65b4459d604c0acc4d4a74efc8cee290243542ae2967ce0d6fbd53df3a7d2ebc55b6aca55f
6
+ metadata.gz: 195edf7c7eaaed5c3efefe7327b8c453ccbc7a3e78dce6b52986d52a8f83c40a259ce38cc71d68af358b4e139e992abd85d29724231105d2b4b7fc35ea5d7e17
7
+ data.tar.gz: f849b2ae5af1fb6bb44395a0b9cd773df30f47d74bea2288c00fa2eadf0d01487e1a7fe6eefcd8b9bbfbef78dceb5c42feda8ee914497a051234d82085c3cd56
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-spotbugs (0.0.2)
4
+ danger-spotbugs (0.0.3)
5
5
  danger-plugin-api (~> 1.0)
6
6
  oga (~> 2.15)
7
7
 
@@ -40,13 +40,17 @@ GEM
40
40
  danger (> 2.0)
41
41
  diff-lcs (1.4.4)
42
42
  docile (1.3.5)
43
- faraday (1.3.0)
43
+ faraday (1.4.1)
44
+ faraday-excon (~> 1.1)
44
45
  faraday-net_http (~> 1.0)
46
+ faraday-net_http_persistent (~> 1.1)
45
47
  multipart-post (>= 1.2, < 3)
46
- ruby2_keywords
48
+ ruby2_keywords (>= 0.0.4)
49
+ faraday-excon (1.1.0)
47
50
  faraday-http-cache (2.2.0)
48
51
  faraday (>= 0.8)
49
52
  faraday-net_http (1.0.1)
53
+ faraday-net_http_persistent (1.1.0)
50
54
  ffi (1.15.0)
51
55
  formatador (0.2.5)
52
56
  git (1.8.1)
@@ -81,7 +85,7 @@ GEM
81
85
  notiffany (0.1.3)
82
86
  nenv (~> 0.1)
83
87
  shellany (~> 0.0)
84
- octokit (4.20.0)
88
+ octokit (4.21.0)
85
89
  faraday (>= 0.9)
86
90
  sawyer (~> 0.8.0, >= 0.5.3)
87
91
  oga (2.15)
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Mathieu Rul <mathroule@gmail.com>
3
+ Copyright (c) 2021 Mathieu Rul
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Danger SpotBugs
2
- [![Latest release](https://img.shields.io/github/v/release/mathroule/danger-spotbugs.svg)](https://github.com/mathroule/danger-spotbugs/releases/latest) [![Deploy](https://github.com/mathroule/danger-spotbugs/workflows/Deploy/badge.svg)](https://github.com/mathroule/danger-spotbugs/actions) [![codecov](https://codecov.io/gh/mathroule/danger-spotbugs/branch/main/graph/badge.svg?token=KW312ANXPN)](https://codecov.io/gh/mathroule/danger-spotbugs)
2
+ [![Latest release](https://img.shields.io/github/v/release/mathroule/danger-spotbugs.svg)](https://github.com/mathroule/danger-spotbugs/releases/latest) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Deploy](https://github.com/mathroule/danger-spotbugs/workflows/Deploy/badge.svg)](https://github.com/mathroule/danger-spotbugs/actions) [![codecov](https://codecov.io/gh/mathroule/danger-spotbugs/branch/main/graph/badge.svg?token=KW312ANXPN)](https://codecov.io/gh/mathroule/danger-spotbugs)
3
3
 
4
4
  Checks on your Gradle project's Java source files.
5
5
  This is done using [SpotBugs](https://spotbugs.github.io)
@@ -10,15 +10,11 @@ class BugInstance
10
10
  @source_dirs = source_dirs
11
11
  @bug_instance = bug_instance
12
12
 
13
- source_path = bug_instance.xpath('SourceLine').attribute('sourcepath').first.value.to_s
13
+ source_path = get_source_path(bug_instance)
14
14
  @absolute_path = get_absolute_path(source_path)
15
15
 
16
16
  prefix += (prefix.end_with?(file_separator) ? '' : file_separator)
17
- @relative_path = if @absolute_path.start_with?(prefix)
18
- @absolute_path[prefix.length, @absolute_path.length - prefix.length]
19
- else
20
- @absolute_path
21
- end
17
+ @relative_path = get_relative_path(prefix, @absolute_path)
22
18
  end
23
19
 
24
20
  def rank
@@ -30,7 +26,7 @@ class BugInstance
30
26
  end
31
27
 
32
28
  def line
33
- @line ||= bug_instance.xpath('SourceLine').attribute('start').first.value.to_i
29
+ @line ||= bug_instance.xpath('SourceLine').attribute('start').compact.first.value.to_i
34
30
  end
35
31
 
36
32
  def description
@@ -39,12 +35,24 @@ class BugInstance
39
35
 
40
36
  private
41
37
 
38
+ def get_source_path(bug_instance)
39
+ bug_instance.xpath('SourceLine').attribute('sourcepath').compact.first.value.to_s
40
+ end
41
+
42
42
  def get_absolute_path(source_path)
43
43
  @source_dirs.map do |source_dir|
44
44
  return source_dir if source_dir.end_with?(source_path)
45
45
  end
46
46
  end
47
47
 
48
+ def get_relative_path(prefix, absolute_path)
49
+ if absolute_path.start_with?(prefix)
50
+ absolute_path[prefix.length, absolute_path.length - prefix.length]
51
+ else
52
+ absolute_path
53
+ end
54
+ end
55
+
48
56
  def file_separator
49
57
  File::ALT_SEPARATOR || File::SEPARATOR
50
58
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spotbugs
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-spotbugs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathieu Rul
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-23 00:00:00.000000000 Z
11
+ date: 2021-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger-plugin-api
@@ -253,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
253
253
  - !ruby/object:Gem::Version
254
254
  version: '0'
255
255
  requirements: []
256
- rubygems_version: 3.2.3
256
+ rubygems_version: 3.2.15
257
257
  signing_key:
258
258
  specification_version: 4
259
259
  summary: A Danger plugin for SpotBugs, see https://spotbugs.github.io.