[Concept,01/18] buildman: Add missing return documentation in builder.py

Message ID 20260109183116.3262115-2-sjg@u-boot.org
State New
Headers
Series buildman: Improve test coverage for builder.py |

Commit Message

Simon Glass Jan. 9, 2026, 6:30 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Add return type documentation to functions that were missing it,
fixing pylint W9011/W9012 warnings. The affected functions are:

- make(): Returns CommandResult
- check_output() (nested): Returns bool
- get_output_dir(): Returns str path
- get_done_file(): Returns str path
- get_sizes_file(): Returns str path
- get_func_sizes_file(): Returns str path
- get_objdump_file(): Returns str path
- get_err_file(): Returns str path
- get_thread_dir(): Returns str path

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 tools/buildman/builder.py | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
  

Patch

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index b7343b57c0d..4bcde84adca 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -592,9 +592,20 @@  class Builder:
             cwd (str): Directory where make should be run
             args: Arguments to pass to make
             kwargs: Arguments to pass to command.run_one()
+
+        Returns:
+            CommandResult: Result of the make operation
         """
 
         def check_output(_stream, data):
+            """Check output for config restart loops
+
+            Args:
+                data (bytes): Output data to check
+
+            Returns:
+                bool: True to terminate the command, False to continue
+            """
             if b'Restart config' in data:
                 self._restarting_config = True
 
@@ -690,6 +701,9 @@  class Builder:
 
         Args:
             commit_upto (int): Commit number to use (0..self.count-1)
+
+        Returns:
+            str: Path to the output directory
         """
         if self.work_in_output:
             return self._working_dir
@@ -729,6 +743,9 @@  class Builder:
         Args:
             commit_upto (int): Commit number to use (0..self.count-1)
             target (str): Target name
+
+        Returns:
+            str: Path to the done file
         """
         return os.path.join(self.get_build_dir(commit_upto, target), 'done')
 
@@ -738,6 +755,9 @@  class Builder:
         Args:
             commit_upto (int): Commit number to use (0..self.count-1)
             target (str): Target name
+
+        Returns:
+            str: Path to the sizes file
         """
         return os.path.join(self.get_build_dir(commit_upto, target), 'sizes')
 
@@ -748,6 +768,9 @@  class Builder:
             commit_upto (int): Commit number to use (0..self.count-1)
             target (str): Target name
             elf_fname (str): Filename of elf image
+
+        Returns:
+            str: Path to the funcsizes file
         """
         return os.path.join(self.get_build_dir(commit_upto, target),
                             f"{elf_fname.replace('/', '-')}.sizes")
@@ -759,6 +782,9 @@  class Builder:
             commit_upto (int): Commit number to use (0..self.count-1)
             target (str): Target name
             elf_fname (str): Filename of elf image
+
+        Returns:
+            str: Path to the objdump file
         """
         return os.path.join(self.get_build_dir(commit_upto, target),
                             f"{elf_fname.replace('/', '-')}.objdump")
@@ -769,6 +795,9 @@  class Builder:
         Args:
             commit_upto (int): Commit number to use (0..self.count-1)
             target (str): Target name
+
+        Returns:
+            str: Path to the err file
         """
         output_dir = self.get_build_dir(commit_upto, target)
         return os.path.join(output_dir, 'err')
@@ -1983,6 +2012,9 @@  class Builder:
         Args:
             thread_num (int): Number of thread to check (-1 for main process,
                 which is treated as 0)
+
+        Returns:
+            str: Path to the thread's working directory
         """
         if self.work_in_output:
             return self._working_dir