[libvirt] [PATCH v2 02/24] cfg.mk: fix comment detection for python semicolon check

Daniel P. Berrangé posted 24 patches 6 years, 4 months ago
There is a newer version of this series
[libvirt] [PATCH v2 02/24] cfg.mk: fix comment detection for python semicolon check
Posted by Daniel P. Berrangé 6 years, 4 months ago
The pattern

    ^[^#].*\;$$

Was attempting to detect any trailing ';' in python code
which was not in a comment. This does not allow for the
comment '#' character to be indented with whitespace.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 cfg.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cfg.mk b/cfg.mk
index 1f29729949..d09ab507e0 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -815,7 +815,7 @@ sc_require_enum_last_marker:
 
 # In Python files we don't want to end lines with a semicolon like in C
 sc_prohibit_semicolon_at_eol_in_python:
-	@prohibit='^[^#].*\;$$' \
+	@prohibit='^[ \t]*[^# \t].*\;$$' \
 	in_vc_files='\.py$$' \
 	halt='python does not require to end lines with a semicolon' \
 	  $(_sc_search_regexp)
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 02/24] cfg.mk: fix comment detection for python semicolon check
Posted by Eric Blake 6 years, 4 months ago
On 9/11/19 11:23 AM, Daniel P. Berrangé wrote:
> The pattern
> 
>     ^[^#].*\;$$
> 
> Was attempting to detect any trailing ';' in python code
> which was not in a comment. This does not allow for the
> comment '#' character to be indented with whitespace.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  cfg.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/cfg.mk b/cfg.mk
> index 1f29729949..d09ab507e0 100644
> --- a/cfg.mk
> +++ b/cfg.mk
> @@ -815,7 +815,7 @@ sc_require_enum_last_marker:
>  
>  # In Python files we don't want to end lines with a semicolon like in C
>  sc_prohibit_semicolon_at_eol_in_python:
> -	@prohibit='^[^#].*\;$$' \
> +	@prohibit='^[ \t]*[^# \t].*\;$$' \
>  	in_vc_files='\.py$$' \
>  	halt='python does not require to end lines with a semicolon' \
>  	  $(_sc_search_regexp)
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

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