Skip to content

Commit

Permalink
Add script for POD whitespace check in Makefile
Browse files Browse the repository at this point in the history
As a convention the POD and the code needs to have an empty line in between.
The script checks all the files rather the commit files in the lib directory.
With this PR we enable validation of the rule in CI

Signed-off-by: Ioannis Bonatakis <ybonatakis@suse.com>
  • Loading branch information
b10n1k committed Jun 27, 2022
1 parent 17b8842 commit 0b35bd5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Makefile
Expand Up @@ -56,6 +56,10 @@ test-compile: check-links
test-compile-changed: os-autoinst/
export PERL5LIB=${PERL5LIB_} ; for f in `git diff --name-only | grep '.pm'` ; do perl -c $$f 2>&1 | grep -v " OK$$" && exit 2; done ; true

.PHONY: test_pod_whitespace_rule
test_pod_whitespace_rule:
tools/check_pod_whitespace_rule

.PHONY: test-yaml-valid
test-yaml-valid:
$(eval YAMLS=$(shell sh -c "git ls-files schedule/ test_data/ | grep '\\.ya\?ml$$'"))
Expand Down Expand Up @@ -107,7 +111,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-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

.PHONY: test
ifeq ($(TESTS),compile)
Expand Down
10 changes: 10 additions & 0 deletions tools/check_pod_whitespace_rule
@@ -0,0 +1,10 @@
#!/bin/bash -ex
<< 'heredoc_pod_whitespace_rule'
As a convention the POD and the code needs to have an empty line in between.
The script checks all the files rather the commit files in the lib directory.
heredoc_pod_whitespace_rule


grep -Pzo "=cut\nsub" -rn lib || exit 0
echo -e '\033[0;31mCheck for whitespace after end of POD failed.\nAdd a empty line between =cut and code.'
exit 1

0 comments on commit 0b35bd5

Please sign in to comment.