Skip to content

Commit

Permalink
Merge branch '33-ci-add-more-lint' into 'main'
Browse files Browse the repository at this point in the history
Resolve "ci: add more lint"

Closes #33

See merge request lydra/yunohost/ansible-yunohost!21
  • Loading branch information
cchaudier committed Mar 31, 2022
2 parents 6a4cbe1 + 954caf8 commit 7ce5c4f
Show file tree
Hide file tree
Showing 7 changed files with 443 additions and 2 deletions.
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Vault password file
.vault_pass

# Ansible
.ansible/
*.retry
.roles_requirements/
.lint_rules/

# Terraform
.terraform/
terraform.tfstate.d/
*.tfstate
*.tfstate.backup
terraform.tfvars
env.vault
env.d/
terraform/create_state_bucket/terraform.tf

# Logs
*.log
*.history
28 changes: 28 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,31 @@ include:
ansible-syntax-check:
rules:
- when: never

# For Ansible Galaxy Scoring
# https://galaxy.ansible.com/docs/contributing/content_scoring.html
yaml-lint:
image:
name: cytopia/yamllint:1.26
entrypoint: ["/bin/ash", "-c"]
stage: lint
before_script:
- yamllint --version
script:
- ls **/*.yml
- yamllint -c .yamllint.yml -f colored .
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
changes:
- "**/*.yml"

galaxy-lint:
extends: ansible-lint
before_script:
- ansible-lint --version
script:
- ansible-lint **/*.yml
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
changes:
- "**/*.yml"
22 changes: 22 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
# https://github.com/ansible/galaxy/blob/devel/galaxy/importer/linters/yamllint.yaml
# Based on ansible-lint config
extends: default

rules:
braces: {max-spaces-inside: 1, level: error}
brackets: {max-spaces-inside: 1, level: error}
colons: {max-spaces-after: -1, level: error}
commas: {max-spaces-after: -1, level: error}
comments: disable
comments-indentation: disable
document-start: disable
empty-lines: {max: 3, level: error}
hyphens: {level: error}
indentation: disable
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: disable
new-lines: {type: unix}
trailing-spaces: disable
truthy: disable
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ and the commits message folow the [Conventional Commits](https://www.conventiona
### Changed
- This role is now divided into four roles: `ynh_setup`, `ynh_config`, `ynh_apps`, `ynh_backup`. Each role has its own README so you can easily navigate between them and understand their purpose.

## [0.2.0] - date to be defined before release
## [0.2.0] - 2022-03-31
### Added
- Creation of the CHANGELOG.
- CI: Ansible galaxy lint
Expand Down
14 changes: 14 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
ansible = "==4"
ansible-lint = "==5.4.0"
yamllint = "==1.26"

[requires]
python_version = "3.8"

[dev-packages]
356 changes: 356 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion tasks/apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@
loop_control:
loop_var: ynh_app
when: ynh_app.label not in ynh_installed_apps.values()

0 comments on commit 7ce5c4f

Please sign in to comment.