From 6a046ed7891310cfdf0e6daaed2f677e0e361404 Mon Sep 17 00:00:00 2001 From: Aidan Fitzgerald Date: Tue, 9 Oct 2018 12:19:30 -0400 Subject: [PATCH 1/5] Create script to check roles for missing documentation --- tests/check_role_docs.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 tests/check_role_docs.py diff --git a/tests/check_role_docs.py b/tests/check_role_docs.py new file mode 100755 index 000000000..da0bbd62e --- /dev/null +++ b/tests/check_role_docs.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +''' +This script checks every role in the project and prints its name to stdout if +the role directory does not contain a README file. + +For ease of use, you can pipe the output of this script to a file or to a +clipboard utility (e.g. pbcopy on macOS, xclip on Linux). +''' + +import os, glob + +for role in os.listdir("roles"): + readme_glob = os.path.join("roles", role, "README.*") + if not glob.glob(readme_glob): + print(role) From 2df99382a8a8656c95350f9084ce28d2f8e5edc5 Mon Sep 17 00:00:00 2001 From: Aidan Fitzgerald Date: Tue, 9 Oct 2018 12:42:37 -0400 Subject: [PATCH 2/5] Move to scripts/ --- {tests => scripts}/check_role_docs.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {tests => scripts}/check_role_docs.py (100%) diff --git a/tests/check_role_docs.py b/scripts/check_role_docs.py similarity index 100% rename from tests/check_role_docs.py rename to scripts/check_role_docs.py From 2c3470d740f8be36aaf96ea674c907dca46df19e Mon Sep 17 00:00:00 2001 From: Aidan Fitzgerald Date: Tue, 9 Oct 2018 12:47:31 -0400 Subject: [PATCH 3/5] Sort roles alphabetically --- scripts/check_role_docs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check_role_docs.py b/scripts/check_role_docs.py index da0bbd62e..a7deb9c19 100755 --- a/scripts/check_role_docs.py +++ b/scripts/check_role_docs.py @@ -10,7 +10,7 @@ clipboard utility (e.g. pbcopy on macOS, xclip on Linux). import os, glob -for role in os.listdir("roles"): +for role in sorted(os.listdir("roles")): readme_glob = os.path.join("roles", role, "README.*") if not glob.glob(readme_glob): print(role) From 41e78d90acae90ec2559a426bf9db61f8dbf2f37 Mon Sep 17 00:00:00 2001 From: Aidan Fitzgerald Date: Tue, 9 Oct 2018 13:16:45 -0400 Subject: [PATCH 4/5] Add support for excluded roles --- scripts/check_role_docs.py | 21 ++++++++++++++++----- scripts/docs_ignore | 11 +++++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 scripts/docs_ignore diff --git a/scripts/check_role_docs.py b/scripts/check_role_docs.py index a7deb9c19..5a814bb94 100755 --- a/scripts/check_role_docs.py +++ b/scripts/check_role_docs.py @@ -2,15 +2,26 @@ ''' This script checks every role in the project and prints its name to stdout if -the role directory does not contain a README file. +the role directory does not contain a README file and it is not listed in +scripts/docs_ignore. For ease of use, you can pipe the output of this script to a file or to a clipboard utility (e.g. pbcopy on macOS, xclip on Linux). ''' -import os, glob +import os +from os.path import join as make_path +from glob import glob -for role in sorted(os.listdir("roles")): - readme_glob = os.path.join("roles", role, "README.*") - if not glob.glob(readme_glob): +def included_roles(): + all_roles = set(os.listdir("roles")) + excluded_roles = \ + map(str.rstrip, open(make_path("scripts", "docs_ignore"))) + included_roles = list(all_roles.difference(excluded_roles)) + included_roles.sort() + return included_roles + +for role in included_roles(): + readme = make_path("roles", role, "README.*") + if not glob(readme): print(role) diff --git a/scripts/docs_ignore b/scripts/docs_ignore new file mode 100644 index 000000000..d41d794ad --- /dev/null +++ b/scripts/docs_ignore @@ -0,0 +1,11 @@ +authserver +debian_schooltool +ejabberd_xs +idmgr +ajenti +moodle-1.9 +pathagar +schooltool +nodogsplash +docker +sugar-stats From 10c80f8ac19beb71e618cacff13ec53c2afccbd1 Mon Sep 17 00:00:00 2001 From: Aidan Fitzgerald Date: Tue, 9 Oct 2018 13:17:18 -0400 Subject: [PATCH 5/5] Rename to roles_needing_docs.py --- scripts/{check_role_docs.py => roles_needing_docs.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{check_role_docs.py => roles_needing_docs.py} (100%) diff --git a/scripts/check_role_docs.py b/scripts/roles_needing_docs.py similarity index 100% rename from scripts/check_role_docs.py rename to scripts/roles_needing_docs.py