code_ownership 1.32.4 → 1.32.5
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: 18268f7457aeb632f100ea698349530dc29a4be7ae62611f416fe43782705a5b
|
4
|
+
data.tar.gz: 937353d0f07b1ff21ddf813dff047e59d4029c8ff6b08a29f75f31db61e342bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33c6f36e7a037a8495a370b738715cc2eb557912d4cb2f14df9184b329a6cc18e2c8e0a3f56fc0afd86d028ea321c2737043b8f94a88e5b3ea7c3486ff026216
|
7
|
+
data.tar.gz: 1665092ef4a69c4eecd08039fa1315be6bca38aaec17ead77573ede1c408c4b1e4a9c5a1746505310abaebe07f14c95cb088b691d71ee66b35eaa84ef40db8bd
|
@@ -13,7 +13,16 @@ module CodeOwnership
|
|
13
13
|
|
14
14
|
sig { returns(T::Array[String]) }
|
15
15
|
def self.actual_contents_lines
|
16
|
-
|
16
|
+
if !path.exist?
|
17
|
+
[""]
|
18
|
+
else
|
19
|
+
content = path.read
|
20
|
+
lines = path.read.split("\n")
|
21
|
+
if content.end_with?("\n")
|
22
|
+
lines << ""
|
23
|
+
end
|
24
|
+
lines
|
25
|
+
end
|
17
26
|
end
|
18
27
|
|
19
28
|
sig { returns(T::Array[T.nilable(String)]) }
|
@@ -64,9 +73,9 @@ module CodeOwnership
|
|
64
73
|
|
65
74
|
[
|
66
75
|
*header.split("\n"),
|
67
|
-
|
76
|
+
"", # For line between header and codeowners_file_lines
|
68
77
|
*codeowners_file_lines,
|
69
|
-
|
78
|
+
"", # For end-of-file newline
|
70
79
|
]
|
71
80
|
end
|
72
81
|
|
@@ -14,8 +14,10 @@ module CodeOwnership
|
|
14
14
|
|
15
15
|
actual_content_lines = CodeownersFile.actual_contents_lines
|
16
16
|
expected_content_lines = CodeownersFile.expected_contents_lines
|
17
|
-
|
17
|
+
missing_lines = expected_content_lines - actual_content_lines
|
18
|
+
extra_lines = actual_content_lines - expected_content_lines
|
18
19
|
|
20
|
+
codeowners_up_to_date = !missing_lines.any? && !extra_lines.any?
|
19
21
|
errors = T.let([], T::Array[String])
|
20
22
|
|
21
23
|
if !codeowners_up_to_date
|
@@ -26,8 +28,6 @@ module CodeOwnership
|
|
26
28
|
end
|
27
29
|
else
|
28
30
|
# If there is no current file or its empty, display a shorter message.
|
29
|
-
missing_lines = expected_content_lines - actual_content_lines
|
30
|
-
extra_lines = actual_content_lines - expected_content_lines
|
31
31
|
|
32
32
|
missing_lines_text = if missing_lines.any?
|
33
33
|
<<~COMMENT
|
@@ -53,7 +53,7 @@ module CodeOwnership
|
|
53
53
|
""
|
54
54
|
end
|
55
55
|
|
56
|
-
if actual_content_lines == []
|
56
|
+
if actual_content_lines == [""]
|
57
57
|
errors << <<~CODEOWNERS_ERROR
|
58
58
|
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
|
59
59
|
CODEOWNERS_ERROR
|