From 3ab4c8d1379ea5d086f889c53297dcc8a3dc5e9b Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sun, 16 Apr 2023 19:45:25 +0200 Subject: [PATCH] Do extra docs validation; explicitly disallow semantic markup in docs (#165) (#167) * Do extra docs validation. Explicitly disallow semantic markup in docs. * Forgot to add new requirement. * Improve test. * TEMP - make CI fail. * Remove unnecessary import. * Make sure ANSIBLE_COLLECTIONS_PATH is set. * Revert "TEMP - make CI fail." This reverts commit 445c56e7e1bcd844be59f1df9df00a9c8334ff55. * Make sure sanity tests from older Ansible versions don't complain. (cherry picked from commit dd1e48c388c65d40e898fb65f034d404d7d08289) Co-authored-by: Felix Fontein --- tests/sanity/extra/extra-docs.json | 5 ++++- tests/sanity/extra/extra-docs.py | 11 ++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/sanity/extra/extra-docs.json b/tests/sanity/extra/extra-docs.json index c2e612e5..9a28d174 100644 --- a/tests/sanity/extra/extra-docs.json +++ b/tests/sanity/extra/extra-docs.json @@ -1,10 +1,13 @@ { "include_symlinks": false, "prefixes": [ - "docs/docsite/" + "docs/docsite/", + "plugins/", + "roles/" ], "output": "path-line-column-message", "requirements": [ + "ansible-core", "antsibull-docs" ] } diff --git a/tests/sanity/extra/extra-docs.py b/tests/sanity/extra/extra-docs.py index f2746e51..880b6cce 100755 --- a/tests/sanity/extra/extra-docs.py +++ b/tests/sanity/extra/extra-docs.py @@ -12,9 +12,14 @@ def main(): """Main entry point.""" - if not os.path.isdir(os.path.join('docs', 'docsite')): - return - p = subprocess.run(['antsibull-docs', 'lint-collection-docs', '.'], check=False) + env = os.environ.copy() + suffix = ':{env}'.format(env=env["ANSIBLE_COLLECTIONS_PATH"]) if 'ANSIBLE_COLLECTIONS_PATH' in env else '' + env['ANSIBLE_COLLECTIONS_PATH'] = '{root}{suffix}'.format(root=os.path.dirname(os.path.dirname(os.path.dirname(os.getcwd()))), suffix=suffix) + p = subprocess.run( + ['antsibull-docs', 'lint-collection-docs', '--plugin-docs', '--disallow-semantic-markup', '--skip-rstcheck', '.'], + env=env, + check=False, + ) if p.returncode not in (0, 3): print('{0}:0:0: unexpected return code {1}'.format(sys.argv[0], p.returncode))