Re: [PATCH 01/11] cfg.mk: fix comment detection for python semicolon check

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

 



On 9/5/19 5:21 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@xxxxxxxxxx>
> ---
>  cfg.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/cfg.mk b/cfg.mk
> index 1f29729949..d10dfa16a1 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='^[^#]*\;$$' \

But this new pattern does not prohibit:

 ch = '#';

I think you want:

'^[ \t]*[^#].*\;$$'

to flag all lines that have any amount of leading whitespace, where the
first non-whitespace is not #, and which end in ;.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | 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]

  Powered by Linux