Skip to content

Commit

Permalink
Start the move to pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
davestephens committed Aug 24, 2022
1 parent 38a1795 commit 40bda92
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 9 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,3 @@ jobs:
- name: Lint docs
uses: articulate/actions-markdownlint@v1
with:
config: markdownlint-config.json
files: "docs/**/*.md"
File renamed without changes.
1 change: 1 addition & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.github
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
{
Expand All @@ -40,4 +40,4 @@
"group": "build"
}
]
}
}
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`.

2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion inventories/sample/inventory
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# ansible-nas ansible_connection=local ansible_host=localhost

[nas]
ansible-nas
ansible-nas
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pre-commit

1 comment on commit 40bda92

@HitLuca
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

Please sign in to comment.