file_types

Filter files in a run templates by their type. Supported types:

File typeExlanation
textAny file that contains text. Symlinks are not followed.
binaryAny file that contains non-text bytes. Symlinks are not followed.
executableAny file that has executable bits set. Symlinks are not followed.
not executableAny file without executable bits in file mode. Symlinks included.
symlinkA symlink file.
not symlinkAny non-symlink file.

Important: When passed multiple file types all constraints will be applied to the resulting list of files

Examples

Apply some different linters on text and binary files.

# lefthook.yml pre-commit: commands: lint-code: run: yarn lint {staged_files} file_types: text check-hex-codes: run: yarn check-hex {staged_files} file_types: binary

Skip symlinks.

# lefthook.yml pre-commit: commands: lint: run: yarn lint --fix {staged_files} file_types: - not symlink

Lint executable scripts.

# lefthook.yml pre-commit: commands: lint: run: yarn lint --fix {staged_files} file_types: - executable - text