From ffb3980620ceacd45ef336831427efbbe1367fda Mon Sep 17 00:00:00 2001 From: Michele Pagot Date: Tue, 24 Oct 2023 18:30:20 +0200 Subject: [PATCH] Add target to check documenation errors Run perldoc and check for error in the documentaion format. Add a make target about it. Fix some documenation error. --- Makefile | 6 +++++- lib/YuiRestClient/Widget/Tree.pm | 1 + lib/hacluster.pm | 1 + lib/qesapdeployment.pm | 4 ++++ lib/trento.pm | 4 +++- lib/version_utils.pm | 26 ++++++++++---------------- tools/check_pod_errors | 24 ++++++++++++++++++++++++ 7 files changed, 48 insertions(+), 18 deletions(-) create mode 100755 tools/check_pod_errors diff --git a/Makefile b/Makefile index ec32219a1b3b..aecd4879a9da 100644 --- a/Makefile +++ b/Makefile @@ -61,6 +61,10 @@ test-compile-changed: os-autoinst/ test_pod_whitespace_rule: tools/check_pod_whitespace_rule +.PHONY: test_pod_errors +test_pod_errors: + tools/check_pod_errors + .PHONY: test-yaml-valid test-yaml-valid: tools/check_yaml @@ -103,7 +107,7 @@ test-spec: tools/update_spec --check .PHONY: test-static -test-static: tidy-check test-yaml-valid test-modules-in-yaml-schedule test-merge test-dry test-no-wait_idle test-deleted-renamed-referenced-files test-unused-modules-changed test-soft_failure-no-reference test-spec test-invalid-syntax test-code-style test-metadata test_pod_whitespace_rule +test-static: tidy-check test-yaml-valid test-modules-in-yaml-schedule test-merge test-dry test-no-wait_idle test-deleted-renamed-referenced-files test-unused-modules-changed test-soft_failure-no-reference test-spec test-invalid-syntax test-code-style test-metadata test_pod_whitespace_rule test_pod_errors .PHONY: test ifeq ($(TESTS),compile) diff --git a/lib/YuiRestClient/Widget/Tree.pm b/lib/YuiRestClient/Widget/Tree.pm index 370cc90d4dca..539da04bf846 100644 --- a/lib/YuiRestClient/Widget/Tree.pm +++ b/lib/YuiRestClient/Widget/Tree.pm @@ -136,5 +136,6 @@ Args has 2 named parameters: The path parameter is used for recursion in this function. +=back =cut diff --git a/lib/hacluster.pm b/lib/hacluster.pm index 3703269efa4a..b4c3e0f3bb5a 100644 --- a/lib/hacluster.pm +++ b/lib/hacluster.pm @@ -1205,6 +1205,7 @@ sub check_iscsi_failure { =head3 cluster_status_matches_regex Check crm status output against a hardcode regular expression in order to check the cluster health + =over 1 =item B - Output from 'crm status' command diff --git a/lib/qesapdeployment.pm b/lib/qesapdeployment.pm index eb318fc604bc..1a19171a7a56 100644 --- a/lib/qesapdeployment.pm +++ b/lib/qesapdeployment.pm @@ -403,6 +403,7 @@ sub qesap_yaml_replace { =item B - filename of the log file. This argument is optional, if not specified the log filename is internally calculated using content from CMD and CMD_OPTIONS. + =back =cut @@ -454,6 +455,7 @@ sub qesap_execute { =item B - Path to the Ansible log file. (Required) =item B - String to search for in the log file. (Required) + =back =cut @@ -966,6 +968,7 @@ sub qesap_wait_for_ssh { =item B - Cloud provider name, used to find the inventory =item B - if not set, Ansible failure result in die + =back =cut @@ -1067,6 +1070,7 @@ sub qesap_cluster_logs { =head3 qesap_az_get_vnet Return the output of az network vnet list + =over 1 =item B - resource group name to query diff --git a/lib/trento.pm b/lib/trento.pm index f87da46f860a..7488b814cc9b 100644 --- a/lib/trento.pm +++ b/lib/trento.pm @@ -105,7 +105,7 @@ constant values for Trento tests =head2 Methods =cut -=hean3 clone_trento_deployment +=head3 clone_trento_deployment Clone gitlab.suse.de/qa-css/trento @@ -237,6 +237,7 @@ sub get_resource_group { =head3 cluster_config Create a variable map and prepare the qe-sap-deployment using it + =over 3 =item B - CloudProvider name @@ -859,6 +860,7 @@ sub cluster_wait_status { =head3 cluster_wait_status_by_regex Remotely run 'SAPHanaSR-showAttr' in a loop on $host, wait output that matches regular expression + =over 3 =item B - Ansible name or filter for the remote host where to run 'SAPHanaSR-showAttr' diff --git a/lib/version_utils.pm b/lib/version_utils.pm index 7278ce064e34..a84425e16e1b 100644 --- a/lib/version_utils.pm +++ b/lib/version_utils.pm @@ -157,7 +157,7 @@ sub is_rescuesystem { =head2 is_virtualization_server -Returns true if called on a virutalization server +Returns true if called on a virtualization server =cut sub is_virtualization_server { @@ -177,7 +177,7 @@ sub is_livecd { Usage: check_version('>15.0', get_var('VERSION'), '\d{2}') Query format: [= > < >= <=] version [+] (Example: <=12-sp3 =12-sp1 <4.0 >=15 3.0+) -Check agains: product version to check against - probably get_var('VERSION') +Check against: product version to check against - probably get_var('VERSION') Regex format: checks query version format (Example: /\d{2}\.\d/)# =cut @@ -685,7 +685,7 @@ It parses the info from /etc/os-release file, which can reside in any physical h The file can also be placed anywhere as long as it can be reached somehow by its absolute file path, which should be passed in as the second argument os_release_file, for example, "/etc/os-release" At the same time, connection method to the entity in which the file reside should be passed in as the -firt argument go_to_target, for example, "ssh root at name or ip address" or "way to download the file" +first argument go_to_target, for example, "ssh root at name or ip address" or "way to download the file" For use only on locahost, no argument needs to be specified =cut @@ -705,25 +705,19 @@ sub get_os_release { Identify running os without any dependencies parsing the I. -=item C +=over 4 -The expected distribution name to compare. +=item C - The expected distribution name to compare. -=item C +=item C - The line we'll be parsing and checking. -The line we'll be parsing and checking. +=item C - Command connecting to the SUT -=item C - -Command connecting to the SUT - -=item C - -The full path to the Operating system identification file. -Default to I. +=item C - The full path to the Operating system identification file. Default to I. Returns 1 (true) if the ID_LIKE variable contains C. +=back =cut sub check_os_release { @@ -857,7 +851,7 @@ sub package_version_cmp { =head2 is_quarterly_iso -Returns true if called in quaterly iso testing +Returns true if called in quarterly iso testing =cut sub is_quarterly_iso { diff --git a/tools/check_pod_errors b/tools/check_pod_errors new file mode 100755 index 000000000000..8b7594d04862 --- /dev/null +++ b/tools/check_pod_errors @@ -0,0 +1,24 @@ +#!/bin/bash +<< 'heredoc_pod_error_rule' +The script checks that no POD error are present in any changed file. +heredoc_pod_error_rule + +libs_files=$(git ls-files lib/ | grep '.pm$' | xargs echo) +tmpfile=$(mktemp) + +success=1 +if test -n "$libs_files"; then + for libfile in $libs_files; do + perldoc -T -D "${libfile}" 2>/dev/null 1>"$tmpfile" + grep -n "POD ERRORS" "$tmpfile" || continue + + success=0 + error_line=$(grep -n "POD ERRORS" "$tmpfile"|tail -1| cut -f 1 -d ":") + echo "ERROR in file ${libfile}" + cat "$tmpfile" | sed -n "$error_line,\$"p + done +else + echo "No lib files."; +fi +[ $success = 1 ] && echo "POD ERROR CHECK SUCCESS" && exit 0 +exit 1