Skip to content

Commit d53ce70

Browse files
alfsbAndré L F S Bacci
andauthored
Remove unused variables, fix disabled QA sync tools (#190)
Co-authored-by: André L F S Bacci <[email protected]>
1 parent 3d645f8 commit d53ce70

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

scripts/translation/lib/RevcheckFileItem.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ class RevcheckFileItem
2323
{
2424
public string $file = ""; // from fs
2525
public int $size = 0 ; // from fs
26-
public string $head = ""; // from vcs, source only, head hash, may be skipped
27-
public string $diff = ""; // from vcs, source only, diff hash, no skips
2826
public int $date = 0 ; // from vcs, source only, date of head or diff commit
2927
public string $hashLast = ""; // derived by addGitLogData
3028
public string $hashDiff = ""; // derived by addGitLogData, isSyncHash
@@ -39,8 +37,6 @@ function __construct( string $file , int $size )
3937
{
4038
$this->file = $file;
4139
$this->size = $size;
42-
$this->head = "";
43-
$this->diff = "";
4440
$this->date = 0;
4541
$this->status = RevcheckStatus::Untranslated;
4642
$this->revtag = null;
@@ -71,7 +67,7 @@ public function addGitLogData( string $hash , string $date , bool $skip ) : void
7167
$this->hashStop = true;
7268
}
7369

74-
public function isSyncHash( $hash )
70+
public function isSyncHash( $hash ) : bool
7571
{
7672
$sync = in_array( $hash , $this->hashList );
7773
if ( $sync )

scripts/translation/lib/RevcheckRun.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,18 @@ private function calculateStatus()
9898
continue;
9999
}
100100

101-
// TODO remove $(source|target)H* with QA simplification
102-
103-
// Previous code compares uptodate on multiple hashs. The last hash or the last non-skipped hash.
104-
// See https://github.com/php/doc-base/blob/090ff07aa03c3e4ad7320a4ace9ffb6d5ede722f/scripts/revcheck.php#L374
105-
// and https://github.com/php/doc-base/blob/090ff07aa03c3e4ad7320a4ace9ffb6d5ede722f/scripts/revcheck.php#L392 .
106-
107-
$sourceHsh1 = $source->head;
108-
$sourceHsh2 = $source->diff;
109-
$targetHash = $target->revtag->revision;
110-
111101
$daysOld = ( strtotime( "now" ) - $source->date ) / 86400;
112102
$daysOld = (int)$daysOld;
113103

114-
$qaInfo = new QaFileInfo( $sourceHsh1 , $targetHash , $this->sourceDir , $this->targetDir , $source->file , $daysOld );
115-
$this->qaList[ $source->file ] = $qaInfo;
104+
// TODO Make QA related state detect changes and autogenerate
105+
// TODO Move all QA related code outside of RevcheckRun
106+
{
107+
$sourceHash = $source->isSyncHash( $target->revtag->revision ) ? $source->hashDiff : $source->hashLast;
108+
$targetHash = $target->revtag->revision;
109+
110+
$qaInfo = new QaFileInfo( $sourceHash , $targetHash , $this->sourceDir , $this->targetDir , $source->file , $daysOld );
111+
$this->qaList[ $source->file ] = $qaInfo;
112+
}
116113

117114
// TranslatedOk
118115

0 commit comments

Comments
 (0)