jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/358065 )
Change subject: Make phpcs pass - includes/* ...................................................................... Make phpcs pass - includes/* Change-Id: I59a78a920ad911ccbfcd322863683b2d8b5e4134 --- M includes/ballots/ApprovalBallot.php M includes/ballots/Ballot.php M includes/ballots/ChooseBallot.php M includes/ballots/PreferentialBallot.php M includes/ballots/RadioRangeBallot.php M includes/ballots/RadioRangeCommentBallot.php M includes/pages/CreatePage.php M includes/pages/EntryPage.php M includes/pages/ListPage.php M includes/pages/VotePage.php M includes/pages/VoterEligibilityPage.php M includes/talliers/CommentDumper.php M includes/talliers/SchulzeTallier.php M includes/talliers/Tallier.php 14 files changed, 32 insertions(+), 42 deletions(-) Approvals: Huji: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/ballots/ApprovalBallot.php b/includes/ballots/ApprovalBallot.php index ec4c0b1..eb93a2e 100644 --- a/includes/ballots/ApprovalBallot.php +++ b/includes/ballots/ApprovalBallot.php @@ -54,11 +54,11 @@ function unpackRecord( $record ) { $scores = array(); - $itemLength = 2*8 + 7; - for ( $offset = 0; $offset < strlen( $record ); $offset += $itemLength ) { + $itemLength = 2 * 8 + 7; + for ( $offset = 0, $len = strlen( $record ); $offset < $len; $offset += $itemLength ) { if ( !preg_match( '/Q([0-9A-F]{8})-A([0-9A-F]{8})-([yn])--/A', - $record, $m, 0, $offset ) ) - { + $record, $m, 0, $offset ) + ) { wfDebug( __METHOD__.": regex doesn't match\n" ); return false; } diff --git a/includes/ballots/Ballot.php b/includes/ballots/Ballot.php index 10cc35b..2a65f12 100644 --- a/includes/ballots/Ballot.php +++ b/includes/ballots/Ballot.php @@ -220,9 +220,8 @@ * @return false on failure or if cast ballots are hidden, or the output * of unpackRecord(). */ - function getCurrentVote(){ - - if( !$this->election->getOption( 'show-change' ) ){ + function getCurrentVote() { + if ( !$this->election->getOption( 'show-change' ) ) { return false; } @@ -247,7 +246,7 @@ array( $this, 'getCurrentVoteCallback' ), $voter->getId() ); - if( !$status->isOK() ){ + if ( !$status->isOK() ){ return false; } @@ -256,7 +255,7 @@ : false; } - function getCurrentVoteCallback( $store, $record ){ + function getCurrentVoteCallback( $store, $record ) { $this->currentVote = $record; return Status::newGood(); } diff --git a/includes/ballots/ChooseBallot.php b/includes/ballots/ChooseBallot.php index 9eaa29d..5daec53 100644 --- a/includes/ballots/ChooseBallot.php +++ b/includes/ballots/ChooseBallot.php @@ -71,7 +71,7 @@ function unpackRecord( $record ) { $result = array(); $record = trim( $record ); - for ( $offset = 0; $offset < strlen( $record ); $offset += 18 ) { + for ( $offset = 0, $len = strlen( $record ); $offset < $len; $offset += 18 ) { if ( !preg_match( '/Q([0-9A-F]{8})A([0-9A-F]{8})/A', $record, $m, 0, $offset ) ) { wfDebug( __METHOD__.": regex doesn't match\n" ); return false; diff --git a/includes/ballots/PreferentialBallot.php b/includes/ballots/PreferentialBallot.php index 3a8e114..cf68f18 100644 --- a/includes/ballots/PreferentialBallot.php +++ b/includes/ballots/PreferentialBallot.php @@ -101,10 +101,10 @@ function unpackRecord( $record ) { $ranks = array(); $itemLength = 3*8 + 7; - for ( $offset = 0; $offset < strlen( $record ); $offset += $itemLength ) { + for ( $offset = 0, $len = strlen( $record ); $offset < $len; $offset += $itemLength ) { if ( !preg_match( '/Q([0-9A-F]{8})-A([0-9A-F]{8})-R([0-9A-F]{8})--/A', - $record, $m, 0, $offset ) ) - { + $record, $m, 0, $offset ) + ) { wfDebug( __METHOD__.": regex doesn't match\n" ); return false; } @@ -144,4 +144,3 @@ return $result; } } - diff --git a/includes/ballots/RadioRangeBallot.php b/includes/ballots/RadioRangeBallot.php index 0244e50..5f7e739 100644 --- a/includes/ballots/RadioRangeBallot.php +++ b/includes/ballots/RadioRangeBallot.php @@ -156,7 +156,7 @@ * @return array */ function getColumnLabels( $question ) { - //list( $min, $max ) = $this->getMinMax( $question ); + // list( $min, $max ) = $this->getMinMax( $question ); $labels = array(); $useMessageLabels = $question->getProperty( 'column-label-msgs' ); $scores = $this->getScoresLeftToRight( $question ); @@ -298,10 +298,10 @@ foreach ( $this->election->getQuestions() as $question ) { $questions[$question->getId()] = $question; } - for ( $offset = 0; $offset < strlen( $record ); $offset += $itemLength ) { + for ( $offset = 0, $len = strlen( $record ); $offset < $len; $offset += $itemLength ) { if ( !preg_match( '/Q([0-9A-F]{8})-A([0-9A-F]{8})-S([+-][0-9]{10})--/A', - $record, $m, 0, $offset ) ) - { + $record, $m, 0, $offset ) + ) { wfDebug( __METHOD__.": regex doesn't match\n" ); return false; } @@ -346,5 +346,3 @@ return $result; } } - - diff --git a/includes/ballots/RadioRangeCommentBallot.php b/includes/ballots/RadioRangeCommentBallot.php index bcfe6a1..8949b8e 100644 --- a/includes/ballots/RadioRangeCommentBallot.php +++ b/includes/ballots/RadioRangeCommentBallot.php @@ -55,10 +55,10 @@ foreach ( $this->election->getQuestions() as $question ) { $questions[$question->getId()] = $question; } - for ( $offset = 0; $offset < strlen( $record ); $offset += $itemLength ) { + for ( $offset = 0, $len = strlen( $record ); $offset < $len; $offset += $itemLength ) { if ( !preg_match( '/Q([0-9A-F]{8})-A([0-9A-F]{8})-S([+-][0-9]{10})--/A', - $record, $m, 0, $offset ) ) - { + $record, $m, 0, $offset ) + ) { // Allow comments if ( $record[$offset] == '/' ) { break; diff --git a/includes/pages/CreatePage.php b/includes/pages/CreatePage.php index ac07a7b..d7b638c 100644 --- a/includes/pages/CreatePage.php +++ b/includes/pages/CreatePage.php @@ -358,7 +358,7 @@ ); } - $form = HTMLForm::factory('div', $formItems, $this->specialPage->getContext(), + $form = HTMLForm::factory( 'div', $formItems, $this->specialPage->getContext(), $this->election ? 'securepoll-edit' : 'securepoll-create' ); diff --git a/includes/pages/EntryPage.php b/includes/pages/EntryPage.php index 7c8f29c..02f8224 100644 --- a/includes/pages/EntryPage.php +++ b/includes/pages/EntryPage.php @@ -137,7 +137,7 @@ public function formatRow( $row ) { $id = $row->el_entity; $this->election = $this->entryPage->context->getElection( $id ); - if( !$this->election ) { + if ( !$this->election ) { $this->isAdmin = false; } else { $this->isAdmin = $this->election->isAdmin( $this->getUser() ); @@ -159,7 +159,7 @@ if ( $s !== '' ) { $s .= $sep; } - if( ( $this->isAdmin || $props['public'] ) + if ( ( $this->isAdmin || $props['public'] ) && ( !$this->election->isStarted() || $props['visible-after-start'] ) && ( !$this->election->isFinished() || $props['visible-after-close'] ) ) { diff --git a/includes/pages/ListPage.php b/includes/pages/ListPage.php index 1241897..742562f 100644 --- a/includes/pages/ListPage.php +++ b/includes/pages/ListPage.php @@ -78,12 +78,12 @@ ); $struck_votes = $res->result->num_rows; - $out->addHTML('<div id="mw-poll-stats"><p>' . - $this->msg( 'securepoll-voter-stats')->numParams( $distinct_voters ) . + $out->addHTML( '<div id="mw-poll-stats"><p>' . + $this->msg( 'securepoll-voter-stats' )->numParams( $distinct_voters ) . '</p><p>' . - $this->msg( 'securepoll-vote-stats') + $this->msg( 'securepoll-vote-stats' ) ->numParams( $all_votes, $not_current_votes, $struck_votes ) . - '</p></div>'); + '</p></div>' ); $pager = new SecurePoll_ListPager( $this ); $out->addHTML( @@ -129,7 +129,6 @@ ); } } - /** * The strike/unstrike backend. diff --git a/includes/pages/VotePage.php b/includes/pages/VotePage.php index b1c01ac..eb0a4dd 100644 --- a/includes/pages/VotePage.php +++ b/includes/pages/VotePage.php @@ -50,16 +50,16 @@ if ( !$this->election->isStarted() ) { $out->addWikiMsg( 'securepoll-not-started', - $language->timeanddate( $this->election->getStartDate() ) , - $language->date( $this->election->getStartDate() ) , + $language->timeanddate( $this->election->getStartDate() ), + $language->date( $this->election->getStartDate() ), $language->time( $this->election->getStartDate() ) ); return; } if ( $this->election->isFinished() ) { $out->addWikiMsg( 'securepoll-finished', - $language->timeanddate( $this->election->getEndDate() ) , - $language->date( $this->election->getEndDate() ) , + $language->timeanddate( $this->election->getEndDate() ), + $language->date( $this->election->getEndDate() ), $language->time( $this->election->getEndDate() ) ); return; } diff --git a/includes/pages/VoterEligibilityPage.php b/includes/pages/VoterEligibilityPage.php index 7eb25b3..b06b152 100644 --- a/includes/pages/VoterEligibilityPage.php +++ b/includes/pages/VoterEligibilityPage.php @@ -328,7 +328,7 @@ $title = Title::makeTitle( NS_SECUREPOLL, $list ); $wp = WikiPage::factory( $title ); $wp->doEditContent( - $x=ContentHandler::makeContent( $json, $title, 'SecurePoll' ), $comment + $x = ContentHandler::makeContent( $json, $title, 'SecurePoll' ), $comment ); } } @@ -787,7 +787,6 @@ return; } } - $this->specialPage->getOutput()->addModules( 'ext.securepoll' ); diff --git a/includes/talliers/CommentDumper.php b/includes/talliers/CommentDumper.php index 32484ae..3f677e4 100644 --- a/includes/talliers/CommentDumper.php +++ b/includes/talliers/CommentDumper.php @@ -43,7 +43,7 @@ $scores = $this->ballot->unpackRecord( $record ); $comments = $scores['comment']; - unset($scores['comment']); + unset( $scores['comment'] ); // Short circuit if the comments are empty if ( $this->skipEmptyComments && diff --git a/includes/talliers/SchulzeTallier.php b/includes/talliers/SchulzeTallier.php index 361bcbf..bd46625 100644 --- a/includes/talliers/SchulzeTallier.php +++ b/includes/talliers/SchulzeTallier.php @@ -16,7 +16,6 @@ # This algorithm follows Markus Schulze, "A New Monotonic, Clone-Independent, Reversal # Symmetric, and Condorcet-Consistent Single-Winner Election Method" and also # http://en.wikipedia.org/w/index.php?title=User:MarkusSchulze/Statutory_Rules&oldid=303036893 - # # Path strengths in the Schulze method are given by pairs of integers notated (a, b) # where a is the strength in one direction and b is the strength in the other. We make # a matrix of path strength pairs "p", giving the path strength of the row index beating diff --git a/includes/talliers/Tallier.php b/includes/talliers/Tallier.php index ec4ad30..c53eeb5 100644 --- a/includes/talliers/Tallier.php +++ b/includes/talliers/Tallier.php @@ -125,6 +125,3 @@ return $s; } } - - - -- To view, visit https://gerrit.wikimedia.org/r/358065 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I59a78a920ad911ccbfcd322863683b2d8b5e4134 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/SecurePoll Gerrit-Branch: master Gerrit-Owner: Umherirrender <umherirrender_de...@web.de> Gerrit-Reviewer: Huji <huji.h...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits