Skip to content

executable_has_shebang

Every file with +x set must begin with #!. Catches plain text files accidentally marked executable.

This rule takes no kind-specific options.

Plus the common paths, level, id, and when fields. This table is generated from the JSON Schema; option types and defaults are authoritative.

The rule fires on this repository:

README.md
scripts/
scripts/run (executable)
README.md
# demo
scripts/run
echo hi

With this .alint.yml:

version: 1
rules:
- id: exec-shebang
kind: executable_has_shebang
paths: "scripts/**"
level: error

alint check reports:

Terminal window
--- scripts/run ----------------------------------------------------------------
x error exec-shebang
executable file has no shebang (#!)
Summary (1 violation):
x 1 error
0 passing * 1 failing

This repository is compliant:

README.md
scripts/
scripts/hello.sh (executable)
README.md
# demo
scripts/hello.sh
#!/bin/sh
echo hi

With this .alint.yml:

version: 1
rules:
- id: exec-shebang
kind: executable_has_shebang
paths: "scripts/**"
level: error

alint check reports:

Terminal window
v All 1 rule(s) passed.