Skip to content

no-hard-tabs

all languagesstyleno fixdefault: offcmake/cmake-lintmarkdown/markdownlint

Reports a tab character in a line; a run of tabs is one report. The option ignore_kinds lists token kinds whose tabs are not reported (for example the code of a Markdown fence), and indentation_only reports only the tabs in the white space that starts a line.

A tab is as wide as each reader’s editor and tool makes it, so text that is aligned with tabs looks different in a diff, in a review and on the web. Spaces look the same everywhere. Some formats (YAML indentation) do not accept tabs at all.

To fix, replace the tab with spaces.

Reported
if(A)
set(x 1)
set(y 2)
endif()
lint:
rules:
no-hard-tabs:
level: warn # off (default), warn, error
options:
ignore_kinds: []
indentation_only: false
Option Type Default Description
ignore_kinds list [] Kinds of tokens whose tabs are not reported (for example the code of a fence).
indentation_only bool false Report only the tabs in the whitespace that starts a line.

Enabled by the presets: cmake/cmake-lint, markdown/markdownlint.

Suppress one line with sudsy-disable-next-line no-hard-tabs in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
cmake-lint C0306 full
markdownlint MD010 partial Reported on the tab run, as markdownlint does; no spaces_per_tab fix, no ignore_code_languages; code_blocks off is the option ignore_kinds naming the code tokens.