summaryrefslogtreecommitdiffstats
path: root/src/ansiblelint/rules/no_tabs.md
blob: 7895122cc74fb2fda751b87e8355da973ba7806f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# no-tabs

This rule checks for the tab character. The `\t` tab character can result in
unexpected display or formatting issues. You should always use spaces instead of
tabs.

!!! note

    This rule does not trigger alerts for tab characters in the ``ansible.builtin.lineinfile`` module.

## Problematic Code

```yaml
---
- name: Example playbook
  hosts: all
  tasks:
    - name: Do not trigger the rule
      ansible.builtin.lineinfile:
        path: some.txt
        regexp: '^\t$'
        line: 'string with \t inside'
    - name: Trigger the rule with a debug message
      ansible.builtin.debug:
        msg: "Using the \t character can cause formatting issues." # <- Includes the tab character.
```

## Correct Code

```yaml
---
- name: Example playbook
  hosts: all
  tasks:
    - name: Do not trigger the no-tabs rule
      ansible.builtin.debug:
        msg: "Using space characters avoids formatting issues."
```