danger-regexp 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +7 -5
- data/README.md +1 -1
- data/devfile.yaml +18 -0
- data/lib/danger/regexp/version.rb +1 -1
- data/lib/danger_plugin.rb +18 -17
- metadata +3 -3
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28c69a790103ef6f30a1ca82b3a3f936cf5ac67a85aa46440ccbccf11e203eef
|
4
|
+
data.tar.gz: 8580783631028c35c43b30046e75524f5badf1e50302c8d480cd68b77a6c4287
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b84e8f189db4bb9ada2a25a83db16d20326676762a6f5fd10681fab1bc9ee7c564c0bd428ad73a5a1c85ed91f63f678baa9705d196a6c8a97952dbf9f927833f
|
7
|
+
data.tar.gz: b0e7485459e079091c94ec3454dfbc654aa301cf5ddf651d2d79b2b6487dd812f8a77476021ad169a2239f8e0449e0665311292384a77f20980d7100839f8279
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danger-regexp (1.0
|
4
|
+
danger-regexp (1.1.0)
|
5
5
|
danger
|
6
6
|
git_diff_parser (~> 3.1)
|
7
7
|
|
@@ -20,7 +20,7 @@ GEM
|
|
20
20
|
colored2 (3.1.2)
|
21
21
|
cork (0.3.0)
|
22
22
|
colored2 (~> 3.1)
|
23
|
-
danger (8.
|
23
|
+
danger (8.4.0)
|
24
24
|
claide (~> 1.0)
|
25
25
|
claide-plugins (>= 0.9.2)
|
26
26
|
colored2 (~> 3.1)
|
@@ -34,7 +34,7 @@ GEM
|
|
34
34
|
octokit (~> 4.7)
|
35
35
|
terminal-table (>= 1, < 4)
|
36
36
|
diff-lcs (1.4.4)
|
37
|
-
faraday (1.
|
37
|
+
faraday (1.8.0)
|
38
38
|
faraday-em_http (~> 1.0)
|
39
39
|
faraday-em_synchrony (~> 1.0)
|
40
40
|
faraday-excon (~> 1.1)
|
@@ -42,6 +42,7 @@ GEM
|
|
42
42
|
faraday-net_http (~> 1.0)
|
43
43
|
faraday-net_http_persistent (~> 1.1)
|
44
44
|
faraday-patron (~> 1.0)
|
45
|
+
faraday-rack (~> 1.0)
|
45
46
|
multipart-post (>= 1.2, < 3)
|
46
47
|
ruby2_keywords (>= 0.0.4)
|
47
48
|
faraday-em_http (1.0.0)
|
@@ -53,6 +54,7 @@ GEM
|
|
53
54
|
faraday-net_http (1.0.1)
|
54
55
|
faraday-net_http_persistent (1.2.0)
|
55
56
|
faraday-patron (1.0.0)
|
57
|
+
faraday-rack (1.0.0)
|
56
58
|
git (1.9.1)
|
57
59
|
rchardet (~> 1.8)
|
58
60
|
git_diff_parser (3.2.0)
|
@@ -95,9 +97,9 @@ GEM
|
|
95
97
|
sawyer (0.8.2)
|
96
98
|
addressable (>= 2.3.5)
|
97
99
|
faraday (> 0.8, < 2.0)
|
98
|
-
terminal-table (3.0.
|
100
|
+
terminal-table (3.0.2)
|
99
101
|
unicode-display_width (>= 1.1.1, < 3)
|
100
|
-
unicode-display_width (2.
|
102
|
+
unicode-display_width (2.1.0)
|
101
103
|
|
102
104
|
PLATFORMS
|
103
105
|
x86_64-linux
|
data/README.md
CHANGED
data/devfile.yaml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
apiVersion: 1.0.0
|
2
|
+
metadata:
|
3
|
+
generateName: danger-
|
4
|
+
projects:
|
5
|
+
- name: danger-regexp
|
6
|
+
source:
|
7
|
+
location: "https://github.com/mtsmfm/danger-regexp.git"
|
8
|
+
type: github
|
9
|
+
components:
|
10
|
+
- id: esbenp/prettier-vscode/latest
|
11
|
+
type: chePlugin
|
12
|
+
- mountSources: true
|
13
|
+
memoryLimit: 4Gi
|
14
|
+
type: dockerimage
|
15
|
+
alias: ruby
|
16
|
+
image: "ghcr.io/mtsmfm/devfiles/ruby:3.0"
|
17
|
+
- id: redhat/vscode-yaml/latest
|
18
|
+
type: chePlugin
|
data/lib/danger_plugin.rb
CHANGED
@@ -2,40 +2,41 @@ require 'git_diff_parser'
|
|
2
2
|
|
3
3
|
module Danger
|
4
4
|
class DangerRegexp < Plugin
|
5
|
-
MAX_COMMENT_COUNT =
|
5
|
+
MAX_COMMENT_COUNT = 1
|
6
6
|
|
7
7
|
ChangedLine = Struct.new(:file, :number, :content, keyword_init: true)
|
8
|
+
MatchArgs = Struct.new(:regexps, :message, :file, keyword_init: true)
|
8
9
|
|
9
10
|
def lint(&block)
|
10
|
-
@
|
11
|
+
@data = []
|
11
12
|
|
12
13
|
instance_eval(&block)
|
13
14
|
|
14
|
-
@
|
15
|
+
@data.each do |match_args|
|
15
16
|
count = 0
|
16
17
|
|
17
|
-
|
18
|
-
line
|
19
|
-
|
18
|
+
match_args.regexps.each do |regexp|
|
19
|
+
target_lines = changed_lines.select do |line|
|
20
|
+
(match_args.file ? line.file.match?(match_args.file) : true) && line.content.match?(regexp)
|
21
|
+
end
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
target_lines.first(MAX_COMMENT_COUNT).each do |line|
|
24
|
+
markdown(match_args.message, file: line.file, line: line.number)
|
25
|
+
end
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
if target_lines.size > MAX_COMMENT_COUNT
|
28
|
+
warn <<~MSG
|
29
|
+
Regexp `#{regexp.inspect}` matched too many lines (#{target_lines.size} lines). Only first comment is posted.
|
30
|
+
MSG
|
31
|
+
end
|
29
32
|
end
|
30
33
|
end
|
31
34
|
end
|
32
35
|
|
33
36
|
private
|
34
37
|
|
35
|
-
def match(*regexps, message)
|
36
|
-
regexps
|
37
|
-
@map[regexp] = message
|
38
|
-
end
|
38
|
+
def match(*regexps, message, file: nil)
|
39
|
+
@data << MatchArgs.new(regexps: regexps, message: message, file: file)
|
39
40
|
end
|
40
41
|
|
41
42
|
def changed_lines
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-regexp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fumiaki MATSUSHIMA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git_diff_parser
|
@@ -82,7 +82,6 @@ files:
|
|
82
82
|
- ".github/workflows/test.yml"
|
83
83
|
- ".gitignore"
|
84
84
|
- ".rspec"
|
85
|
-
- ".travis.yml"
|
86
85
|
- CHANGELOG.md
|
87
86
|
- CODE_OF_CONDUCT.md
|
88
87
|
- Gemfile
|
@@ -93,6 +92,7 @@ files:
|
|
93
92
|
- bin/console
|
94
93
|
- bin/setup
|
95
94
|
- danger-regexp.gemspec
|
95
|
+
- devfile.yaml
|
96
96
|
- lib/danger/regexp.rb
|
97
97
|
- lib/danger/regexp/version.rb
|
98
98
|
- lib/danger_plugin.rb
|