Skip to content
Sarj Code Standards

concise-shell-prose

Keep shell comments and help output concise; preserve machine directives and data.

Why

Source should contain executable behavior and rare concise constraints. Comment walls and operational runbooks in help heredocs duplicate documentation.

Fix

Keep necessary comments within two nonempty lines and 40 words, and literal help output within three nonempty lines and 40 words. Move longer instructions to existing documentation; use an exact-code justified exception for a required longer contract.

Examples

Before — flagged A help branch is not a runbook
app.sh
if [[ ${1:-} == --help ]]; then
cat << 'DOC'
Usage: app
Configure the account.
Prepare the workspace.
Read the deployment runbook.
DOC
fi
After — preferred Configuration heredocs are data
app.sh
cat > settings.ini << 'DATA'
[service]
name = 'worker'
mode = 'safe'
region = 'west'
DATA
Before — flagged An ordinary comment wall is rejected
app.sh
# First explanation.
# More explanation.
# Yet more explanation.
run
After — preferred A concise hidden constraint remains local
app.sh
# The remote token expires before this lock can be retried.
run

Files

**/*.sh**/*.bash