public inbox for linux-doc@vger.kernel.org
 help / color / mirror / Atom feed
From: Haoyang Liu <tttturtleruss@gmail.com>
To: Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Dongliang Mu <dzm91@hust.edu.cn>,
	Yanteng Si <si.yanteng@linux.dev>
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] tools/docs/checktransupdate.py: fix all issues reported by pylint
Date: Tue, 10 Mar 2026 00:56:04 +0800	[thread overview]
Message-ID: <b497e871-f9b8-4e3f-bc4f-eec9c76adca2@gmail.com> (raw)
In-Reply-To: <87cy1dxaka.fsf@trenco.lwn.net>


On 3/9/2026 11:54 PM, Jonathan Corbet wrote:
> Haoyang LIU <tttturtleruss@gmail.com> writes:
>
>> This patch fixes all issues reported by pylint, including:
>> 1. Format issue in logging.
>> 2. Variable name style issue.
> I'm somewhat unconvinced about that second change.  We haven't come up
> with a coding style for Python code in the kernel, but I think we do
> want it to look at least a bit like kernel code and not just defer all
> decisions to tools like pylint.  I'm not really opposed to this change
> either, mind you, but the process of getting there worries me a bit.

Dear Jon,

My initial thought was that 'HASH' looks like a global-style constant, 
while it's actually a local variable. However, the lowercase 'hash' has 
conflict with python built-in hash function, so I renamed it to hash_re 
to indicate that it's a regular expression.

>
>> Fixes: 63e96ce050e5 ("scripts: fix all issues reported by pylint")
>> Signed-off-by: Haoyang LIU <tttturtleruss@gmail.com>
>> ---
>> V1 -> V2: fix variable name style name and keep the format consistent with other logging format
>>
>>   tools/docs/checktransupdate.py | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/tools/docs/checktransupdate.py b/tools/docs/checktransupdate.py
>> index e894652369a5..cc07cda667fc 100755
>> --- a/tools/docs/checktransupdate.py
>> +++ b/tools/docs/checktransupdate.py
>> @@ -76,11 +76,11 @@ def get_origin_from_trans_smartly(origin_path, t_from_head):
>>       (2) Update the translation through commit HASH (TITLE)
>>       """
>>       # catch flag for 12-bit commit hash
>> -    HASH = r'([0-9a-f]{12})'
>> +    hash_re = r'([0-9a-f]{12})'
>>       # pattern 1: contains "update to commit HASH"
>> -    pat_update_to = re.compile(rf'update to commit {HASH}')
>> +    pat_update_to = re.compile(rf'update to commit {hash_re}')
>>       # pattern 2: contains "Update the translation through commit HASH"
>> -    pat_update_translation = re.compile(rf'Update the translation through commit {HASH}')
>> +    pat_update_translation = re.compile(rf'Update the translation through commit {hash_re}')
>>   
>>       origin_commit_hash = None
>>       for line in t_from_head["message"]:
>> @@ -131,7 +131,7 @@ def check_per_file(file_path):
>>       opath = get_origin_path(file_path)
>>   
>>       if not os.path.isfile(opath):
>> -        logging.error("Cannot find the origin path for {file_path}")
>> +        logging.error("Cannot find the origin path for %s", file_path)
> Why was this change made?  The first time around, you'd simply added the
> obviously missing "f", which seems better?
I used the "%s" style mainly to keep the logging format consistent with 
the other logging statements in this file, which follow the same 
pattern. To me, using f-string or lazy format.

Sincerely,
Haoyang

>
> Thanks,
>
> jon

  reply	other threads:[~2026-03-09 16:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-08 10:41 [PATCH] tools/docs/checktransupdate.py: fix missing prefix in f-string LIU Haoyang
2026-03-09  3:50 ` Dongliang Mu
2026-03-09  7:47 ` [PATCH v2] tools/docs/checktransupdate.py: fix all issues reported by pylint Haoyang LIU
2026-03-09 15:54   ` Jonathan Corbet
2026-03-09 16:56     ` Haoyang Liu [this message]
2026-03-09 17:42       ` 刘浩阳
2026-03-22 20:55 ` [PATCH] tools/docs/checktransupdate.py: fix missing prefix in f-string Jonathan Corbet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b497e871-f9b8-4e3f-bc4f-eec9c76adca2@gmail.com \
    --to=tttturtleruss@gmail.com \
    --cc=corbet@lwn.net \
    --cc=dzm91@hust.edu.cn \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=si.yanteng@linux.dev \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox