Skip to content

Commit 5af35ae

Browse files
fix: restore proper handling of outdated modules
Outdated modules were not being correctly processed after recent refactoring. This fixes multiple issues: 1. Recognition: Modules with category "Outdated Modules" are now properly detected alongside those with an explicit outdated field 2. Weight: These modules now get defaultSortWeight += 900 to push them down in default sorting 3. Checks: All validation checks are now skipped for outdated modules (performance improvement and prevents unnecessary warnings) 4. Data: The outdated field is now properly parsed from wiki markdown (5th column) and auto-populated for "Outdated Modules" category Changes: - scripts/check-modules/index.ts: Detect outdated by category OR field, skip checks, set issues=true, add +900 weight - scripts/collect-metadata/parser.js: Parse optional 5th column as outdated information - scripts/collect-metadata/index.js: Auto-populate outdated field for modules in "Outdated Modules" category if not set Fixes the issue where outdated modules had low defaultSortWeight values (e.g., 15) instead of 900+, and were still being checked despite being marked as outdated.
1 parent 407838c commit 5af35ae

3 files changed

Lines changed: 31 additions & 12 deletions

File tree

scripts/check-modules/index.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -748,29 +748,29 @@ async function checkWorkflowOptimization({ moduleDir, issues, config }) {
748748

749749
// Parse output to check if there are any eligible jobs
750750
const lines = stdout.split("\n");
751-
751+
752752
// Count safe and attention jobs separately
753753
const safeMatch = lines.find((line) => line.includes("✅") && line.includes("can be safely migrated"));
754754
const attentionMatch = lines.find((line) => line.includes("⚠️") && line.includes("can be migrated but require attention"));
755-
755+
756756
let safeCount = 0;
757757
let attentionCount = 0;
758-
758+
759759
if (safeMatch) {
760760
const match = safeMatch.match(/(\d+)\s+job\(s\)\s+can be safely migrated/);
761761
if (match) safeCount = parseInt(match[1], 10);
762762
}
763-
763+
764764
if (attentionMatch) {
765765
const match = attentionMatch.match(/(\d+)\s+job\(s\)\s+can be migrated but require attention/);
766766
if (match) attentionCount = parseInt(match[1], 10);
767767
}
768-
768+
769769
const totalEligible = safeCount + attentionCount;
770-
770+
771771
if (totalEligible > 0) {
772772
let message = "Recommendation: ";
773-
773+
774774
if (safeCount > 0 && attentionCount > 0) {
775775
const safePlural = safeCount > 1 ? "s" : "";
776776
const attentionPlural = attentionCount > 1 ? "s" : "";
@@ -782,7 +782,7 @@ async function checkWorkflowOptimization({ moduleDir, issues, config }) {
782782
const plural = attentionCount > 1 ? "s" : "";
783783
message += `${attentionCount} GitHub Actions job${plural} could potentially use \`ubuntu-slim\` but may require additional setup.`;
784784
}
785-
785+
786786
message += " Run \`gh slimify --all\` in the repository for details.";
787787
addIssue(issues, message);
788788
}
@@ -1446,17 +1446,19 @@ async function main() {
14461446

14471447
const repoExists = await pathExists(moduleDir);
14481448
let handledOutdated = false;
1449+
const isOutdated = module.outdated || module.category === "Outdated Modules";
14491450

14501451
if (!repoExists) {
14511452
moduleIssues = [
14521453
"Error: It appears that the repository could not be cloned. Check the URL."
14531454
];
14541455
module.issues = moduleIssues;
1455-
} else if (module.outdated) {
1456+
} else if (isOutdated) {
1457+
// Outdated modules: add heavy weight, skip all checks
14561458
module.defaultSortWeight += 900;
14571459
stats.modulesWithIssuesCounter += 1;
14581460
stats.issueCounter += 1;
1459-
module.issues = false;
1461+
module.issues = true;
14601462
handledOutdated = true;
14611463
} else {
14621464
// Try to use cached result for incremental checking

scripts/collect-metadata/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,14 @@ async function main() {
366366
const { modules } = parseModuleList(markdown);
367367
logger.info(`Parsed ${modules.length} modules from Wiki.`);
368368

369+
// Ensure modules in "Outdated Modules" category have an outdated field
370+
for (const module of modules) {
371+
if (module.category === "Outdated Modules" && !module.outdated) {
372+
// If no specific reason is provided, add a generic message
373+
module.outdated = "This module is marked as outdated in the official module list.";
374+
}
375+
}
376+
369377
const previousModulesMap = loadPreviousModules();
370378

371379
// Load cache to enable pruning

scripts/collect-metadata/parser.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ export function parseModuleList(markdown) {
6060
const name = repoMatch[1].trim(); // Use the link text as the name initially
6161
const maintainerCell = parts[2] || "";
6262
const description = parts[3] || "";
63+
// Optional 5th column for outdated information (for "Outdated Modules" category)
64+
const outdatedInfo = parts[4] ? parts[4].trim() : "";
6365

6466
let maintainer = maintainerCell;
6567

@@ -80,7 +82,7 @@ export function parseModuleList(markdown) {
8082
const id = getRepositoryId(url) || name.replace(/\s+/gu, "-");
8183
const maintainerURL = getMaintainerURL(url);
8284

83-
modules.push({
85+
const moduleEntry = {
8486
name,
8587
url,
8688
id,
@@ -89,7 +91,14 @@ export function parseModuleList(markdown) {
8991
maintainerURL,
9092
category,
9193
issues: []
92-
});
94+
};
95+
96+
// Add outdated field if present and non-empty
97+
if (outdatedInfo && outdatedInfo.length > 0) {
98+
moduleEntry.outdated = outdatedInfo;
99+
}
100+
101+
modules.push(moduleEntry);
93102
}
94103
}
95104
}

0 commit comments

Comments
 (0)