danger 8.0.4 → 8.0.5

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
  SHA256:
3
- metadata.gz: 24f1ad8fc490aea6b75f155f5acb47d5b126c23b7bab8392080557dca1bee597
4
- data.tar.gz: 88c387703dcb3efc9fed05f38fa03ec2ba2b46a69cc287a9d368750b48d155ca
3
+ metadata.gz: f6ea9c4a38578c0c9cd6e762b689010bce9de3bc6479134cce2f6c45afdce925
4
+ data.tar.gz: 4f131339c436c4ee163660341e0471c0c456b0251da17c6a5f5511f2fc3ac708
5
5
  SHA512:
6
- metadata.gz: 17bbad4f7cc06de57c08ff9360dd591084959c3f23d40ed58481f8bc5aa82036a04d3376cf5fdc8f50400e0733e18bc85e0db0631a8da0cb3ea27b692697c105
7
- data.tar.gz: 1da0fe48081c9fa19acc9bb7df3df1ae2efe4b919f38656503e52f52ed6142ea17499a5928bc47ba5fb352370bbb2152e4cf969c44b87dbef0d6250526349ee6
6
+ metadata.gz: 93226e7a7fe9b4300efb93ac07e59932eda1b25cae739f1f48d132f0d77f9d5f6a861d226785981f6580587cfd11380db5ec4e0935adea7c3707f35a5dc2af3d
7
+ data.tar.gz: 7cca48807d7cb110180f88b62d1af13591ba83791f0f1528384dcd2c4c3247394fec2abfb9c1bc592e496659d3d14f6f46e1813af125570c967713b9d602251c
@@ -50,16 +50,29 @@ module Danger
50
50
  self.repo_url = env["GIT_REPOSITORY_URL"]
51
51
 
52
52
  matcher_url = self.repo_url
53
+ self.repo_slug = repo_slug_from(self.repo_url)
54
+ end
53
55
 
54
- #If the URL contains https:// as :// leads to inaccurate matching. So we remove it and proceed to match.
55
- if repo_url.include? "https://"
56
- matcher_url["https://"] = ''
56
+ def repo_slug_from(url)
57
+ if url =~ URI::regexp
58
+ # Try to parse the URL as a valid URI. This should cover the cases of http/https/ssh URLs.
59
+ begin
60
+ uri = URI.parse(url)
61
+ return uri.path.sub(/^(\/)/,'').sub(/(.git)$/,'')
62
+ rescue URI::InvalidURIError
63
+ # In case URL could not be parsed fallback to git URL parsing.
64
+ repo_slug_asgiturl(url)
65
+ end
66
+ else
67
+ # In case URL could not be parsed fallback to git URL parsing. git@github.com:organization/repo.git
68
+ repo_slug_asgiturl(url)
57
69
  end
70
+ end
58
71
 
72
+ def repo_slug_asgiturl(url)
73
+ matcher_url = url
59
74
  repo_matches = matcher_url.match(%r{([\/:])(([^\/]+\/)+[^\/]+?)(\.git$|$)})[2]
60
-
61
- self.repo_slug = repo_matches unless repo_matches.nil?
62
-
75
+ return repo_matches unless repo_matches.nil?
63
76
  end
64
77
  end
65
78
  end
@@ -208,7 +208,7 @@ module Danger
208
208
  rest_inline_violations = submit_inline_comments!({
209
209
  danger_id: danger_id,
210
210
  previous_violations: previous_violations
211
- }.merge(inline_violations))
211
+ }.merge(**inline_violations))
212
212
 
213
213
  main_violations = merge_violations(
214
214
  regular_violations, rest_inline_violations
@@ -227,7 +227,7 @@ module Danger
227
227
  template: "gitlab",
228
228
  danger_id: danger_id,
229
229
  previous_violations: previous_violations
230
- }.merge(main_violations))
230
+ }.merge(**main_violations))
231
231
 
232
232
  comment_result =
233
233
  if should_create_new_comment
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "8.0.4".freeze
2
+ VERSION = "8.0.5".freeze
3
3
  DESCRIPTION = "Like Unit Tests, but for your Team Culture.".freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.4
4
+ version: 8.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Orta Therox
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-07-21 00:00:00.000000000 Z
12
+ date: 2020-08-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide
@@ -107,14 +107,14 @@ dependencies:
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '2.0'
110
+ version: '2.3'
111
111
  type: :runtime
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '2.0'
117
+ version: '2.3'
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: kramdown-parser-gfm
120
120
  requirement: !ruby/object:Gem::Requirement