danger-missing_codeowners 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -1
- data/lib/missing_codeowners/gem_version.rb +1 -1
- data/lib/missing_codeowners/plugin.rb +5 -1
- data/spec/missing_codeowners_spec.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcd83e0d8b50b255205c5ecfbceed72c29db635c92fc27d2f2b9420b6ba5a8a6
|
4
|
+
data.tar.gz: 43a2e6402320a69e456f6c19524c8388b2be03195bf25656157fea8840069f66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fac672eff7a5197a07065fcfd8ab2c5b7546d4ed33071e2a6d4e00fa6366f8579d9e4fd9af726ba03ac8776c571af6bc02c8d624c24a3ed5792102567821cc97
|
7
|
+
data.tar.gz: b82d354dcc331dc13abb1958374edb8dc72c55a71eb056bd8f1a4f846682101167a17fdb1af9c6576aea3a3d412e357b23c218beb5fad7797e3367865a7c99c2
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danger-missing_codeowners (1.
|
4
|
+
danger-missing_codeowners (1.2.0)
|
5
5
|
danger-plugin-api (~> 1.0)
|
6
6
|
pathspec (~> 1.0.0)
|
7
7
|
|
@@ -134,6 +134,7 @@ GEM
|
|
134
134
|
|
135
135
|
PLATFORMS
|
136
136
|
arm64-darwin-21
|
137
|
+
ruby
|
137
138
|
x86_64-darwin-20
|
138
139
|
|
139
140
|
DEPENDENCIES
|
@@ -59,7 +59,7 @@ module Danger
|
|
59
59
|
#
|
60
60
|
# @return [void]
|
61
61
|
#
|
62
|
-
def verify(*opts)
|
62
|
+
def verify(*opts, &block)
|
63
63
|
@verify_all_files ||= false
|
64
64
|
@max_number_of_files_to_report ||= 100
|
65
65
|
@severity ||= "error"
|
@@ -86,8 +86,12 @@ module Danger
|
|
86
86
|
markdown format_missing_owners_message(@files_missing_codeowners, @max_number_of_files_to_report)
|
87
87
|
danger_message = "Add CODEOWNERS rules to match all files."
|
88
88
|
@severity == "error" ? (fail danger_message) : (warn danger_message)
|
89
|
+
|
90
|
+
yield @files_missing_codeowners if block
|
89
91
|
else
|
90
92
|
log "No files missing CODEOWNERS."
|
93
|
+
|
94
|
+
yield [] if block
|
91
95
|
end
|
92
96
|
|
93
97
|
log "-----"
|
@@ -75,6 +75,26 @@ module Danger
|
|
75
75
|
expect(@my_plugin.files_missing_codeowners.length).to eq(0)
|
76
76
|
end
|
77
77
|
|
78
|
+
it "calls the block with an empty array if there are no missing files" do
|
79
|
+
allow(@my_plugin).to receive(:git_modified_files).and_return(["any_file.yml", "any_file.go"])
|
80
|
+
|
81
|
+
@my_plugin.verify do |x|
|
82
|
+
expect(x).to eq []
|
83
|
+
end
|
84
|
+
|
85
|
+
expect(@my_plugin.files_missing_codeowners.length).to eq(0)
|
86
|
+
end
|
87
|
+
|
88
|
+
it "calls the block with the list of missing files if there are missing files" do
|
89
|
+
allow(@my_plugin).to receive(:git_modified_files).and_return(["myfile"])
|
90
|
+
|
91
|
+
@my_plugin.verify do |x|
|
92
|
+
expect(x).to eq ["myfile"]
|
93
|
+
end
|
94
|
+
|
95
|
+
expect(@my_plugin.files_missing_codeowners.length).to eq(1)
|
96
|
+
end
|
97
|
+
|
78
98
|
it "fails when there are files without CODEOWNERS rules and severity is error" do
|
79
99
|
@my_plugin.verify_all_files = true
|
80
100
|
allow(@my_plugin).to receive(:git_all_files).and_return(["app/source.swift", ".swiftlint.yml"])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-missing_codeowners
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- andre-alves
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|