Skip to content

Commit

Permalink
Add target to check documenation errors
Browse files Browse the repository at this point in the history
Run perldoc and check for error in the documentaion format.
Add a make target about it.
Fix some documenation error.
  • Loading branch information
mpagot committed Oct 24, 2023
1 parent 129021a commit ffb3980
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 18 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions lib/YuiRestClient/Widget/Tree.pm
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,6 @@ Args has 2 named parameters:
The path parameter is used for recursion in this function.
=back
=cut
1 change: 1 addition & 0 deletions lib/hacluster.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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<SHOW_CLUSTER_STATUS> - Output from 'crm status' command
Expand Down
4 changes: 4 additions & 0 deletions lib/qesapdeployment.pm
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ sub qesap_yaml_replace {
=item B<LOGNAME> - 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

Expand Down Expand Up @@ -454,6 +455,7 @@ sub qesap_execute {
=item B<FILE> - Path to the Ansible log file. (Required)
=item B<SEARCH_STRING> - String to search for in the log file. (Required)
=back
=cut

Expand Down Expand Up @@ -966,6 +968,7 @@ sub qesap_wait_for_ssh {
=item B<PROVIDER> - Cloud provider name, used to find the inventory
=item B<FAILOK> - if not set, Ansible failure result in die
=back
=cut

Expand Down Expand Up @@ -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> - resource group name to query
Expand Down
4 changes: 3 additions & 1 deletion lib/trento.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<PROVIDER> - CloudProvider name
Expand Down Expand Up @@ -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<HOST> - Ansible name or filter for the remote host where to run 'SAPHanaSR-showAttr'
Expand Down
26 changes: 10 additions & 16 deletions lib/version_utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -705,25 +705,19 @@ sub get_os_release {
Identify running os without any dependencies parsing the I</etc/os-release>.
=item C<distri_name>
=over 4
The expected distribution name to compare.
=item C<distri_name> - The expected distribution name to compare.
=item C<line>
=item C<line> - The line we'll be parsing and checking.
The line we'll be parsing and checking.
=item C<go_to_target> - Command connecting to the SUT
=item C<go_to_target>
Command connecting to the SUT
=item C<os_release_file>
The full path to the Operating system identification file.
Default to I</etc/os-release>.
=item C<os_release_file> - The full path to the Operating system identification file. Default to I</etc/os-release>.
Returns 1 (true) if the ID_LIKE variable contains C<distri_name>.
=back
=cut

sub check_os_release {
Expand Down Expand Up @@ -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 {
Expand Down
24 changes: 24 additions & 0 deletions tools/check_pod_errors
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ffb3980

Please sign in to comment.