{"id":35357818,"url":"https://github.com/lex00/cfn-lint-go","last_synced_at":"2026-02-12T07:45:34.946Z","repository":{"id":331362390,"uuid":"1126335048","full_name":"lex00/cfn-lint-go","owner":"lex00","description":"CloudFormation Linter for Go - native port of aws-cloudformation/cfn-lint","archived":false,"fork":false,"pushed_at":"2026-01-11T16:29:03.000Z","size":566,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-13T19:26:42.948Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lex00.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-01T17:27:27.000Z","updated_at":"2026-01-11T16:29:06.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/lex00/cfn-lint-go","commit_stats":null,"previous_names":["lex00/cfn-lint-go"],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/lex00/cfn-lint-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lex00%2Fcfn-lint-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lex00%2Fcfn-lint-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lex00%2Fcfn-lint-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lex00%2Fcfn-lint-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lex00","download_url":"https://codeload.github.com/lex00/cfn-lint-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lex00%2Fcfn-lint-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29361810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T01:03:07.613Z","status":"online","status_checked_at":"2026-02-12T02:00:06.911Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-01T23:33:56.487Z","updated_at":"2026-02-12T07:45:34.941Z","avatar_url":"https://github.com/lex00.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cfn-lint-go\n\n[![CI](https://github.com/lex00/cfn-lint-go/actions/workflows/ci.yml/badge.svg)](https://github.com/lex00/cfn-lint-go/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/lex00/cfn-lint-go/branch/main/graph/badge.svg)](https://codecov.io/gh/lex00/cfn-lint-go)\n[![Go Reference](https://pkg.go.dev/badge/github.com/lex00/cfn-lint-go.svg)](https://pkg.go.dev/github.com/lex00/cfn-lint-go)\n[![Go Report Card](https://goreportcard.com/badge/github.com/lex00/cfn-lint-go)](https://goreportcard.com/report/github.com/lex00/cfn-lint-go)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Release](https://img.shields.io/github/v/release/lex00/cfn-lint-go.svg)](https://github.com/lex00/cfn-lint-go/releases)\n\nCloudFormation Linter for Go - a native Go port of [aws-cloudformation/cfn-lint](https://github.com/aws-cloudformation/cfn-lint).\n\n## Status\n\n**v1.0.0 - 270 rules implemented (100% feature parity with Python cfn-lint)**\n\nThis is a Go port of the Python cfn-lint tool. Implements complete feature parity with 270 rules covering template structure, intrinsic functions, schema-based validation, best practices, warnings, and informational rules. Uses `cloudformation-schema-go` for CloudFormation resource specification, enum validation, and registry schema access (JSON Schema Draft-07 property constraints for all 1500+ resource types).\n\n### What's Implemented\n\n- YAML/JSON template parsing with line number tracking\n- CloudFormation intrinsic function support (!Ref, !GetAtt, !Sub, etc.)\n- Rule interface and registry system\n- DOT graph generation for resource dependencies\n- **Multiple output formats**: text, JSON, SARIF, JUnit XML, pretty (colorized with context)\n- **Configuration file support**: `.cfnlintrc`, `.cfnlintrc.yaml`, `.cfnlintrc.json`\n- **SAM template support**: automatic transformation to CloudFormation with source mapping\n- **GitHub Action** for CI/CD integration with SARIF support\n- **Pre-commit hooks** for local validation\n- CLI `graph` command for dependency visualization\n- CLI `list-rules` command\n- Complete CLI options matching Python cfn-lint\n- 270 rules across all categories:\n  - **E0xxx**: 7 rules (parse, transform, processing, config, SAM, deployment/parameter files)\n  - **E1xxx**: 39 rules (intrinsic functions, schema validation, format validation)\n  - **E2xxx**: 14 rules (param config, type, naming, length, limits, defaults, NoEcho, SSM types, constraints)\n  - **E3xxx**: 119 rules (resource config, properties, type validation, enum validation, dependencies, policies, constraints)\n  - **E4xxx**: 2 rules (interface metadata, structure)\n  - **E5xxx**: 1 rule (CloudFormation Modules validation)\n  - **E6xxx**: 9 rules (output structure, types, naming, exports)\n  - **E7xxx**: 3 rules (mapping config, naming, limits)\n  - **E8xxx**: 7 rules (condition functions)\n  - **Wxxx**: 49 warning rules (security, best practices, deprecations)\n  - **Ixxx**: 20 informational rules\n\n## Installation\n\n```bash\ngo install github.com/lex00/cfn-lint-go/cmd/cfn-lint@latest\n```\n\nOr add as a library:\n\n```bash\ngo get github.com/lex00/cfn-lint-go\n```\n\n## Usage\n\n### CLI\n\n```bash\n# Lint a template\ncfn-lint template.yaml\n\n# Lint with different output formats\ncfn-lint template.yaml --format json\ncfn-lint template.yaml --format sarif --output results.sarif\ncfn-lint template.yaml --format junit --output results.xml\ncfn-lint template.yaml --format pretty  # Colorized output with code context\n\n# Use configuration file\ncfn-lint template.yaml --config .cfnlintrc.yaml\n\n# Ignore specific rules\ncfn-lint template.yaml --ignore-rules E1001,W3002\n\n# Include specific rules (even if ignored elsewhere)\ncfn-lint template.yaml --ignore-rules E1001 --include-checks E1001\n\n# Specify AWS regions\ncfn-lint template.yaml --regions us-east-1,us-west-2\n\n# Write output to file\ncfn-lint template.yaml --output results.txt\n\n# Generate dependency graph\ncfn-lint graph template.yaml \u003e deps.dot\ndot -Tpng deps.dot -o deps.png\n\n# Include parameters in graph\ncfn-lint graph template.yaml --include-parameters\n\n# List available rules\ncfn-lint list-rules\n\n# List rules as JSON\ncfn-lint list-rules --format json\n\n# Update RULES.md documentation\ncfn-lint update-documentation\n\n# SAM template support (auto-transforms to CloudFormation)\ncfn-lint sam-template.yaml\n\n# Skip SAM transformation (lint as-is)\ncfn-lint sam-template.yaml --no-sam-transform\n\n# Show transformed CloudFormation (for debugging)\ncfn-lint sam-template.yaml --show-transformed\n\n# Show help\ncfn-lint --help\n```\n\n### Configuration File\n\nCreate a `.cfnlintrc.yaml` file in your project root:\n\n```yaml\n# Templates to lint (supports globs)\ntemplates:\n  - templates/**/*.yaml\n  - infrastructure/*.yml\n\n# Templates to ignore\nignore_templates:\n  - test/**\n\n# AWS regions to validate against\nregions:\n  - us-east-1\n  - us-west-2\n\n# Rules to ignore\nignore_checks:\n  - E1001\n  - W3002\n\n# Rules to include (even if ignored)\ninclude_checks:\n  - I1001\n\n# Output format\nformat: pretty\n\n# Output file (optional)\n# output_file: lint-results.json\n\n# SAM template configuration\nsam:\n  auto_transform: true  # Set to false to skip SAM transformation\n  transform_options:\n    region: us-east-1\n    account_id: \"123456789012\"\n    stack_name: my-sam-app\n```\n\n### GitHub Actions\n\n```yaml\nname: Validate CloudFormation\n\non: [pull_request]\n\npermissions:\n  security-events: write\n  contents: read\n\njobs:\n  cfn-lint:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-go@v5\n        with:\n          go-version: '1.21'\n      - uses: lex00/cfn-lint-go@main\n        with:\n          templates: 'templates/*.yaml'\n          format: sarif\n```\n\n### Pre-commit Hooks\n\nAdd to `.pre-commit-config.yaml`:\n\n```yaml\nrepos:\n  - repo: https://github.com/lex00/cfn-lint-go\n    rev: v1.0.0\n    hooks:\n      - id: cfn-lint-go\n```\n\nSee [docs/getting_started/integration.md](docs/getting_started/integration.md) for more integration examples.\n\n### Library\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"log\"\n\n    \"github.com/lex00/cfn-lint-go/pkg/lint\"\n)\n\nfunc main() {\n    linter := lint.New(lint.Options{})\n\n    matches, err := linter.LintFile(\"template.yaml\")\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    for _, m := range matches {\n        fmt.Printf(\"%s:%d: %s [%s]\\n\", m.Filename, m.Line, m.Message, m.Rule)\n    }\n}\n```\n\n### Graph Generation (Library)\n\n```go\npackage main\n\nimport (\n    \"os\"\n\n    \"github.com/lex00/cfn-lint-go/pkg/graph\"\n    \"github.com/lex00/cfn-lint-go/pkg/template\"\n)\n\nfunc main() {\n    tmpl, _ := template.ParseFile(\"template.yaml\")\n\n    gen := \u0026graph.Generator{\n        IncludeParameters: true,\n        Format:            graph.FormatDOT,      // or graph.FormatMermaid\n        ClusterByType:     true,                 // group by AWS service\n    }\n    gen.Generate(tmpl, os.Stdout)\n}\n```\n\n#### Graph Output Formats\n\n- **DOT** (default): Graphviz format, render with `dot -Tpng`\n- **Mermaid**: Renders natively in GitHub markdown\n\n#### Edge Colors (DOT format)\n- Black: Ref references\n- Blue: GetAtt references\n- Gray dashed: DependsOn dependencies\n\n## Rule Categories\n\n| Range | Category | Count |\n|-------|----------|-------|\n| E0xxx | Template errors | 7 |\n| E1xxx | Functions \u0026 schema validation | 39 |\n| E2xxx | Parameters | 14 |\n| E3xxx | Resources \u0026 properties | 119 |\n| E4xxx | Metadata | 2 |\n| E5xxx | Modules | 1 |\n| E6xxx | Outputs | 9 |\n| E7xxx | Mappings | 3 |\n| E8xxx | Conditions | 7 |\n| W1xxx | Template warnings | 15 |\n| W2xxx | Parameter warnings | 10 |\n| W3xxx | Resource warnings | 18 |\n| W4xxx | Metadata warnings | 2 |\n| W6xxx | Output warnings | 1 |\n| W7xxx | Mapping warnings | 1 |\n| W8xxx | Condition warnings | 2 |\n| Ixxx | Informational | 20 |\n| **Total** | | **270** |\n\n## NOT in Scope\n\n- Dynamic rule loading (`--append-rules`)\n\n## Development\n\n```bash\n# Run tests\ngo test -v ./...\n\n# Run linter\ngolangci-lint run\n\n# Build CLI\ngo build -o cfn-lint ./cmd/cfn-lint\n\n# Run CLI\n./cfn-lint --help\n```\n\n## Project Structure\n\n```\ncfn-lint-go/\n├── cmd/cfn-lint/       # CLI application\n├── pkg/                # Public API (importable)\n│   ├── lint/           # Main linting interface\n│   ├── template/       # Template parsing\n│   ├── graph/          # DOT graph generation\n│   ├── output/         # Output formatters (SARIF, JUnit, pretty)\n│   ├── config/         # Configuration file support\n│   ├── docgen/         # Documentation generator\n│   ├── rules/          # Rule interface and registry\n│   ├── sam/            # SAM template detection and transformation\n│   └── schema/         # CloudFormation spec + registry schema access (via cloudformation-schema-go)\n├── internal/           # Private implementation\n│   └── rules/          # Rule implementations\n│       ├── errors/     # E0xxx\n│       ├── functions/  # E1xxx\n│       ├── parameters/ # E2xxx\n│       ├── resources/  # E3xxx\n│       ├── metadata/   # E4xxx\n│       ├── outputs/    # E6xxx\n│       ├── mappings/   # E7xxx\n│       ├── conditions/ # E8xxx\n│       └── warnings/   # Wxxx\n├── testdata/           # Test fixtures\n├── docs/               # Documentation\n├── action.yml          # GitHub Action definition\n└── .pre-commit-hooks.yaml  # Pre-commit hook configuration\n```\n\n## Documentation\n\n- [Getting Started](docs/getting_started/README.md) - Installation and basic usage\n- [SAM Template Support](docs/SAM.md) - SAM transformation via aws-sam-translator-go\n- [Integration Guide](docs/getting_started/integration.md) - CI/CD, IDE, and pre-commit integration\n- [Rules Reference](docs/RULES.md) - All available rules\n- [Rule Creation Guide](docs/getting_started/rules.md) - How to create new rules\n- [Custom Rules](docs/custom_rules.md) - Creating organization-specific rules\n- [API Reference](docs/API.md) - Library API documentation\n\n## Contributing\n\nSee [docs/CONTRIBUTING.md](docs/CONTRIBUTING.md) for how to contribute.\n\n## License\n\nMIT - see [LICENSE](LICENSE)\n\n## Related Projects\n\n- [aws-cloudformation/cfn-lint](https://github.com/aws-cloudformation/cfn-lint) - Original Python implementation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flex00%2Fcfn-lint-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flex00%2Fcfn-lint-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flex00%2Fcfn-lint-go/lists"}