public inbox for linux-doc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/docs/checktransupdate.py: fix missing prefix in f-string
@ 2026-03-08 10:41 LIU Haoyang
  2026-03-09  3:50 ` Dongliang Mu
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: LIU Haoyang @ 2026-03-08 10:41 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Jonathan Corbet, Shuah Khan, Dongliang Mu,
	Yanteng Si
  Cc: LIU Haoyang, linux-doc, linux-kernel

Add a f prefix to f-string in checktransupdate.py.

Fixes: 63e96ce050e5 ("scripts: fix all issues reported by pylint")
Signed-off-by: LIU Haoyang <tttturtleruss@gmail.com>
---
 tools/docs/checktransupdate.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/docs/checktransupdate.py b/tools/docs/checktransupdate.py
index e894652369a5..bf735562aeeb 100755
--- a/tools/docs/checktransupdate.py
+++ b/tools/docs/checktransupdate.py
@@ -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(f"Cannot find the origin path for {file_path}")
         return
 
     o_from_head = get_latest_commit_from(opath, "HEAD")
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] tools/docs/checktransupdate.py: fix missing prefix in f-string
  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-22 20:55 ` [PATCH] tools/docs/checktransupdate.py: fix missing prefix in f-string Jonathan Corbet
  2 siblings, 0 replies; 7+ messages in thread
From: Dongliang Mu @ 2026-03-09  3:50 UTC (permalink / raw)
  To: LIU Haoyang, Mauro Carvalho Chehab, Jonathan Corbet, Shuah Khan,
	Yanteng Si
  Cc: linux-doc, linux-kernel


On 3/8/26 6:41 PM, LIU Haoyang wrote:
> Add a f prefix to f-string in checktransupdate.py.
>
> Fixes: 63e96ce050e5 ("scripts: fix all issues reported by pylint")
> Signed-off-by: LIU Haoyang <tttturtleruss@gmail.com>

Hi Haoyang,

could you help fix all the issues mentioned by pylint? There is another 
issue reported by pylint.


tools/docs/checktransupdate.py:79:4: C0103: Variable name "HASH" doesn't 
conform to snake_case naming style (invalid-name)

Dongliang Mu

> ---
>   tools/docs/checktransupdate.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/docs/checktransupdate.py b/tools/docs/checktransupdate.py
> index e894652369a5..bf735562aeeb 100755
> --- a/tools/docs/checktransupdate.py
> +++ b/tools/docs/checktransupdate.py
> @@ -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(f"Cannot find the origin path for {file_path}")
>           return
>   
>       o_from_head = get_latest_commit_from(opath, "HEAD")


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] tools/docs/checktransupdate.py: fix all issues reported by pylint
  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 ` Haoyang LIU
  2026-03-09 15:54   ` Jonathan Corbet
  2026-03-22 20:55 ` [PATCH] tools/docs/checktransupdate.py: fix missing prefix in f-string Jonathan Corbet
  2 siblings, 1 reply; 7+ messages in thread
From: Haoyang LIU @ 2026-03-09  7:47 UTC (permalink / raw)
  To: tttturtleruss, Jonathan Corbet, Shuah Khan, Mauro Carvalho Chehab,
	Dongliang Mu, Yanteng Si
  Cc: linux-doc, linux-kernel

This patch fixes all issues reported by pylint, including:
1. Format issue in logging.
2. Variable name style issue.

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)
         return
 
     o_from_head = get_latest_commit_from(opath, "HEAD")
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] tools/docs/checktransupdate.py: fix all issues reported by pylint
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Corbet @ 2026-03-09 15:54 UTC (permalink / raw)
  To: Haoyang LIU, tttturtleruss, Shuah Khan, Mauro Carvalho Chehab,
	Dongliang Mu, Yanteng Si
  Cc: linux-doc, linux-kernel

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.

> 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?

Thanks,

jon

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] tools/docs/checktransupdate.py: fix all issues reported by pylint
  2026-03-09 15:54   ` Jonathan Corbet
@ 2026-03-09 16:56     ` Haoyang Liu
  2026-03-09 17:42       ` 刘浩阳
  0 siblings, 1 reply; 7+ messages in thread
From: Haoyang Liu @ 2026-03-09 16:56 UTC (permalink / raw)
  To: Jonathan Corbet, Shuah Khan, Mauro Carvalho Chehab, Dongliang Mu,
	Yanteng Si
  Cc: linux-doc, linux-kernel


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] tools/docs/checktransupdate.py: fix all issues reported by pylint
  2026-03-09 16:56     ` Haoyang Liu
@ 2026-03-09 17:42       ` 刘浩阳
  0 siblings, 0 replies; 7+ messages in thread
From: 刘浩阳 @ 2026-03-09 17:42 UTC (permalink / raw)
  To: Jonathan Corbet, Shuah Khan, Mauro Carvalho Chehab, Dongliang Mu,
	Si Yanteng
  Cc: linux-doc, linux-kernel


Sent from my iPhone

> On 10 Mar 2026, at 00:56, Haoyang Liu <tttturtleruss@gmail.com> wrote:
> 
> 
>> 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.
To me, using f-string or lazy format are the same. ( sorry for the unfinished message)

Haoyang
> 
> Sincerely,
> Haoyang
> 
>> 
>> Thanks,
>> 
>> jon

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tools/docs/checktransupdate.py: fix missing prefix in f-string
  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-22 20:55 ` Jonathan Corbet
  2 siblings, 0 replies; 7+ messages in thread
From: Jonathan Corbet @ 2026-03-22 20:55 UTC (permalink / raw)
  To: LIU Haoyang, Mauro Carvalho Chehab, Shuah Khan, Dongliang Mu,
	Yanteng Si
  Cc: LIU Haoyang, linux-doc, linux-kernel

LIU Haoyang <tttturtleruss@gmail.com> writes:

> Add a f prefix to f-string in checktransupdate.py.
>
> Fixes: 63e96ce050e5 ("scripts: fix all issues reported by pylint")
> Signed-off-by: LIU Haoyang <tttturtleruss@gmail.com>
> ---
>  tools/docs/checktransupdate.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/docs/checktransupdate.py b/tools/docs/checktransupdate.py
> index e894652369a5..bf735562aeeb 100755
> --- a/tools/docs/checktransupdate.py
> +++ b/tools/docs/checktransupdate.py
> @@ -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(f"Cannot find the origin path for {file_path}")
>          return

Applied, thanks.

jon

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-22 20:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2026-03-09 17:42       ` 刘浩阳
2026-03-22 20:55 ` [PATCH] tools/docs/checktransupdate.py: fix missing prefix in f-string Jonathan Corbet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox