Skip to content
Snippets Groups Projects
Unverified Commit ce5ee80f authored by Sergio Oliveira's avatar Sergio Oliveira Committed by GitHub
Browse files

Merge pull request #376 from rjeffman/ci_add_yml_linters

Add support for ansible-lint and yamllint as Github actions.
parents a85f7ce9 b7900f1c
Branches
Tags
No related merge requests found
exclude_paths:
- roles
- .tox
- .venv
parseable: true
quiet: false
skip_list:
- '201' # Trailing whitespace
- '204' # Lines should be no longer than 160 chars
- '206' # Variables should have spaces before and after: {{ var_name }}'
- '208' # File permissions not mentioned
- '301' # Commands should not change things if nothing needs doing'
- '305' # Use shell only when shell functionality is required'
- '306' # Shells that use pipes should set the pipefail option'
- '502' # All tasks should be named
- '505' # Referenced missing file
use_default_rules: true
verbosity: 1
---
name: Run Linters
on:
- push
- pull_request
jobs:
linters:
name: Run Linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.6"
- name: Run ansible-lint
uses: ansible/ansible-lint-action@master
with:
targets: |
tests/*.yml
tests/*/*.yml
tests/*/*/*.yml
playbooks/*.yml
playbooks/*/*.yml
env:
ANSIBLE_MODULE_UTILS: plugins/module_utils
ANSIBLE_LIBRARY: plugins/modules
- name: Run yaml-lint
uses: ibiqlik/action-yamllint@v1
- name: Run Python linters
uses: rjeffman/python-lint-action@master
---
ignore: |
/.tox/
/.venv/
/.github/
extends: default
rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
truthy:
allowed-values: ["yes", "no", "true", "false", "True", "False"]
level: error
# Disabled rules
document-start: disable
indentation: disable
line-length: disable
colons: disable
empty-lines: disable
comments: disable
comments-indentation: disable
trailing-spaces: disable
new-line-at-end-of-file: disable
......@@ -11,7 +11,7 @@
- name: Ensure nss package is updated
package:
name: nss
state: latest
state: latest # noqa 403
- include_role:
name: ipaserver
......
......@@ -22,7 +22,8 @@ data_files =
/usr/share/ansible/roles/ipareplica = roles/ipareplica/*
[flake8]
extend-ignore = E203
extend-ignore = E203, D1, D212, D203, D400, D401
exclude = .git,__pycache__,.tox,.venv
per-file-ignores =
plugins/*:E402
roles/*:E402
......
......@@ -18,27 +18,6 @@ pool:
vmImage: 'ubuntu-18.04'
stages:
- stage: Linters
jobs:
- job: RunLinters
displayName: Run Linters
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.6'
- script: python -m pip install --upgrade pip setuptools wheel
displayName: Install tools
- script: pip install pydocstyle flake8
displayName: Install dependencies
- script: flake8 .
displayName: Run flake8 checks
- script: pydocstyle .
displayName: Verify docstings
- stage: Centos7
dependsOn: []
jobs:
......
#!/bin/bash
topdir=`dirname $(dirname $0)`
flake8 .
pydocstyle .
ANSIBLE_LIBRARY=${ANSIBLE_LIBRARY:-"${topdir}/plugins/modules"}
ANSIBLE_MODULE_UTILS=${ANSIBLE_MODULE_UTILS:-"${topdir}/plugins/module_utils"}
export ANSIBLE_LIBRARY ANSIBLE_MODULE_UTILS
yaml_dirs=(
"${topdir}/tests/*.yml"
"${topdir}/tests/*/*.yml"
"${topdir}/tests/*/*/*.yml"
"${topdir}/playbooks/*.yml"
"${topdir}/playbooks/*/*.yml"
"${topdir}/molecule/*/*.yml"
"${topdir}/molecule/*/*/*.yml"
)
ansible-lint --force-color ${yaml_dirs[@]}
yamllint -f colored ${yaml_dirs[@]}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment