1
0
Fork
You've already forked shlinters
0
bash linters
  • Shell 100%
2026年03月16日 14:03:46 +01:00
smd @5f5ea6a2cc upd to 0.7.2 beta-5 2026年03月16日 11:39:13 +01:00
u_codespell @9e89f8d449 bugfix 2026年03月16日 14:03:46 +01:00
.gitignore .gitignore 2025年10月13日 14:51:51 +02:00
.gitmodules added smd 2025年11月24日 02:35:44 +01:00
end-of-file-fixer.sh a few details 2025年12月06日 19:50:24 +01:00
expand-tabs.sh a few details 2025年12月06日 19:50:24 +01:00
get_smd.sh smd auto-update 2025年12月06日 19:48:03 +01:00
get_u_codespell.sh get_u_codespell.sh 2025年10月13日 21:53:14 +02:00
GPL3.txt license 2025年10月13日 07:46:32 +02:00
line-endings.sh line-endings.sh 2025年10月14日 23:48:44 +02:00
parallel.sh parallel.sh bugfix 2025年10月31日 17:57:49 +01:00
Readme.md update 2025年12月14日 01:17:41 +01:00
trailing-whitespace.sh trailing-whitespace.sh 2025年10月14日 22:07:46 +02:00
update.sh smd auto-update 2025年12月06日 19:48:03 +01:00

shlinters

Description

shlinters is a set of bash linters and utilities for linters. They are posix, except u_codespell that, for now, uses a GNU extension (grep -H) and smd that requires GNU sed.

1 - Linters

So far, only three trivial linters are proposed. Feel free to request others.

Two links to non-trivial ones are also proposed.

1.1 end-of-file-fixer.sh, trailing-whitespace.sh, line-endings.sh

As the name suggests, these are equivalents of the pre-commit linters of the same name, but faster.

1.2 expand-tabs.sh

As the name suggest. See expand-tabs.sh -h.

1.3 get_u_codespell.sh

This allows to download u_codespell to a subdir. u_codespell is an alternative bash front-end for codespell.

1.4 get_smd.sh

This allows to download smd to a subdir. smd is a high quality markdown reader for the terminal and linter.

2 - Meta-scripts

2.1 parallel.sh

This allows to use a linter with a decent parallelism management. By default, uses 1 thread per CPU core and split the input file list accordingly in order to have it processed in parallel by n instances of the specified linter. The outputs are concatenated and the return codes are or-ed.

Allows to use k cores per process (useful for fixed-parallelism linters, such as bash linters), and also allows a limited (so far) form of total size balancing amongst the processes with -b. This is useful for slow linters, such as any pre-commit builtin linter, and u_codespell/codespell. The later benefits from having 2 cores per thread (as most bash scripts do).

In terms of speed, any pre-commit hook would benefit from using require_serial=true and wrapping the call into the relevant parallel.sh call (try with and without -b, with different values 1, 2, and more for cores/thread). This is a simple workaround for pre-commit limited parallelism management.

Try parallel.sh -h for more details.

2.2 update.sh

It updates the whole dir with the latest version of scripts downloaded from codeberg. If u_codespell was downloaded, it is also updated.

3 - Bugs, Features and Suggestions

Bug reports, feature requests, suggestions and any questions are welcomed here.

4 - License

All scripts are under GPL3