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
|
# 1. Check frontmatter delimiters
|
||||||
if [[ $(head -n 1 "$file") != "---" ]]; then
|
if [[ $(head -n 1 "$file") != "---" ]]; then
|
||||||
warn "Missing frontmatter start (---) in: $file"
|
error "Missing frontmatter start (---) in: $file"
|
||||||
errors=$((errors + 1))
|
errors=$((errors + 1))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -31,14 +31,14 @@ lint_markdown_file() {
|
||||||
local mandatory_fields=("title:" "type:" "domain:" "maturity:" "last_updated:")
|
local mandatory_fields=("title:" "type:" "domain:" "maturity:" "last_updated:")
|
||||||
for field in "${mandatory_fields[@]}"; do
|
for field in "${mandatory_fields[@]}"; do
|
||||||
if ! grep -q "^${field}" "$file"; then
|
if ! grep -q "^${field}" "$file"; then
|
||||||
warn "Missing mandatory field '${field}' in: $file"
|
error "Missing mandatory field '${field}' in: $file"
|
||||||
errors=$((errors + 1))
|
errors=$((errors + 1))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# 3. Check domain matches genome name
|
# 3. Check domain matches genome name
|
||||||
if grep -q "^domain:" "$file" && ! grep -q "^domain: ${genome_name}" "$file"; then
|
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))
|
errors=$((errors + 1))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -70,8 +70,8 @@ check_valid_type() {
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $valid -eq 0 ]]; then
|
if [[ $valid -eq 0 ]]; then
|
||||||
warn "Invalid type value '${type_value}' in: $file"
|
error "Invalid type value '${type_value}' in: $file"
|
||||||
warn " Valid types: ${VALID_TYPES[*]}"
|
error " Valid types: ${VALID_TYPES[*]}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -144,8 +144,8 @@ check_knowledge_decay() {
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ $days_old -gt $threshold ]]; then
|
if [[ $days_old -gt $threshold ]]; then
|
||||||
warn "STALE: $file"
|
error "STALE: $file"
|
||||||
warn " maturity: ${maturity} | last_updated: ${last_updated} | ${days_old} days ago (threshold: ${threshold})"
|
error " maturity: ${maturity} | last_updated: ${last_updated} | ${days_old} days ago (threshold: ${threshold})"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue