-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Command line tools for XML sync testing between languages #222
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of the coding style choices are exotic and not even consistent within the same file.
if ( implode( "\n" , $s ) == implode( "\n" , $t ) ) | ||
continue; | ||
|
||
$sideCount = array(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$sideCount = array(); | |
$sideCount = []; |
|
||
function extractPiData( array $list ) | ||
{ | ||
$ret = array(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ret = array(); | |
$ret = []; |
foreach( $s as $v ) | ||
$sideCount[$v] = [ 0 , 0 ]; | ||
foreach( $t as $v ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this coding style. Usually it would be something like:
foreach( $s as $v ) | |
$sideCount[$v] = [ 0 , 0 ]; | |
foreach( $t as $v ) | |
foreach ($s as $v) | |
$sideCount[$v] = [ 0 , 0 ]; | |
foreach ($t as $v) |
continue; | ||
|
||
print "# qaxml.r: $target\n"; | ||
foreach( $revtag->errors as $error ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
if ( implode( "\n" , $s ) == implode( "\n" , $t ) ) | ||
continue; | ||
|
||
$sideCount = array(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$sideCount = array(); | |
$sideCount = []; |
|
||
function extractTagsInnerText( array $nodes , array $tags ) | ||
{ | ||
$ret = array(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ret = array(); | |
$ret = []; |
if ( in_array( $tag , $tags ) == false ) | ||
continue; | ||
$text = $node->textContent; | ||
while( true ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly CS which I don't understand.
|
||
function extractTagsInnerXmls( array $nodes , array $tags ) | ||
{ | ||
$ret = array(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
} | ||
else | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
} | |
else | |
{ | |
} else { |
|
||
function collectTagLines( string $file , string $tag ) | ||
{ | ||
$ret = array(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
$s = extractPiData( $s ); | ||
$t = extractPiData( $t ); | ||
|
||
if ( implode( "\n" , $s ) == implode( "\n" , $t ) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be ===
? I think it would make more sense.
$target = $file->targetDir . '/' . $file->file; | ||
$output = new OutputBuffer( "# qaxml.p" , $target , $ignore ); | ||
|
||
[ $s , $_ , $_ ] = XmlFrag::loadXmlFragmentFile( $source ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you reusing the variable $_
twice? It's just going to overwrite it. And I don't think you are actually using this variable anywhere so why assign it at all?
$s = XmlFrag::listNodes( $s , XML_PI_NODE ); | ||
$t = XmlFrag::listNodes( $t , XML_PI_NODE ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$s = XmlFrag::listNodes( $s , XML_PI_NODE ); | |
$t = XmlFrag::listNodes( $t , XML_PI_NODE ); | |
$s = XmlFrag::listNodes( $s , XML_PI_NODE ); | |
$t = XmlFrag::listNodes( $t , XML_PI_NODE ); |
$s = XmlFrag::listNodes( $s , XML_PI_NODE ); | |
$t = XmlFrag::listNodes( $t , XML_PI_NODE ); | |
$source = XmlFrag::listNodes( $source , XML_PI_NODE ); | |
$target = XmlFrag::listNodes( $target , XML_PI_NODE ); |
Please don't use single-character variable names.
This PR rewrites the last of old qaxml tools into something that is almost independent of "lib revcheck" code, and adapted to be run in all translations.
After this PR is merged, and new tools announced, the old tools/code removing will be possible. The only dependence renaming are
/lib/RevtagParser.php
, that is a isolated file, andSyncFileList
calling intoRevcheckRun
, that can be replaced with a simple.xml
listing, as the new tools now inspect all files, and does not filter forTranslatedOk
anymore.