Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Ansible-lint: Add example config for github action #612

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
MarkusTeufelberger marked this conversation as resolved.
Show resolved Hide resolved
skip_list:
# TODO: Fix and enable one-by-one over time
Copy link
Contributor

Choose a reason for hiding this comment

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

But only the ones that make sense. sanity[cannot-ignore] looks pretty much wrong, for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hope that the eventual goal is to have both the collection(s) and ansible-lint rules in a state that no rule skips or any changes to default configs are necessary. For sanity[cannot-ignore] for example I am hardlocked on ansible/ansible#79700 making it into ansible-core and every version of ansible-core falling out of support until I can disable this in my collection. Similar with the shebangs in this repo here apparently?

There are some easy wins with fixing the long tail of errors (end of line whitespace and such) and automatic rewrites could be used or introduced for some things too. There are however also some issues with that (e.g. ansible/ansible-lint#3226 will hit every collection created from the default template).

- command-instead-of-module
- command-instead-of-shell
- key-order[task]
- jinja[spacing]
- no-free-form
- schema[galaxy]
- schema[tasks]
- name[missing]
- name[play]
- var-naming[no-role-prefix]
- var-naming[pattern]
- yaml[brackets]
- yaml[comments]
- yaml[empty-lines]
- yaml[indentation]
- yaml[line-length]
- yaml[new-line-at-end-of-file]
- yaml[trailing-spaces]
- name[template]
- name[casing]
- risky-file-permissions
- risky-shell-pipe
- galaxy[tags]
- ignore-errors
- no-changed-when
- no-handler
- sanity[cannot-ignore]
- fqcn[action-core]
18 changes: 18 additions & 0 deletions .github/workflows/ansible-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

name: ansible-lint
on:
pull_request:
branches: ["main", "stable-*"]
jobs:
build:
name: Ansible Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Run ansible-lint
Copy link
Contributor

Choose a reason for hiding this comment

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

A checkout step needs to be added before here. There was a breaking change in the action that started requiring that.

uses: ansible/ansible-lint-action@v6
MarkusTeufelberger marked this conversation as resolved.
Show resolved Hide resolved