Skip to content
Merged
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
24 changes: 21 additions & 3 deletions .agents/scripts/linters-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,9 @@
fi

if [[ -n "$markdownlint_cmd" ]]; then
# Run markdownlint and capture output
local lint_output
lint_output=$($markdownlint_cmd $md_files 2>&1) || true
# Run markdownlint and capture output; preserve exit code separately
local lint_output lint_exit=0
lint_output=$($markdownlint_cmd $md_files 2>&1) || lint_exit=$?

if [[ -n "$lint_output" ]]; then
# Count violations - ensure single integer (grep -c can fail, use wc -l as fallback)
Expand Down Expand Up @@ -539,6 +539,24 @@
print_warning "Markdown: $violations style issues found (advisory)"
return 0
fi
elif [[ $lint_exit -ne 0 ]]; then
# markdownlint failed for a non-rule reason (bad config, invalid args, etc.)
# Output doesn't match MD[0-9] pattern so violation_count=0, but the tool itself errored
print_error "Markdown: markdownlint failed with exit code $lint_exit (non-rule error)"
echo "$lint_output"
if [[ "$check_mode" == "changed" ]]; then
return 1
else
return 0
fi
fi
elif [[ $lint_exit -ne 0 ]]; then
# markdownlint failed with no output (e.g., config parse error with no stderr)
print_error "Markdown: markdownlint failed with exit code $lint_exit (no output)"
if [[ "$check_mode" == "changed" ]]; then

Check warning on line 556 in .agents/scripts/linters-local.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal 'changed' 4 times.

See more on https://sonarcloud.io/project/issues?id=marcusquinn_aidevops&issues=AZzrmsGitB6A8wBpFZ7w&open=AZzrmsGitB6A8wBpFZ7w&pullRequest=4737
return 1
else
return 0
fi
fi
print_success "Markdown: No style issues found"
Expand Down
Loading