Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ def detect_format(file_path: str, sample_size_bytes: int = 1_048_576, s3_client=
if args.json:
output = {
"format_type": result.format_type.value,
"is_valid": result.is_valid, # nosemgrep: python.lang.maintainability.is-function-without-parentheses -- dataclass field, not a method
"is_valid": result.is_valid, # nosemgrep: python.lang.maintainability.is-function-without-parentheses.is-function-without-parentheses -- dataclass field, not a method
"confidence": result.confidence.value,
"lines_sampled": result.lines_sampled,
"errors": [
Expand All @@ -664,15 +664,15 @@ def detect_format(file_path: str, sample_size_bytes: int = 1_048_576, s3_client=
print(json.dumps(output, indent=2))
else:
print(f"Format: {result.format_type.value}")
print(f"Valid: {'✓' if result.is_valid else '✗'}") # nosemgrep: python.lang.maintainability.is-function-without-parentheses -- dataclass field, not a method
print(f"Valid: {'✓' if result.is_valid else '✗'}") # nosemgrep: python.lang.maintainability.is-function-without-parentheses.is-function-without-parentheses -- dataclass field, not a method
print(f"Confidence: {result.confidence.name}")
print(f"Lines sampled: {result.lines_sampled}")
if result.errors:
print("Errors:")
for err in result.errors:
print(f" Line {err.line_number}: {err.message}")

sys.exit(0 if result.is_valid else 1) # nosemgrep: python.lang.maintainability.is-function-without-parentheses -- dataclass field, not a method
sys.exit(0 if result.is_valid else 1) # nosemgrep: python.lang.maintainability.is-function-without-parentheses.is-function-without-parentheses -- dataclass field, not a method
except (FileNotFoundError, IOError, ValueError) as e:
print(f"Error: {e}", file=sys.stderr)
sys.exit(1)
2 changes: 2 additions & 0 deletions tools/validate-cross-refs.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ function info(message) {

function validateMarketplace(marketplacePath, manifestPathParts) {
// Check marketplace.json exists
// nosemgrep: gitlab.eslint.detect-non-literal-fs-filename, javascript.lang.security.audit.detect-non-literal-fs-filename.detect-non-literal-fs-filename -- callers pass hardcoded constants, not user input
if (!fs.existsSync(marketplacePath)) {
error(`Marketplace file not found: ${marketplacePath}`);
return;
}

let marketplace;
try {
// nosemgrep: gitlab.eslint.detect-non-literal-fs-filename, javascript.lang.security.audit.detect-non-literal-fs-filename.detect-non-literal-fs-filename -- callers pass hardcoded constants, not user input
marketplace = JSON.parse(fs.readFileSync(marketplacePath, "utf8"));
} catch (e) {
error(`Failed to parse ${marketplacePath}: ${e.message}`);
Expand Down
Loading