cfn-inline-lambda-linter is a powerful and lightweight tool for linting inline Lambda functions embedded in AWS CloudFormation templates. Optimize your Lambda code, catch potential issues, and enforce best practices effortlessly.
🔍 Automatic Detection: Scans YAML/JSON templates to identify inline Lambda functions.
⚡ Lightning-Fast Linting: Validates syntax, enforces standards, and identifies anti-patterns.
🛠 Customizable Rules: Extend with your own linting rules to suit your project needs.
📦 CI/CD Ready: Seamlessly integrate into any CI/CD pipeline.
📈 Future-Proof: Built with extensibility and AWS updates in mind.
Install via pip:
pip install cfn-inline-lambda-linterOr Install the latest development version:
pip install git+https://github.com/saad1998/cfn-inline-lambda-linter.git cfn-inline-lambda-linter template.yamlcfn-inline-lambda-linter template.yaml --args "--max-line-length=88 --ignore=E203,W503"Ensure your code is always clean and adheres to best practices by integrating cfn-inline-lambda-linter as a pre-commit hook!
- Automatic linting: Detect and resolve CloudFormation template issues effortlessly.
- Error prevention: Catch inline Lambda errors before deployment.
- Productivity boost: Spend less time debugging and more time building.
-
Install
pre-commitglobally (if not already installed):pip install pre-commit
-
Add the following to your project's
.pre-commit-config.yamlfile:repos: - repo: https://github.com/saad1998/cfn-inline-lambda-linter rev: v0.1.0 # Replace with the latest version hooks: - id: cfn-inline-lambda-linter files: template.yaml
-
Install the pre-commit hook in your local repository:
pre-commit install
-
Test it by running pre-commit on all files:
pre-commit run --all-files
Once the hook is configured, every time you try to commit changes:
- The hook will automatically scan your CloudFormation templates containing inline Lambda code.
- Errors or warnings will be highlighted, ensuring only high-quality configurations are committed.
You can pass arguments to the hook by modifying .pre-commit-config.yaml:
repos:
- repo: https://github.com/your-username/cfn-inline-lambda-linter
rev: v0.1.0
hooks:
- id: cfn-inline-lambda-linter
files: template.yaml
args: ["--args=--max-line-length=88 --ignore=E203,W503"]Your project is now equipped with an automated linter that ensures CloudFormation templates and inline Lambda code are always error-free before committing.
- Developer-Friendly: Clean output with actionable messages.
- AWS Focused: Tailored specifically for AWS Lambda in CloudFormation.
- Open Source: Free forever, with a growing community of contributors.
We ❤️ contributions! But at the moment it has been paused. It will be resumed when we have published our Contributing.md guide.
✅ Add support for nested templates. ✅ Add linting support for lambda functions written in other languages. 🚧 Advanced static analysis for Lambda functions. 🔜 Enhanced logging for CI/CD pipelines.
This project is licensed under the MIT License. See the LICENSE file for details.
Give a ⭐ if this project helps you improve your CloudFormation workflows!
Got questions or suggestions? Open an issue here.
"Code smarter, not harder!"