Skip to content

indent_style

Every non-blank line indents with the configured style (tabs or spaces). When style: spaces, optional width enforces a multiple.

Check-only: tab-width-aware reindentation is language-specific. Pair with your editor’s “reindent on save” for remediation.

OptionTypeRequiredDefaultDescription
styleone of tabs | spacesyesRequired indentation style: tabs rejects any leading space; spaces rejects any leading tab.
widthinteger (>= 1)nullWhen style: spaces, the leading-space count on every non-blank line must be a multiple of this. Ignored for style: tabs.

Plus the common paths, level, id, and when fields. This table is generated from the JSON Schema; option types and defaults are authoritative.

A Go file indented with spaces instead of tabs

Section titled “A Go file indented with spaces instead of tabs”

The rule fires on this repository:

src/
src/bad.go
src/ok.go
src/bad.go
package main
func y() {
return
}
src/ok.go
package main
func x() {
return
}

With this .alint.yml:

version: 1
rules:
- id: go-tabs
kind: indent_style
paths: "src/**/*.go"
style: tabs
level: error

alint check reports:

Terminal window
--- src/bad.go -----------------------------------------------------------------
x error go-tabs
4:1 line 4 indented with the wrong character (expected tabs)
Summary (1 violation):
x 1 error
0 passing * 1 failing

This repository is compliant:

src/
src/a.go
src/b.go
src/a.go
package main
func x() {
return
}
src/b.go
package main
func y() {
if true {
return
}
}

With this .alint.yml:

version: 1
rules:
- id: go-tabs
kind: indent_style
paths: "src/**/*.go"
style: tabs
level: error

alint check reports:

Terminal window
v All 1 rule(s) passed.