parallel-lint
Run multiple linters in parallel
TLDR
Lint a specific directory
Lint a directory using the specified number of parallel processes
Lint a directory, excluding the specified directory
Lint a directory of files using a comma-separated list of extension(s)
Lint a directory and output the results as JSON
Lint a directory and show Git Blame results for rows containing errors
SYNOPSIS
parallel-lint [options] [-- paths...]
parallel-lint --stdin [options]
parallel-lint --diff [options] [paths...]
PARAMETERS
-p num, --process num
Number of parallel processes to use. Defaults to the number of CPU cores.
--exclude path
Exclude files or directories matching the given path (can be used multiple times).
--lint-extensions ext1,ext2,...
Comma-separated list of file extensions to lint. Overrides default extensions for a given linter.
--stdin
Read file paths from standard input, one path per line.
--diff
Only lint files that have changed according to a Git diff (defaulting to HEAD vs. local changes).
--staged
Only lint files that are currently staged in Git.
--checkstyle
Output results in Checkstyle XML format.
--json
Output results in JSON format.
--verbose
Show verbose output, including commands being executed.
--debug
Show debug output for troubleshooting.
--ansi, --no-ansi
Force or disable ANSI color output.
--dry-run
Do not actually run linters, just print commands that would be executed.
--php-syntax
Perform only PHP syntax checks (default for .php files).
--symlinked
Follow symlinked directories when discovering files.
--linter-name
Use a specific linter (e.g., --phpcs, --eslint, --phpstan, --pylint). Many such options exist for various languages and tools.
--version
Show program version and exit.
--help
Show this help message and exit.
DESCRIPTION
parallel-lint is a powerful command-line tool designed to significantly speed up code linting processes. It acts as a wrapper around various static analysis tools (linters) such as PHP_CodeSniffer, ESLint, PHPStan, and many others, allowing them to run concurrently across multiple CPU cores.
By parallelizing the execution of linting tasks, it drastically reduces the total time required to analyze large codebases, making it ideal for continuous integration (CI) environments and development workflows where fast feedback is crucial. It automatically discovers files to lint, supports various output formats (like Checkstyle and JSON), and offers flexible configuration options for excluding paths, specifying file types, and integrating with version control systems to lint only changed files. This tool enhances productivity by providing quicker validation of code quality and adherence to coding standards.
CAVEATS
parallel-lint requires the underlying linters (e.g., phpcs, eslint) to be installed and accessible in your system's PATH. It does not install these linters itself. Running with a high number of parallel processes can be resource-intensive, consuming significant CPU and memory.
HOW IT WORKS
parallel-lint internally spawns multiple processes, each responsible for linting a subset of the target files. It efficiently distributes the workload and aggregates the results from all parallel runs, presenting them in a unified output. It typically uses file discovery mechanisms to find relevant files.
DEPENDENCIES
While parallel-lint itself is usually installed via Composer (for PHP projects) or other language-specific package managers, its primary function relies on the presence and correct configuration of the specific linters it's asked to run (e.g., phpcs, eslint, black). These underlying linters must be installed separately by the user.
HISTORY
parallel-lint was developed to address the growing need for faster feedback loops in modern software development, especially in projects with large codebases that might take a long time to lint sequentially. It aims to reduce the waiting time for static analysis results, making it more practical to integrate linting into pre-commit hooks or continuous integration pipelines without significantly slowing them down. Its design focuses on being a generic parallel runner for any command-line linter.