[{"id":23224,"web_url":"https://patchwork.libcamera.org/comment/23224/","msgid":"<20220530081413.GA2630765@pyrite.rasen.tech>","date":"2022-05-30T08:14:13","subject":"Re: [libcamera-devel] [PATCH] utils: checkstyle.py: Fix color bleed","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"Hi Tomi,\n\nOn Mon, May 30, 2022 at 10:22:28AM +0300, Tomi Valkeinen via libcamera-devel wrote:\n> If issue.line is None, the the terminal color is never reset back to\n> normal. This causes the yellow color to bleed.\n> \n> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  utils/checkstyle.py | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n> \n> diff --git a/utils/checkstyle.py b/utils/checkstyle.py\n> index 835f2a9f..fa0513f2 100755\n> --- a/utils/checkstyle.py\n> +++ b/utils/checkstyle.py\n> @@ -743,9 +743,9 @@ def check_file(top_level, commit, filename):\n>      if len(issues):\n>          issues = sorted(issues, key=lambda i: i.line_number)\n>          for issue in issues:\n> -            print('%s#%u: %s' % (Colours.fg(Colours.Yellow), issue.line_number, issue.msg))\n> +            print('%s#%u: %s%s' % (Colours.fg(Colours.Yellow), issue.line_number, issue.msg, Colours.reset()))\n>              if issue.line is not None:\n> -                print('+%s%s' % (issue.line.rstrip(), Colours.reset()))\n> +                print('%s+%s%s' % (Colours.fg(Colours.Yellow), issue.line.rstrip(), Colours.reset()))\n>  \n>      return len(formatted_diff) + len(issues)\n>  \n> -- \n> 2.34.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id D3F60BD161\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 30 May 2022 08:14:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E01A765633;\n\tMon, 30 May 2022 10:14:23 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D28886040B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 May 2022 10:14:21 +0200 (CEST)","from pyrite.rasen.tech (softbank036240126034.bbtec.net\n\t[36.240.126.34])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BB3C36BD;\n\tMon, 30 May 2022 10:14:19 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653898463;\n\tbh=FFGIFb+JE6EQ/9GRdhGSdn4F93EUYDL6MTBgSZEbYb8=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=1KhJkspmRmixE/pddhb6P5URqIR+m7nkVb5/Mmswk7V5toUitOhxT39YahoAyFyFj\n\tS31wMds4l1WEfxy8r7aHWbLOKruO9CyAgo+RpoVsAM1+dT6F47xj5BGMkjodRpW9jx\n\tFUg+HDgyQ219okEP8LbMnZsCkPvGR0/zWzyX6ETEB1KWau+6B0GPwr+Mi+LrVBYtE9\n\tCzvZA81NwQIMwh+x+iO70x9Ce4JQe1/45irZdxdEiCl2yVyOjiy7zpmgiEepIMklET\n\t7k8OhU5JxSwmo6MCmpz0V/1kPHIsvIYWZ+tgDSQWP7WISPs7vek/t9yFfxjlTMMHAm\n\tKBCuv86ltoc3g==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653898461;\n\tbh=FFGIFb+JE6EQ/9GRdhGSdn4F93EUYDL6MTBgSZEbYb8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=jwFoy0P+DkDZrBnE57TX0kQpWqT1AQzRFQ6+ViW4aegWi2B4umdbEZSBE70MGafUC\n\touHV7b3mspCG6tt9Hx4XZtmNGnElNk1aH7ZASarRTHVaLQ7VjDqcT80rSlHUsNQgrd\n\ta1ZbBzgJ9RWVgJTfMvwLyVz3taliE9nK5bfQYrto="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"jwFoy0P+\"; dkim-atps=neutral","Date":"Mon, 30 May 2022 17:14:13 +0900","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Message-ID":"<20220530081413.GA2630765@pyrite.rasen.tech>","References":"<20220530072228.15916-1-tomi.valkeinen@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20220530072228.15916-1-tomi.valkeinen@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH] utils: checkstyle.py: Fix color bleed","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"paul.elder@ideasonboard.com","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23225,"web_url":"https://patchwork.libcamera.org/comment/23225/","msgid":"<YpR+s8cYdJ6nkC7c@pendragon.ideasonboard.com>","date":"2022-05-30T08:22:11","subject":"Re: [libcamera-devel] [PATCH] utils: checkstyle.py: Fix color bleed","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Tomi,\n\nThank you for the patch.\n\nOn Mon, May 30, 2022 at 10:22:28AM +0300, Tomi Valkeinen wrote:\n> If issue.line is None, the the terminal color is never reset back to\n> normal. This causes the yellow color to bleed.\n> \n> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n> ---\n>  utils/checkstyle.py | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n> \n> diff --git a/utils/checkstyle.py b/utils/checkstyle.py\n> index 835f2a9f..fa0513f2 100755\n> --- a/utils/checkstyle.py\n> +++ b/utils/checkstyle.py\n> @@ -743,9 +743,9 @@ def check_file(top_level, commit, filename):\n>      if len(issues):\n>          issues = sorted(issues, key=lambda i: i.line_number)\n>          for issue in issues:\n> -            print('%s#%u: %s' % (Colours.fg(Colours.Yellow), issue.line_number, issue.msg))\n> +            print('%s#%u: %s%s' % (Colours.fg(Colours.Yellow), issue.line_number, issue.msg, Colours.reset()))\n\nThis could be wrapped.\n\n>              if issue.line is not None:\n> -                print('+%s%s' % (issue.line.rstrip(), Colours.reset()))\n> +                print('%s+%s%s' % (Colours.fg(Colours.Yellow), issue.line.rstrip(), Colours.reset()))\n\nI think I would have added\n\n            sys.stdout.write(Colours.reset())\n\nhere (and dropped it from the previous line) to avoid outputting it\ntwice, but that makes no big difference. Either way,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n>  \n>      return len(formatted_diff) + len(issues)\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id D08CABD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 30 May 2022 08:22:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1CF1165633;\n\tMon, 30 May 2022 10:22:16 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3D9E16040B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 May 2022 10:22:14 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(lmontsouris-659-1-41-236.w92-154.abo.wanadoo.fr [92.154.76.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BED3C6BD;\n\tMon, 30 May 2022 10:22:13 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653898936;\n\tbh=rTCipshGXeOjf2l5t8BqcPEQmRZp2U3HPR80yDjnzko=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=4NIhKg8q8s5o7Cp5nGYWS4tmidGWstH/gCycezka02ah6ZVJf39DHAA18NEzIBjmm\n\tTHNe0Ek0eCAGdmRs0YTtCwjnGrDox9SDRjJGuvNMcVGDfTF0/0VzuXUo0/EV6VjIuW\n\trDgCum3J4C8Fhd9SUY078Yn+0/aGj0URMxqQWBV+ZNvu3S2v8e35WmllTz2AOQZwTv\n\tRfrI5996MugBH9hqiEkSMVVCWgPmXWCn0WJV6cb7u36x6rFzlXkHLQHmh1Ty0+lXw2\n\t+zFyTpivOD09XZ/7WJfa/FgeONkXXMa9ipJEKOYyBKRft6lceflrXmyUJM8mabkzI6\n\t2UtYysCmdGDXg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653898933;\n\tbh=rTCipshGXeOjf2l5t8BqcPEQmRZp2U3HPR80yDjnzko=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Ds4JOnF/5ul2X7ijDwh+uvFG52ikZ9KsEPc4o4rpD65v5VByzVZyZKEb/LbB8BdXK\n\tQfSzQSFn9px0xi6q1Zu+lrG80Lj6E45P7aaMVnBAzW7sUGqun3pshW+N186eZppRye\n\trrPUN3EFjrjwRgP7zKAuASZv9OsWBgMSeSw446Fg="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Ds4JOnF/\"; dkim-atps=neutral","Date":"Mon, 30 May 2022 11:22:11 +0300","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Message-ID":"<YpR+s8cYdJ6nkC7c@pendragon.ideasonboard.com>","References":"<20220530072228.15916-1-tomi.valkeinen@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220530072228.15916-1-tomi.valkeinen@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH] utils: checkstyle.py: Fix color bleed","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23299,"web_url":"https://patchwork.libcamera.org/comment/23299/","msgid":"<968a8545-c8cd-9cc4-ccba-46d31181c252@ideasonboard.com>","date":"2022-06-03T06:09:24","subject":"Re: [libcamera-devel] [PATCH] utils: checkstyle.py: Fix color bleed","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"content":"On 30/05/2022 11:22, Laurent Pinchart wrote:\n> Hi Tomi,\n> \n> Thank you for the patch.\n> \n> On Mon, May 30, 2022 at 10:22:28AM +0300, Tomi Valkeinen wrote:\n>> If issue.line is None, the the terminal color is never reset back to\n>> normal. This causes the yellow color to bleed.\n>>\n>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n>> ---\n>>   utils/checkstyle.py | 4 ++--\n>>   1 file changed, 2 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/utils/checkstyle.py b/utils/checkstyle.py\n>> index 835f2a9f..fa0513f2 100755\n>> --- a/utils/checkstyle.py\n>> +++ b/utils/checkstyle.py\n>> @@ -743,9 +743,9 @@ def check_file(top_level, commit, filename):\n>>       if len(issues):\n>>           issues = sorted(issues, key=lambda i: i.line_number)\n>>           for issue in issues:\n>> -            print('%s#%u: %s' % (Colours.fg(Colours.Yellow), issue.line_number, issue.msg))\n>> +            print('%s#%u: %s%s' % (Colours.fg(Colours.Yellow), issue.line_number, issue.msg, Colours.reset()))\n> \n> This could be wrapped.\n> \n>>               if issue.line is not None:\n>> -                print('+%s%s' % (issue.line.rstrip(), Colours.reset()))\n>> +                print('%s+%s%s' % (Colours.fg(Colours.Yellow), issue.line.rstrip(), Colours.reset()))\n> \n> I think I would have added\n> \n>              sys.stdout.write(Colours.reset())\n> \n> here (and dropped it from the previous line) to avoid outputting it\n> twice, but that makes no big difference. Either way,\n\nThere are many ways to do this, of course. If we want to optimize, we'll \nprint Yellow only once, then the text lines, and a reset at the end. But \nthat would be a rather pointless optimization.\n\nI thought it's most obvious for the reader and easiest to maintain if we \nprint a color and a reset in the same print() call.\n\nIn fact, I think it would be better to have a function, colorize(color, \nstr), which returns the str with color and reset. This is what e.g. \nxtermcolor module does.\n\n  Tomi","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id AF2BEBD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  3 Jun 2022 06:09:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BF69265635;\n\tFri,  3 Jun 2022 08:09:29 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C560B60104\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 Jun 2022 08:09:27 +0200 (CEST)","from [192.168.1.111] (91-156-85-209.elisa-laajakaista.fi\n\t[91.156.85.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2C4C030A;\n\tFri,  3 Jun 2022 08:09:27 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1654236569;\n\tbh=YSIvTXuxglpo1hGesPfXnKNEyyFFguncf2d/6UuKNvQ=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=s0htlVgLN3BrLyPJLC2BRW/VpyUBQZbfuz38gw8wJNWHgNwnlBAjuVjKWTq31cG2y\n\tDZ0xxI9CltLZyBW9zENBmk4vRRJ/pu8BdxROPMzCQ5NhnEtpJ0zFlQP98lMHFMvY8y\n\tIOUjzbuKjdHrLd7bimWzrJGEBJ8oHS+/blkKPFEOUyAMjrIMKMcskMruOvyxcQg5sL\n\tpqxhprYFeguG9HznlBIprnkBh48TDOQpm54YL14vpduRCV5RskyrtA+OawZ/VCgII5\n\tiFsp7z8lCQonGtSABzgZ4r9cBS5AcY6lhmuT4w19sbck3yTMJYgTKBkjOHh0btxUCr\n\t3bBImb8zBgxYw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1654236567;\n\tbh=YSIvTXuxglpo1hGesPfXnKNEyyFFguncf2d/6UuKNvQ=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=Qr7NM1QfoChIBQRkszJL9oZPWP2qcgX6+m5eCxwyewJpplN8PoX12gNdwpJlKGUZi\n\t46bfpavAsbtTgM25AsnANZRuwpqr6sZ5Br9JNNb4gh2kBy0G/HD8Wro8qAKEdc2RAW\n\tucl3Knv4YXNx2WIFp16NfdKWLm2jEbBWilOwubMg="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Qr7NM1Qf\"; dkim-atps=neutral","Message-ID":"<968a8545-c8cd-9cc4-ccba-46d31181c252@ideasonboard.com>","Date":"Fri, 3 Jun 2022 09:09:24 +0300","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.9.1","Content-Language":"en-US","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","References":"<20220530072228.15916-1-tomi.valkeinen@ideasonboard.com>\n\t<YpR+s8cYdJ6nkC7c@pendragon.ideasonboard.com>","In-Reply-To":"<YpR+s8cYdJ6nkC7c@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH] utils: checkstyle.py: Fix color bleed","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23310,"web_url":"https://patchwork.libcamera.org/comment/23310/","msgid":"<YppwBNvHv/xWwRUP@pendragon.ideasonboard.com>","date":"2022-06-03T20:33:08","subject":"Re: [libcamera-devel] [PATCH] utils: checkstyle.py: Fix color bleed","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Tomi,\n\nOn Fri, Jun 03, 2022 at 09:09:24AM +0300, Tomi Valkeinen wrote:\n> On 30/05/2022 11:22, Laurent Pinchart wrote:\n> > On Mon, May 30, 2022 at 10:22:28AM +0300, Tomi Valkeinen wrote:\n> >> If issue.line is None, the the terminal color is never reset back to\n> >> normal. This causes the yellow color to bleed.\n> >>\n> >> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n> >> ---\n> >>   utils/checkstyle.py | 4 ++--\n> >>   1 file changed, 2 insertions(+), 2 deletions(-)\n> >>\n> >> diff --git a/utils/checkstyle.py b/utils/checkstyle.py\n> >> index 835f2a9f..fa0513f2 100755\n> >> --- a/utils/checkstyle.py\n> >> +++ b/utils/checkstyle.py\n> >> @@ -743,9 +743,9 @@ def check_file(top_level, commit, filename):\n> >>       if len(issues):\n> >>           issues = sorted(issues, key=lambda i: i.line_number)\n> >>           for issue in issues:\n> >> -            print('%s#%u: %s' % (Colours.fg(Colours.Yellow), issue.line_number, issue.msg))\n> >> +            print('%s#%u: %s%s' % (Colours.fg(Colours.Yellow), issue.line_number, issue.msg, Colours.reset()))\n> > \n> > This could be wrapped.\n> > \n> >>               if issue.line is not None:\n> >> -                print('+%s%s' % (issue.line.rstrip(), Colours.reset()))\n> >> +                print('%s+%s%s' % (Colours.fg(Colours.Yellow), issue.line.rstrip(), Colours.reset()))\n> > \n> > I think I would have added\n> > \n> >              sys.stdout.write(Colours.reset())\n> > \n> > here (and dropped it from the previous line) to avoid outputting it\n> > twice, but that makes no big difference. Either way,\n> \n> There are many ways to do this, of course. If we want to optimize, we'll \n> print Yellow only once, then the text lines, and a reset at the end. But \n> that would be a rather pointless optimization.\n> \n> I thought it's most obvious for the reader and easiest to maintain if we \n> print a color and a reset in the same print() call.\n> \n> In fact, I think it would be better to have a function, colorize(color, \n> str), which returns the str with color and reset. This is what e.g. \n> xtermcolor module does.\n\nThat's a good point. There's clearly no need to optimize this for\nperformance, so if someone wants to add a colorize() function, I'll be\nhappy to merge it. In the meantime I'll merge your patch with the line\nwrap I proposed.","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 5D878BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  3 Jun 2022 20:33:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 97FB565633;\n\tFri,  3 Jun 2022 22:33:14 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5C90D60105\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 Jun 2022 22:33:13 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(lmontsouris-659-1-41-236.w92-154.abo.wanadoo.fr [92.154.76.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id F16D22A5;\n\tFri,  3 Jun 2022 22:33:12 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1654288394;\n\tbh=3c2mp5hw6/D3D1xi3n3EtqAwQ3RE1xEOktagGqdrb4U=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=ngymdJhBN3MaQ+s6ayq3MK4OxLfGcCIUYiurt1bCLPsW94OYLnxuuMPWSUkLkWftp\n\t23mG3BHNg5K73FGkKoGeC6E1oeE+ovIIXNg9KVUqhGyMsSSZCwVI6QbR0o/IwKgNv9\n\tEq0avd7Jq49pZQeA8akeXjGzlByz2BLvmmTYfQwC8UYbvNa1ZB1xcgo9C8lRp5p2E9\n\tjtF9pemS6RMMeHgrd2Yy3uEfj1rp/jeKzNKIuOKn4Qh/5jlqCa8xpoiZEkqRLTb1RV\n\tRl6rsrsnkKND1ZA7KvdlqXG2BxMsuagPPiQ412KxXQ68m3aJsv+4jN8Xutwort7S9d\n\tBEF3MqKLOqRbg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1654288393;\n\tbh=3c2mp5hw6/D3D1xi3n3EtqAwQ3RE1xEOktagGqdrb4U=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=q3Ce2tNG+U75UsIXbWUn5ikRYcjsXATaWO/q8o1cAujFiF+/Z6AjLTF5j4xKJuxz6\n\tgc9RXdoezCqxOkI2Oot0p+szR9NXtQjvTGQWijn/+YjQnkGCC3xgBUSi3oyvTr7xDF\n\tyoAZ8N5y/LZVNJsSVmzTMIeVsPkZF+vyRaM2jt4g="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"q3Ce2tNG\"; dkim-atps=neutral","Date":"Fri, 3 Jun 2022 23:33:08 +0300","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Message-ID":"<YppwBNvHv/xWwRUP@pendragon.ideasonboard.com>","References":"<20220530072228.15916-1-tomi.valkeinen@ideasonboard.com>\n\t<YpR+s8cYdJ6nkC7c@pendragon.ideasonboard.com>\n\t<968a8545-c8cd-9cc4-ccba-46d31181c252@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<968a8545-c8cd-9cc4-ccba-46d31181c252@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH] utils: checkstyle.py: Fix color bleed","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]