code_ownership 1.26.0 → 1.27.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a58e46098c8c50b7888308dff49901380c69ccad8211946ff5c67d94bfd9c541
|
4
|
+
data.tar.gz: 68078aa4407fa01ad485574543dc47af49039d9b0b8a8e55af75a81ff4018ef6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cbdffd0dc477b6ed6c69dd61df2d2f6f732b3ae90acb141193e3ec1f3bd6af364c199c3abf2b29f4faddf393e75f39438aacc9f51590b3cc20736fb7deeda3d
|
7
|
+
data.tar.gz: e9604ec12ccbe6e1ae14fec8222a7cc93887d7e1ababbbcf318b7a3bbd6277f98add5ff47ff3244b068b030364177460022a8a2419a398c819d227396d2d19ee
|
@@ -25,24 +25,66 @@ module CodeOwnership
|
|
25
25
|
# https://help.github.com/en/articles/about-code-owners
|
26
26
|
HEADER
|
27
27
|
|
28
|
-
|
29
|
-
header,
|
28
|
+
expected_content_lines = [
|
29
|
+
*header.split("\n"),
|
30
|
+
nil, # For line between header and codeowners_file_lines
|
30
31
|
*codeowners_file_lines,
|
31
32
|
nil, # For end-of-file newline
|
32
|
-
]
|
33
|
+
]
|
34
|
+
|
35
|
+
expected_contents = expected_content_lines.join("\n")
|
36
|
+
actual_contents = codeowners_filepath.exist? ? codeowners_filepath.read : ""
|
37
|
+
actual_content_lines = actual_contents.split("\n")
|
33
38
|
|
34
|
-
codeowners_up_to_date =
|
39
|
+
codeowners_up_to_date = actual_contents == expected_contents
|
35
40
|
|
36
41
|
errors = T.let([], T::Array[String])
|
37
42
|
|
38
43
|
if !codeowners_up_to_date
|
39
44
|
if autocorrect
|
40
|
-
codeowners_filepath.write(
|
45
|
+
codeowners_filepath.write(expected_contents)
|
41
46
|
if stage_changes
|
42
47
|
`git add #{codeowners_filepath}`
|
43
48
|
end
|
44
49
|
else
|
45
|
-
|
50
|
+
# If there is no current file or its empty, display a shorter message.
|
51
|
+
missing_lines = expected_content_lines - actual_content_lines
|
52
|
+
extra_lines = actual_content_lines - expected_content_lines
|
53
|
+
missing_lines_text = if missing_lines.any?
|
54
|
+
<<~COMMENT
|
55
|
+
CODEOWNERS should contain the following lines, but does not:
|
56
|
+
#{(expected_content_lines - actual_content_lines).map { |line| "- \"#{line}\""}.join("\n")}
|
57
|
+
COMMENT
|
58
|
+
end
|
59
|
+
|
60
|
+
extra_lines_text = if extra_lines.any?
|
61
|
+
<<~COMMENT
|
62
|
+
CODEOWNERS should not contain the following lines, but it does:
|
63
|
+
#{(actual_content_lines - expected_content_lines).map { |line| "- \"#{line}\""}.join("\n")}
|
64
|
+
COMMENT
|
65
|
+
end
|
66
|
+
|
67
|
+
diff_text = if missing_lines_text && extra_lines_text
|
68
|
+
"#{missing_lines_text}\n#{extra_lines_text}".chomp
|
69
|
+
elsif missing_lines_text
|
70
|
+
missing_lines_text
|
71
|
+
elsif extra_lines_text
|
72
|
+
extra_lines_text
|
73
|
+
else
|
74
|
+
""
|
75
|
+
end
|
76
|
+
|
77
|
+
if actual_contents == ""
|
78
|
+
errors << <<~CODEOWNERS_ERROR
|
79
|
+
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
|
80
|
+
CODEOWNERS_ERROR
|
81
|
+
else
|
82
|
+
errors << <<~CODEOWNERS_ERROR
|
83
|
+
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
|
84
|
+
|
85
|
+
#{diff_text.chomp}
|
86
|
+
CODEOWNERS_ERROR
|
87
|
+
end
|
46
88
|
end
|
47
89
|
end
|
48
90
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code_ownership
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.27.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gusto Engineers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bigrails-teams
|