danger-missing_codeowners 1.1.0 → 1.2.0

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: 9e93a3e15840e49e1966b6bfae9e59a8bfff84539b3cc1314e6224fab84464d9
4
- data.tar.gz: 9288cb2e4e84f5c5dd09e4d0363f28276e3241d56c509f03075088401124fb4c
3
+ metadata.gz: fcd83e0d8b50b255205c5ecfbceed72c29db635c92fc27d2f2b9420b6ba5a8a6
4
+ data.tar.gz: 43a2e6402320a69e456f6c19524c8388b2be03195bf25656157fea8840069f66
5
5
  SHA512:
6
- metadata.gz: 173a41e2f5fe25c8a953e2bd1dfc78900ee4012604f70692785f8475ffae110e8a7ddb21fc20c0f70dd50093c1102804d46566ad89e401f3fd6198d70c0f50df
7
- data.tar.gz: 4e5a963fb0242853a0a0ad88637f05c2e3ae0c8ff69d8b124e403b79cbccecec866b9f23ea37512b0cdd5594e5a1f0ef6e14b79a9dd6c00e2cbc67f6de2ab06f
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.1.0)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MissingCodeowners
4
- VERSION = "1.1.0"
4
+ VERSION = "1.2.0"
5
5
  end
@@ -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.1.0
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-05-25 00:00:00.000000000 Z
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