From d53ce705446c5bd9b11d3e54af2484b0815902a6 Mon Sep 17 00:00:00 2001 From: alfsb Date: Tue, 26 Nov 2024 08:31:46 -0300 Subject: [PATCH] Remove unused variables, fix disabled QA sync tools (#190) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: André L F S Bacci --- scripts/translation/lib/RevcheckFileItem.php | 6 +----- scripts/translation/lib/RevcheckRun.php | 21 +++++++++----------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/scripts/translation/lib/RevcheckFileItem.php b/scripts/translation/lib/RevcheckFileItem.php index 83232b3a5..0e79b9e17 100644 --- a/scripts/translation/lib/RevcheckFileItem.php +++ b/scripts/translation/lib/RevcheckFileItem.php @@ -23,8 +23,6 @@ class RevcheckFileItem { public string $file = ""; // from fs public int $size = 0 ; // from fs - public string $head = ""; // from vcs, source only, head hash, may be skipped - public string $diff = ""; // from vcs, source only, diff hash, no skips public int $date = 0 ; // from vcs, source only, date of head or diff commit public string $hashLast = ""; // derived by addGitLogData public string $hashDiff = ""; // derived by addGitLogData, isSyncHash @@ -39,8 +37,6 @@ function __construct( string $file , int $size ) { $this->file = $file; $this->size = $size; - $this->head = ""; - $this->diff = ""; $this->date = 0; $this->status = RevcheckStatus::Untranslated; $this->revtag = null; @@ -71,7 +67,7 @@ public function addGitLogData( string $hash , string $date , bool $skip ) : void $this->hashStop = true; } - public function isSyncHash( $hash ) + public function isSyncHash( $hash ) : bool { $sync = in_array( $hash , $this->hashList ); if ( $sync ) diff --git a/scripts/translation/lib/RevcheckRun.php b/scripts/translation/lib/RevcheckRun.php index 59e412be4..e80f5dfb4 100644 --- a/scripts/translation/lib/RevcheckRun.php +++ b/scripts/translation/lib/RevcheckRun.php @@ -98,21 +98,18 @@ private function calculateStatus() continue; } - // TODO remove $(source|target)H* with QA simplification - - // Previous code compares uptodate on multiple hashs. The last hash or the last non-skipped hash. - // See https://github.com/php/doc-base/blob/090ff07aa03c3e4ad7320a4ace9ffb6d5ede722f/scripts/revcheck.php#L374 - // and https://github.com/php/doc-base/blob/090ff07aa03c3e4ad7320a4ace9ffb6d5ede722f/scripts/revcheck.php#L392 . - - $sourceHsh1 = $source->head; - $sourceHsh2 = $source->diff; - $targetHash = $target->revtag->revision; - $daysOld = ( strtotime( "now" ) - $source->date ) / 86400; $daysOld = (int)$daysOld; - $qaInfo = new QaFileInfo( $sourceHsh1 , $targetHash , $this->sourceDir , $this->targetDir , $source->file , $daysOld ); - $this->qaList[ $source->file ] = $qaInfo; + // TODO Make QA related state detect changes and autogenerate + // TODO Move all QA related code outside of RevcheckRun + { + $sourceHash = $source->isSyncHash( $target->revtag->revision ) ? $source->hashDiff : $source->hashLast; + $targetHash = $target->revtag->revision; + + $qaInfo = new QaFileInfo( $sourceHash , $targetHash , $this->sourceDir , $this->targetDir , $source->file , $daysOld ); + $this->qaList[ $source->file ] = $qaInfo; + } // TranslatedOk