Skip to content

Commit

Permalink
Docs: Add MD for role name rule (#2583)
Browse files Browse the repository at this point in the history
* Docs: Add MD for role name rule

* chore: auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix spelling

* chore: auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* spell

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Sorin Sbarnea <sorin.sbarnea@gmail.com>
  • Loading branch information
3 people committed Oct 10, 2022
1 parent 1887d39 commit bda8d99
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions .config/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ mkdocs
mkdtemp
mockings
mypy
myrole
nestedincludes
nocolor
nodeps
Expand Down
32 changes: 32 additions & 0 deletions src/ansiblelint/rules/role_name.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# role-name

This rule checks role names to ensure they conform with requirements.

Role names must contain only lowercase alphanumeric characters and the underscore `_` character.
Role names must also start with an alphabetic character.

For more information see the [roles directory](https://docs.ansible.com/ansible/devel/dev_guide/developing_collections_structure.html#roles-directory) topic in Ansible documentation.

## Problematic Code

```yaml
---
- name: Example playbook
hosts: localhost
roles:
- 1myrole # <- Does not start with an alphabetic character.
- myrole2[*^ # <- Contains invalid special characters.
- myRole_3 # <- Contains uppercase alphabetic characters.
```

## Correct Code

```yaml
---
- name: Example playbook
hosts: localhost
roles:
- myRole1 # <- Starts with an alphabetic character.
- myrole2 # <- Contains only alphanumeric characters.
- myrole_3 # <- Contains only lowercase alphabetic characters.
```

0 comments on commit bda8d99

Please sign in to comment.