Re: [PATCH] tests: split long lines

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

 



On 07/18/2013 03:26 AM, Daniel P. Berrange wrote:
> On Wed, Jul 17, 2013 at 11:51:11AM -0600, Eric Blake wrote:
>> Long lines are harder to read and harder to diff; in fact, if lines get
>> too long (> 1000 bytes), it starts causing issues where git send-email
>> refuses to send patches for the file.  I've cleaned up the tests
>> directory in the past (see commits bd6c46f, 3b750d1), but new long
>> lines have been introduced in the meantime.
>>
>> Victim files found with:
>> $ wc -L tests/qemuxml2argvdata/*.args | sort -k1,1n \
>>   | sed -n '/\b\(9[0-9]\|[1-9][0-9][0-9]\)\b/p'
>>
>> * tests/qemuxml2argvdata/qemuxml2argv-*.args: Split lines of any
>> file with content longer than 90 columns.
> 
> We've done this before & people keep introducing new violations.
> Time for a syntax check rule for tests/*/*.args

Sure; here's what I'm squashing in before pushing [plus a few more files
that it picked up as culprits].  I picked 90 rather than 80 columns,
only because there are a lot of files already in that range that I
didn't feel like touching.

diff --git i/cfg.mk w/cfg.mk
index c6a097e..13de268 100644
--- i/cfg.mk
+++ w/cfg.mk
@@ -686,6 +686,15 @@ sc_spec_indentation:
 	  echo '$(ME): skipping test $@: cppi not installed' 1>&2;	\
 	fi

+# Long lines can be harder to diff; too long, and git send-email chokes.
+# For now, only enforce line length on files where we have intentionally
+# fixed things and don't want to regress.
+sc_prohibit_long_lines:
+	@prohibit='.{90}'						\
+	in_vc_files='\.arg[sv]'						\
+	halt='Wrap long lines in expected output files'			\
+	  $(_sc_search_regexp)
+
 sc_copyright_format:
 	@require='Copyright .*Red 'Hat', Inc\.'				\
 	containing='Copyright .*Red 'Hat				\


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]