Getting Started with Lint Configs¶
Install shared lint configuration files and pre-commit hooks for your project. This tutorial takes approximately 2 minutes.
Prerequisites¶
curlinstalled- A project repository with
git initcompleted - pre-commit installed
Goal¶
After completing this tutorial you will have:
- Shared lint configs (
.golangci.yamlor.tflint.hcl,trivy.yaml, etc.) in your repository - A pre-commit configuration with all hooks active
- Commit message validation via commitlint
Step 1: Run the Install Script¶
For Go projects:
bash <(curl -sL https://raw.githubusercontent.com/y-miyazaki/config/main/install_go.sh)
For Terraform projects:
bash <(curl -sL https://raw.githubusercontent.com/y-miyazaki/config/main/install_terraform.sh)
Existing files are skipped. To overwrite with the latest configs:
bash <(curl -sL https://raw.githubusercontent.com/y-miyazaki/config/main/install_go.sh) --force
Step 2: Activate pre-commit Hooks¶
pre-commit install
pre-commit install --hook-type commit-msg
For Terraform projects, also initialize providers and tflint:
terraform init
tflint --init
Verification¶
# Verify hooks are installed
pre-commit run --all-files
All checks should pass (or show only pre-existing issues in your code).
Installed Files¶
| File | Purpose |
|---|---|
.pre-commit-config.yaml |
Pre-commit hook definitions |
.golangci.yaml (Go) |
golangci-lint configuration |
.tflint.hcl (Terraform) |
tflint configuration |
trivy.yaml |
Trivy security scanner configuration |
.markdownlint-cli2.yaml |
Markdown linting rules |
.gitleaks.toml |
Secret detection rules |
.commitlintrc.yaml |
Commit message format rules |
Next Steps¶
- Customize
.golangci.yamlor.tflint.hclfor project-specific rules - Specification — For the full list of distributed configs
- GitHub Actions — To add CI workflows that enforce the same rules remotely