Skip to content

Commit

Permalink
Remove unused variables, fix disabled QA sync tools (#190)
Browse files Browse the repository at this point in the history
Co-authored-by: André L F S Bacci <ae@php.net>
  • Loading branch information
alfsb and André L F S Bacci authored Nov 26, 2024
1 parent 3d645f8 commit d53ce70
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
6 changes: 1 addition & 5 deletions scripts/translation/lib/RevcheckFileItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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 )
Expand Down
21 changes: 9 additions & 12 deletions scripts/translation/lib/RevcheckRun.php
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit d53ce70

Please sign in to comment.