coderaiser/indra · 文件
文件最后提交记录最后更新时间
README.md
🐘 Indra
🐘Indra is a Go port of 🐊Putout — a pluggable, configurable linter and code transformer for Go.
🚚 Install
Install 🐘Indra with palabra:
palabra i indra
Or go:
go install coderaiser/indra/cmd/indra@latest
🎙 Usage
indra . # report issues
indra --fix . # fix issues
🏛 Architecture
Source
│
▼
engine_parser — parse Go source into *ast.File
│
▼
engine_runner — run plugins (Match → Replace, Traverse)
│
▼
engine_printer — print *ast.File back to []byte
│
▼
engine_processor — orchestrate parser/runner/printer per file type
│
▼
engine_loader — resolve .indra.toml chain → Options
⚙️ Configuration
Create .indra.toml in your project root:
processors = ["go"]
plugins = ["tape", "remove-unused-import", "remove-unused-variable"]
[rules]
"tape/remove-skip" = "off"
[match]
"*_integration_test.go" = { "tape/add-t-end" = "off" }
🏟 Plugins
📼 tape
Rules for go-tape test files.
Enabled for *_test.go by default.
| Rule | README | Description |
|---|---|---|
tape/remove-skip | 📖 | Replace Test.Skip with Test |
tape/add-t-end | 📖 | Add missing t.End() |
tape/apply-dedent | 📖 | Remove dedent.Dedent wrappers |
tape/convert-equal-to-deep-equal | 📖 | Use DeepEqual for slice args |
tape/convert-equal-to-not-ok | 📖 | Convert Equal(x, nil/false) to NotOk(x) |
tape/convert-equal-to-ok | 📖 | Convert Equal(x, true) to Ok(x) |
tape/convert-no-error-to-not-ok | 📖 | Convert NoError to NotOk |
tape/convert-ok-to-not-ok | 📖 | Convert Ok(err == nil) to NotOk(err) |
tape/extract-result-from-assertion | 📖 | Extract inline call from assertion |
tape/remove-useless-condition | 📖 | Remove useless condition in Ok/NotOk |
tape/remove-useless-prefix | 📖 | Remove redundant tape qualifier |
🚦 conditions
General Go code-quality rules. Enabled for all files by default.
| Rule | README | Description |
|---|---|---|
conditions/remove-useless-comments | 📖 | Remove separator banner comments |
conditions/convert-switch-to-if | 📖 | Replace qualifying switch with if chains |
🔧 indra
Meta-rules for indra plugin authoring. Enabled via "indra" = "on".
| Rule | README | Default | Description |
|---|---|---|---|
indra/remove-useless-match | 📖 | off | Remove nil/empty Match() entries |
indra/apply-compare | 📖 | on | Use Compare over GetTemplateValues != nil |
indra/apply-fixture-name-to-message | 📖 | on | Prefix test message with rule name |
indra/replace-test-message | 📖 | on | Include fixture name in test message |
indra/convert-for-to-create-test | 📖 | off | Rename For to CreateTest |
indra/convert-inspect-to-traverse | 📖 | on | Replace ast.Inspect with path.Traverse |
📦 Single rules
| Rule | README | Description |
|---|---|---|
remove-unused-variables | 📖 | Remove unused imports, variables, constants, private functions |
🍄 License
MIT