refactor: Promote lint warnings to errors for critical issues
This commit is contained in:
parent
8fb0890622
commit
516beca43b
1 changed files with 7 additions and 7 deletions
14
lib/lint.sh
14
lib/lint.sh
|
|
@ -23,7 +23,7 @@ lint_markdown_file() {
|
|||
|
||||
# 1. Check frontmatter delimiters
|
||||
if [[ $(head -n 1 "$file") != "---" ]]; then
|
||||
warn "Missing frontmatter start (---) in: $file"
|
||||
error "Missing frontmatter start (---) in: $file"
|
||||
errors=$((errors + 1))
|
||||
fi
|
||||
|
||||
|
|
@ -31,14 +31,14 @@ lint_markdown_file() {
|
|||
local mandatory_fields=("title:" "type:" "domain:" "maturity:" "last_updated:")
|
||||
for field in "${mandatory_fields[@]}"; do
|
||||
if ! grep -q "^${field}" "$file"; then
|
||||
warn "Missing mandatory field '${field}' in: $file"
|
||||
error "Missing mandatory field '${field}' in: $file"
|
||||
errors=$((errors + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
# 3. Check domain matches genome name
|
||||
if grep -q "^domain:" "$file" && ! grep -q "^domain: ${genome_name}" "$file"; then
|
||||
warn "Domain mismatch in $file (expected '${genome_name}')"
|
||||
error "Domain mismatch in $file (expected '${genome_name}')"
|
||||
errors=$((errors + 1))
|
||||
fi
|
||||
|
||||
|
|
@ -70,8 +70,8 @@ check_valid_type() {
|
|||
done
|
||||
|
||||
if [[ $valid -eq 0 ]]; then
|
||||
warn "Invalid type value '${type_value}' in: $file"
|
||||
warn " Valid types: ${VALID_TYPES[*]}"
|
||||
error "Invalid type value '${type_value}' in: $file"
|
||||
error " Valid types: ${VALID_TYPES[*]}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
|
@ -144,8 +144,8 @@ check_knowledge_decay() {
|
|||
esac
|
||||
|
||||
if [[ $days_old -gt $threshold ]]; then
|
||||
warn "STALE: $file"
|
||||
warn " maturity: ${maturity} | last_updated: ${last_updated} | ${days_old} days ago (threshold: ${threshold})"
|
||||
error "STALE: $file"
|
||||
error " maturity: ${maturity} | last_updated: ${last_updated} | ${days_old} days ago (threshold: ${threshold})"
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue