Skip to content

Commit 9ad76c8

Browse files
fix: Potential fixes for 4 code quality findings (#12)
* Apply suggested fix to tools/validate-cross-refs.cjs from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> Signed-off-by: Scott Schreckengaust <scottschreckengaust@users.noreply.github.com> * Apply suggested fix to tools/validate-cross-refs.cjs from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> Signed-off-by: Scott Schreckengaust <scottschreckengaust@users.noreply.github.com> * Rename error and warning arrays for clarity Signed-off-by: Scott Schreckengaust <scottschreckengaust@users.noreply.github.com> --------- Signed-off-by: Scott Schreckengaust <scottschreckengaust@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
1 parent 2c145b6 commit 9ad76c8

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

tools/validate-cross-refs.cjs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ const MARKETPLACE_PATH = ".claude-plugin/marketplace.json";
1717
const PLUGINS_ROOT = "plugins";
1818

1919
const BASE_DIR = path.resolve(process.cwd(), PLUGINS_ROOT);
20-
21-
let errors = [];
22-
let warnings = [];
20+
let validationErrors = [];
21+
let validationWarnings = [];
2322

2423
/**
2524
* Resolve and validate path stays under BASE_DIR (path traversal protection).
@@ -36,12 +35,12 @@ function resolvePathUnderBase(relativePath) {
3635
}
3736

3837
function error(message) {
39-
errors.push(message);
38+
validationErrors.push(message);
4039
console.error(`ERROR: ${message}`);
4140
}
4241

4342
function warn(message) {
44-
warnings.push(message);
43+
validationWarnings.push(message);
4544
console.warn(`WARNING: ${message}`);
4645
}
4746

@@ -83,6 +82,11 @@ function validateMarketplace() {
8382
}
8483

8584
function validatePlugin(plugin) {
85+
if (!plugin || typeof plugin !== "object" || Array.isArray(plugin)) {
86+
error(`Invalid plugin entry in marketplace.json: expected an object but got ${JSON.stringify(plugin)}`);
87+
return;
88+
}
89+
8690
const pluginName = plugin.name;
8791
if (!pluginName) {
8892
error(`Plugin entry missing "name" field`);
@@ -154,10 +158,10 @@ validateMarketplace();
154158

155159
// Summary
156160
console.log("\n=== Summary ===");
157-
console.log(`Errors: ${errors.length}`);
158-
console.log(`Warnings: ${warnings.length}`);
161+
console.log(`Errors: ${validationErrors.length}`);
162+
console.log(`Warnings: ${validationWarnings.length}`);
159163

160164
// Exit with error code if any errors
161-
if (errors.length > 0) {
165+
if (validationErrors.length > 0) {
162166
process.exit(1);
163167
}

0 commit comments

Comments
 (0)