From 7e66fb052e1d58037d4db731bb34caa5e092be2b Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Mon, 30 Jun 2025 20:46:56 +0200 Subject: [PATCH] CI: Add yamllint for YAML files, plugin/module docs, and YAML in extra docs (#10279) * Add yamllint to CI. * Fix more YAML booleans. --- .yamllint | 52 +++++++++++++++++++ antsibull-nox.toml | 11 ++++ .../targets/jenkins_credential/tasks/edit.yml | 18 +++---- .../targets/jenkins_credential/tasks/main.yml | 2 +- .../targets/jenkins_credential/tasks/pre.yml | 2 +- 5 files changed, 74 insertions(+), 11 deletions(-) create mode 100644 .yamllint diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000000..c10d86ab19 --- /dev/null +++ b/.yamllint @@ -0,0 +1,52 @@ +--- +# 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 + +extends: default + +ignore: | + /changelogs/ + +rules: + line-length: + max: 1000 + level: error + document-start: disable + document-end: disable + truthy: + level: error + allowed-values: + - 'true' + - 'false' + indentation: + spaces: 2 + indent-sequences: true + key-duplicates: enable + trailing-spaces: enable + new-line-at-end-of-file: disable + hyphens: + max-spaces-after: 1 + empty-lines: + max: 2 + max-start: 0 + max-end: 0 + commas: + max-spaces-before: 0 + min-spaces-after: 1 + max-spaces-after: 1 + colons: + max-spaces-before: 0 + max-spaces-after: 1 + brackets: + min-spaces-inside: 0 + max-spaces-inside: 0 + braces: + min-spaces-inside: 0 + max-spaces-inside: 1 + octal-values: + forbid-implicit-octal: true + forbid-explicit-octal: true + comments: + min-spaces-from-content: 1 + comments-indentation: false diff --git a/antsibull-nox.toml b/antsibull-nox.toml index 1d64a3c79a..c631d3a3af 100644 --- a/antsibull-nox.toml +++ b/antsibull-nox.toml @@ -14,6 +14,17 @@ [sessions] +[sessions.lint] +run_isort = false +run_black = false +run_flake8 = false +run_pylint = false +run_yamllint = true +yamllint_config = ".yamllint" +# yamllint_config_plugins = ".yamllint-docs" +# yamllint_config_plugins_examples = ".yamllint-examples" +run_mypy = false + [sessions.docs_check] validate_collection_refs="all" codeblocks_restrict_types = [ diff --git a/tests/integration/targets/jenkins_credential/tasks/edit.yml b/tests/integration/targets/jenkins_credential/tasks/edit.yml index e8584881f9..bd8d1eff7b 100644 --- a/tests/integration/targets/jenkins_credential/tasks/edit.yml +++ b/tests/integration/targets/jenkins_credential/tasks/edit.yml @@ -9,7 +9,7 @@ jenkins_user: "{{ jenkins_username }}" jenkins_password: "{{ jenkins_password }}" type: "token" - force: yes + force: true register: token_result - name: Set token in vars @@ -45,7 +45,7 @@ exc_hostname_port: - "new_excluded-hostname:7000" - "new_excluded-hostname2:7000" - force: yes + force: true register: custom_scope - name: Assert CUSTOM scope changed value @@ -64,7 +64,7 @@ description: "new user and password credential" username: "user2" password: "pass2" - force: yes + force: true register: userpass_cred - name: Assert user_and_pass changed value @@ -83,7 +83,7 @@ scope: "CUSTOM" description: "New file credential" file_path: "{{ output_dir }}/my-secret.pem" - force: yes + force: true register: file_cred - name: Assert file credential changed value @@ -103,7 +103,7 @@ secret: "mynewsecrettext" location: "folder" url: "http://localhost:8080/job/test" - force: yes + force: true register: text_cred - name: Assert text credential changed value @@ -123,7 +123,7 @@ appID: "12345678" private_key_path: "{{ output_dir }}/github.pem" owner: "new_github_owner" - force: yes + force: true register: githubapp_cred - name: Assert githubApp credential changed value @@ -143,7 +143,7 @@ username: "new_sshuser" private_key_path: "{{ output_dir }}/ssh_key" passphrase: 1234 - force: yes + force: true register: sshkey_cred - name: Assert sshKey credential changed value @@ -162,7 +162,7 @@ description: "New certificate credential" password: "12345678901234" file_path: "{{ output_dir }}/certificate.p12" - force: yes + force: true register: cert_p12_cred - name: Assert certificate (p12) credential changed value @@ -181,7 +181,7 @@ description: "New certificate credential (pem)" file_path: "{{ output_dir }}/cert.pem" private_key_path: "{{ output_dir }}/private.key" - force: yes + force: true register: cert_pem_cred - name: Assert certificate (pem) credential changed value diff --git a/tests/integration/targets/jenkins_credential/tasks/main.yml b/tests/integration/targets/jenkins_credential/tasks/main.yml index b2de6cd39e..88ee0693cf 100644 --- a/tests/integration/targets/jenkins_credential/tasks/main.yml +++ b/tests/integration/targets/jenkins_credential/tasks/main.yml @@ -13,7 +13,7 @@ jenkins_user: "{{ jenkins_username }}" jenkins_password: "{{ jenkins_password }}" type: "token" - no_log: yes + no_log: true register: token_result - name: Assert token and tokenUuid are returned diff --git a/tests/integration/targets/jenkins_credential/tasks/pre.yml b/tests/integration/targets/jenkins_credential/tasks/pre.yml index b55acdf6a8..abb649ae1e 100644 --- a/tests/integration/targets/jenkins_credential/tasks/pre.yml +++ b/tests/integration/targets/jenkins_credential/tasks/pre.yml @@ -9,7 +9,7 @@ uri: url: http://localhost:8080/login status_code: 200 - return_content: no + return_content: false timeout: 30 register: result retries: 10