[PATCH 2/3] utils: checkstye: Show issue position for python issues

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Aug 30 16:51:54 CEST 2024


Hi Stefan,

Thank you for the patch.

On Fri, Aug 30, 2024 at 02:52:59PM +0200, Stefan Klug wrote:
> pycodestyle doesn't report the issue length. But it reports the
> position. Use that as indicator with zero length. This is better than no
> indicator at all and reduces confusion when multiple issues occur on the
> same line.

An example would be nice too.

> Signed-off-by: Stefan Klug <stefan.klug at ideasonboard.com>
> ---
>  utils/checkstyle.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/checkstyle.py b/utils/checkstyle.py
> index c6016f60a446..5901f1a71562 100755
> --- a/utils/checkstyle.py
> +++ b/utils/checkstyle.py
> @@ -737,7 +737,7 @@ class Pep8Checker(StyleChecker):
>  
>              if line_number in line_numbers:
>                  line = self.__content[line_number - 1]
> -                issues.append(StyleIssue(line_number, None, line, msg))
> +                issues.append(StyleIssue(line_number, [position, position + 1], line, msg))

I think this should be [position - 1, position].

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

>  
>          return issues
>  

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list