[libvirt] [PATCH] Adjust backslash alignment syntax-check

Martin Kletzander posted 1 patch 6 years, 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/3360d41a73e92fe611c8bbeb6887eb85e31d5bce.1511389069.git.mkletzan@redhat.com
cfg.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt] [PATCH] Adjust backslash alignment syntax-check
Posted by Martin Kletzander 6 years, 5 months ago
We have a check for backslash alignment that checks for two blanks preceding a
backslash.  However there can be alignment done using a tabulator and in some
cases one might be enough.  There are none currently, but I found out that was
the case before. at some point.  so let's check for \t preceding the final
backslash as well.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---
 cfg.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cfg.mk b/cfg.mk
index 5321a52b7ee2..ea10ca19f512 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1038,7 +1038,7 @@ sc_prohibit_http_urls:
 	  $(_sc_search_regexp)
 
 sc_prohibit_backslash_alignment:
-	@prohibit='[[:blank:]][[:blank:]]\\$$' \
+	@prohibit='([[:blank:]][[:blank:]]|	)\\$$' \
 	in_vc_files='*\.([chx]|am|mk)$$' \
 	halt='Do not attempt to right-align backslashes' \
 	  $(_sc_search_regexp)
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Adjust backslash alignment syntax-check
Posted by Michal Privoznik 6 years, 5 months ago
On 11/22/2017 11:17 PM, Martin Kletzander wrote:
> We have a check for backslash alignment that checks for two blanks preceding a
> backslash.  However there can be alignment done using a tabulator and in some
> cases one might be enough.  There are none currently, but I found out that was
> the case before. at some point.  so let's check for \t preceding the final
> backslash as well.
> 
> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
> ---
>  cfg.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/cfg.mk b/cfg.mk
> index 5321a52b7ee2..ea10ca19f512 100644
> --- a/cfg.mk
> +++ b/cfg.mk
> @@ -1038,7 +1038,7 @@ sc_prohibit_http_urls:
>  	  $(_sc_search_regexp)
>  
>  sc_prohibit_backslash_alignment:
> -	@prohibit='[[:blank:]][[:blank:]]\\$$' \
> +	@prohibit='([[:blank:]][[:blank:]]|	)\\$$' \
>  	in_vc_files='*\.([chx]|am|mk)$$' \
>  	halt='Do not attempt to right-align backslashes' \
>  	  $(_sc_search_regexp)
> 

ACK

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Adjust backslash alignment syntax-check
Posted by Andrea Bolognani 6 years, 4 months ago
On Thu, 2017-11-23 at 06:46 +0100, Michal Privoznik wrote:
> > @@ -1038,7 +1038,7 @@ sc_prohibit_http_urls:
> >  	  $(_sc_search_regexp)
> >  
> >  sc_prohibit_backslash_alignment:
> > -	@prohibit='[[:blank:]][[:blank:]]\\$$' \
> > +	@prohibit='([[:blank:]][[:blank:]]|	)\\$$' \
> >  	in_vc_files='*\.([chx]|am|mk)$$' \
> >  	halt='Do not attempt to right-align backslashes' \
> >  	  $(_sc_search_regexp)
> > 
> 
> ACK

My use of [[:blank:]] was intended to cover tabs as well, but I
see now that it couldn't possibly work as intended :/

But since we've added the tab explicitly (good), maybe we can
replace the first part of the expression with two literal spaces
and make the whole thing more compact and just as effective?

I'll send a patch :)

-- 
Andrea Bolognani / Red Hat / Virtualization

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