From 0c2f4d761f8ed55d3dff45d3e0379f41b16a662f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Such=C3=BD?= Date: Tue, 21 Apr 2026 15:57:31 +0200 Subject: [PATCH] Fix double-increment of progress bar position in DebuggedProgressBar.make_step MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit make_step was incrementing self.pos manually and then calling super().make_step() which incremented it again, causing the progress bar to advance twice as fast as expected. Related to: https://github.com/aboutcode-org/scancode-toolkit/pull/4100 Signed-off-by: Miroslav Suchý Assisted-By: Claude Opus 4.6 --- src/commoncode/cliutils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/commoncode/cliutils.py b/src/commoncode/cliutils.py index 5b0a01e2..4febbfab 100644 --- a/src/commoncode/cliutils.py +++ b/src/commoncode/cliutils.py @@ -194,9 +194,8 @@ class DebuggedProgressBar(CompatProgressBar): # overriden and copied from Click to work around Click woes for # https://github.com/aboutcode-org/scancode-toolkit/issues/2583 def make_step(self, n_steps): - # always increment - self.pos += n_steps or 1 - super(DebuggedProgressBar, self).make_step(n_steps) + # always increment even if n_steps is 0 + super(DebuggedProgressBar, self).make_step(n_steps or 1) # overriden and copied from Click to work around Click woes for # https://github.com/aboutcode-org/scancode-toolkit/issues/2583