Salt-lint is a command-line utility that checks Salt State files (SLS) for best practices and potential improvements in SaltStack environments. Heavily inspired by `ansible-lint`, it helps enforce coding standards and identify common pitfalls in Salt configurations. It is currently at version 0.9.2 and maintains an active release cadence, with multiple bugfix and feature releases per year.
pip install salt-lintNo compatibility data collected yet for this library.
Salt-lint is primarily a command-line tool. Create a sample SaltStack state file (e.g., `my_salt_states/init.sls`) and then run `salt-lint` against it. The output will show any detected issues or warnings.
Upgrade your Python environment to version 3.6 or higher.
Review the changelog (e.g., on GitHub or ReadTheDocs) before upgrading to understand changes in linting rules. Consider pinning to minor versions if strict output stability is required.
Avoid using periods in Salt State file names, except for the file extension. Upgrade to v0.5.0 or newer to get automatic detection.
Upgrade to salt-lint 0.8.0 or newer to resolve false positives related to Jinja variable spacing in nested braces.
Ensure file modes are correctly quoted as strings, typically with a leading zero (e.g., `mode: '0755'`). Upgrade to v0.8.0 or newer for improved detection.
Activate the correct virtual environment (e.g., `source venv/bin/activate`) or run the command using `python -m salt_lint`.
Install the package using `pip install salt-lint`. If trying to import, ensure you use `import salt_lint`.
Verify the specified path (e.g., `path/to/nonexistent.sls`) and ensure it points to an existing Salt State file or directory.
Review the specified `.sls` file for YAML syntax errors, paying close attention to indentation, spacing, and correct key-value pair formatting.
No dependency data recorded yet.