[libvirt] [PATCH v2] syntax-check: Add prohibit_space_in_label rule

Martin Kletzander mkletzan at redhat.com
Mon Nov 16 14:05:57 UTC 2015


On Mon, Nov 02, 2015 at 12:12:22PM +0100, Andrea Bolognani wrote:
>This guards against code such as
>
> cleanup :
>
>which is happily accepted by the compiler but does not conform
>to our style guidelines.
>---
> cfg.mk | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
>diff --git a/cfg.mk b/cfg.mk
>index a9bba38..7a5a1de 100644
>--- a/cfg.mk
>+++ b/cfg.mk
>@@ -919,6 +919,15 @@ sc_require_space_before_label:
> 	halt="Top-level labels should be indented by one space"        \
> 	  $(_sc_search_regexp)
>
>+# Allow for up to three spaces before the label: this is to avoid running
>+# into situations where require_space_before_label is not applied, eg. a
>+# line matching ^[a-zA-Z0-9]+ :$
>+sc_prohibit_space_in_label:
>+	@prohibit='^ ? ? ?[_a-zA-Z0-9]+ +:$$'                          \

I would prefer ' {0,3}' instead of ' ? ? ?', but just for reading
purposes.  ACK either way

>+	in_vc_files='\.[ch]$$'                                         \
>+	halt="There should be no space between label name and colon"   \
>+	  $(_sc_search_regexp)
>+
> # Doesn't catch all cases of mismatched braces across if-else, but it helps
> sc_require_if_else_matching_braces:
> 	@prohibit='(  else( if .*\))? {|} else( if .*\))?$$)'		\
>--
>2.4.3
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20151116/1a75b812/attachment-0001.sig>


More information about the libvir-list mailing list