fast_code_owners 0.0.9-x86_64-linux-musl → 0.0.10-x86_64-linux-musl
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13e96e184162b0d0346dc1ebc7293f02a38826449ae4a5bfd101007e69646642
|
4
|
+
data.tar.gz: 563091d5da5a687cb3bbdba1bb1e077a2a590d2cc61d23f03ac971b0bbd46202
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9f586b568432a04df5bceaaac49b881c75227f9a389328375b5b765aa4757579833b54bdf8d5128e7ba2cd1230f25c8d23f2c9df497d1f3b3376d5be017410d
|
7
|
+
data.tar.gz: 19db0a72b48435b42662d412fb60c8008b408b684bf9af0c35969c9e0815a54c93b78af78e292bd26fe7a8c24fcbee7f08a9acd3f51c8b3414bc19c5d2dda4f3
|
Binary file
|
Binary file
|
data/lib/fast_code_owners/cli.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'optparse'
|
4
4
|
require 'pathname'
|
5
5
|
require 'fileutils'
|
6
|
+
require 'json'
|
6
7
|
|
7
8
|
module FastCodeOwners
|
8
9
|
class Cli
|
@@ -16,7 +17,7 @@ module FastCodeOwners
|
|
16
17
|
for_team(argv)
|
17
18
|
elsif [nil, 'help'].include?(command)
|
18
19
|
puts <<~USAGE
|
19
|
-
Usage: bin/
|
20
|
+
Usage: bin/codeowners <subcommand>
|
20
21
|
|
21
22
|
Subcommands:
|
22
23
|
validate - run all validations
|
@@ -25,7 +26,7 @@ module FastCodeOwners
|
|
25
26
|
help - display help information about code_ownership
|
26
27
|
USAGE
|
27
28
|
else
|
28
|
-
puts "'#{command}' is not a code_ownership command. See `bin/
|
29
|
+
puts "'#{command}' is not a code_ownership command. See `bin/codeowners help`."
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
@@ -33,7 +34,7 @@ module FastCodeOwners
|
|
33
34
|
options = {}
|
34
35
|
|
35
36
|
parser = OptionParser.new do |opts|
|
36
|
-
opts.banner = 'Usage: bin/
|
37
|
+
opts.banner = 'Usage: bin/codeowners validate [options]'
|
37
38
|
|
38
39
|
opts.on('--skip-autocorrect', 'Skip automatically correcting any errors, such as the .github/CODEOWNERS file') do
|
39
40
|
options[:skip_autocorrect] = true
|
@@ -63,17 +64,11 @@ module FastCodeOwners
|
|
63
64
|
nil
|
64
65
|
end
|
65
66
|
|
66
|
-
|
67
|
+
FastCodeOwners.validate!(
|
67
68
|
files: files,
|
68
69
|
autocorrect: !options[:skip_autocorrect],
|
69
70
|
stage_changes: !options[:skip_stage]
|
70
71
|
)
|
71
|
-
puts "cli result: #{result}"
|
72
|
-
if result.nil?
|
73
|
-
puts 'No errors found'
|
74
|
-
else
|
75
|
-
puts result
|
76
|
-
end
|
77
72
|
end
|
78
73
|
|
79
74
|
# For now, this just returns team ownership
|
@@ -87,7 +82,7 @@ module FastCodeOwners
|
|
87
82
|
files = argv.reject { |arg| arg.start_with?('--') }
|
88
83
|
|
89
84
|
parser = OptionParser.new do |opts|
|
90
|
-
opts.banner = 'Usage: bin/
|
85
|
+
opts.banner = 'Usage: bin/codeowners for_file [options]'
|
91
86
|
|
92
87
|
opts.on('--json', 'Output as JSON') do
|
93
88
|
options[:json] = true
|
@@ -102,7 +97,7 @@ module FastCodeOwners
|
|
102
97
|
parser.parse!(args)
|
103
98
|
|
104
99
|
if files.count != 1
|
105
|
-
raise 'Please pass in one file. Use `bin/
|
100
|
+
raise 'Please pass in one file. Use `bin/codeowners for_file --help` for more info'
|
106
101
|
end
|
107
102
|
|
108
103
|
team = FastCodeOwners.for_file(files.first)
|
@@ -127,7 +122,7 @@ module FastCodeOwners
|
|
127
122
|
|
128
123
|
def self.for_team(argv)
|
129
124
|
parser = OptionParser.new do |opts|
|
130
|
-
opts.banner = 'Usage: bin/
|
125
|
+
opts.banner = 'Usage: bin/codeowners for_team \'Team Name\''
|
131
126
|
|
132
127
|
opts.on('--help', 'Shows this prompt') do
|
133
128
|
puts opts
|
@@ -139,10 +134,10 @@ module FastCodeOwners
|
|
139
134
|
parser.parse!(args)
|
140
135
|
|
141
136
|
if teams.count != 1
|
142
|
-
raise 'Please pass in one team. Use `bin/
|
137
|
+
raise 'Please pass in one team. Use `bin/codeowners for_team --help` for more info'
|
143
138
|
end
|
144
139
|
|
145
|
-
puts FastCodeOwners.for_team(teams.first)
|
140
|
+
puts FastCodeOwners.for_team(teams.first).join("\n")
|
146
141
|
end
|
147
142
|
|
148
143
|
private_class_method :validate!
|
data/lib/fast_code_owners.rb
CHANGED
@@ -73,6 +73,12 @@ module FastCodeOwners
|
|
73
73
|
TeamFinder.first_owned_file_for_backtrace(backtrace, excluded_teams: excluded_teams)
|
74
74
|
end
|
75
75
|
|
76
|
+
sig { params(team: T.any(CodeTeams::Team, String)).returns(String) }
|
77
|
+
def for_team(team)
|
78
|
+
team = T.must(CodeTeams.find(team)) if team.is_a?(String)
|
79
|
+
::RustCodeOwners.for_team(team.name)
|
80
|
+
end
|
81
|
+
|
76
82
|
sig { void }
|
77
83
|
def bust_cache!
|
78
84
|
FilePathTeamCache.bust_cache!
|