[PATCH v2 4/6] tests: Add linter check for pipe placement style

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 t/Makefile | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/t/Makefile b/t/Makefile
index c83fd1886..4eceabbd5 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -78,7 +78,7 @@ check-chainlint:
 	done && exit $$err
 
 test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax \
-	test-lint-filenames
+	test-lint-filenames test-lint-pipes
 
 test-lint-duplicates:
 	@dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
@@ -101,6 +101,16 @@ test-lint-filenames:
 		test -z "$$bad" || { \
 		echo >&2 "non-portable file name(s): $$bad"; exit 1; }
 
+test-lint-pipes:
+	@# Do not use \ to join lines when the next line starts with a
+	@# pipe. Instead, end the prior line with the pipe, and allow that to
+	@# join the lines implicitly.
+	@bad="$$(${PERL_PATH} -n0e 'm/(\n[^\n|]+\\\n[\t ]+\|[^\n]*)/ and \
+	      print qq{$$ARGV:$$1\n\n}' $(T))"; \
+		test -z "$$bad" || { \
+		printf >&2 "pipe at start of line in file(s):\n%s\n" "$$bad"; \
+		exit 1; }
+
 aggregate-results-and-cleanup: $(T)
 	$(MAKE) aggregate-results
 	$(MAKE) clean
-- 
2.19.0.444.g18242da7ef-goog




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux