Skip to content

Commit 7e80fdf

Browse files
stevsmitSteven Smith
andauthored
Removes unused attributes (quay#1420)
Co-authored-by: Steven Smith <[email protected]>
1 parent a9e9df5 commit 7e80fdf

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

modules/attributes.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
:rhel-short: RHEL
1111
:ocp-y: 4.18
1212
:product-rosa: Red{nbsp}Hat OpenShift Service on AWS
13+
:cso: Container Security Operator
1314

1415
ifeval::["{productname}" == "Project Quay"]
1516
:upstream:
@@ -36,7 +37,6 @@ ifeval::["{productname}" == "Red Hat Quay"]
3637
:productmin: 3.15.1
3738
:productminv: v3.15.1
3839
:productrepo: registry.redhat.io/quay
39-
:clairnewver: v3.14
4040
:quayimage: quay-rhel8
4141
:clairimage: clair-rhel8
4242
:clairproductminv: 4.8

scan_adoc_duplicates.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import os
2+
import re
3+
from collections import defaultdict
4+
import sys
5+
6+
BASE_DIR = sys.argv[1] if len(sys.argv) > 1 else "."
7+
8+
# Regex to match include lines for modules (allowing ../, attributes, etc.)
9+
INCLUDE_PATTERN = re.compile(r'include::(?:\.\./)*modules/([^[]+)\.adoc')
10+
11+
# Dictionary: module -> set of assemblies where it's included
12+
module_usage = defaultdict(set)
13+
14+
for root, _, files in os.walk(BASE_DIR):
15+
for file in files:
16+
if file.endswith(".adoc"):
17+
file_path = os.path.join(root, file)
18+
with open(file_path, "r", encoding="utf-8") as f:
19+
for line in f:
20+
match = INCLUDE_PATTERN.search(line)
21+
if match:
22+
module_name = match.group(1)
23+
# Treat any .adoc outside of modules/ as an assembly
24+
if "modules" not in file_path:
25+
module_usage[module_name].add(file_path)
26+
27+
# Print results
28+
print("Modules included in more than one assembly:\n")
29+
for module, assemblies in sorted(module_usage.items()):
30+
if len(assemblies) > 1:
31+
print(f"{module}.adoc")
32+
for asm in sorted(assemblies):
33+
print(f" - {asm}")
34+
print()

0 commit comments

Comments
 (0)