Start the move to pre-commit

This commit is contained in:
David Stephens 2022-08-24 09:27:24 +01:00
parent 38a179505f
commit 40bda92546
9 changed files with 24 additions and 9 deletions

View file

@ -35,6 +35,3 @@ jobs:
- name: Lint docs
uses: articulate/actions-markdownlint@v1
with:
config: markdownlint-config.json
files: "docs/**/*.md"

1
.markdownlintignore Normal file
View file

@ -0,0 +1 @@
.github

14
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,14 @@
---
repos:
- repo: https://github.com/ansible-community/ansible-lint.git
rev: v6.5.0
hooks:
- id: ansible-lint
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.27.1
hooks:
- id: yamllint
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.32.2
hooks:
- id: markdownlint

6
.vscode/tasks.json vendored
View file

@ -22,9 +22,9 @@
}
},
{
"label": "Run ansible-lint",
"label": "Run pre-commit checks",
"type": "shell",
"command": "docker run --rm -it -v $(pwd):/code pipelinecomponents/ansible-lint:latest nas.yml",
"command": "pre-commit run --all-files",
"group": "test"
},
{
@ -40,4 +40,4 @@
"group": "build"
}
]
}
}

View file

@ -2,7 +2,7 @@
Contributing to Ansible-NAS is easy! Add your functionality, then raise a pull request on GitHub. A few things to bear in mind:
* **Restrict pull requests to one piece of functionality or bugfix at a time.**
* **Restrict pull requests to one piece of functionality or bugfix at a time.**
* Test your new functionality or bugfix using the included `tests/test-vagrant.sh` script to spin up a test VM.
* Run `ansible-lint` against the playbook before committing. (There is a VSCode task set up to run the right command for you)
* Ensure that your PR only changes files required for your functionality or bugfix. Random changes in other files will result in your PR being rejected
@ -26,3 +26,5 @@ If you're adding a new application:
* Development of Ansible-NAS is carried out in [Visual Studio Code](https://code.visualstudio.com/) - you'll get some nice
recommended extensions and task setups if you do the same.
* You'll need a working Python 3 environment, and [pre-commit](https://pre-commit.com) installed - `pip install pre-commit`.

View file

@ -6,7 +6,7 @@ Before running anything, check out the playbook and understand what it does. Run
💀 💀 💀
## Read This First...
## Read This First
Calling this page "installation" is a bit of a misnomer. Ansible-NAS isn't *installed* per-se, it is a bunch of automation that installs other software onto your server. Ansible-NAS relies heavily on Ansible's [variable prescedence](https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable) to do its job. Ansible-NAS defines its installable software with roles with (mostly) sane defaults, these can then be enabled and the settings overridden in your inventory `nas.yml` file.

View file

@ -15,4 +15,4 @@
# ansible-nas ansible_connection=local ansible_host=localhost
[nas]
ansible-nas
ansible-nas

1
requirements-dev.txt Normal file
View file

@ -0,0 +1 @@
pre-commit