Showing 994 of 1,238 total issues
Function drawLegendBox
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var drawLegendBox = function(x, y, legendItem) {
if (isNaN(boxWidth) || boxWidth <= 0) {
return;
}
Method isSourcePage
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function isSourcePage( PageIdentity $page ): bool {
if ( !$page->exists() ) {
// No point in loading all translatable pages if the page
// doesn’t exist. This also avoids PreconditionExceptions
// if $page is a Title pointing to a non-proper page like
Method getDocumentationBox
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function getDocumentationBox(): string {
global $wgTranslateDocumentationLanguageCode;
if ( !$wgTranslateDocumentationLanguageCode ) {
throw new TranslationHelperException( 'Message documentation language code is not defined' );
Method execute
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute( $parameters ) {
$out = $this->getOutput();
$out->addModuleStyles( [
'ext.translate.special.translate.styles',
'jquery.uls.grid',
Method onMovePageTranslationUnits
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function onMovePageTranslationUnits(
LinkTarget $oldLinkTarget,
LinkTarget $newLinkTarget,
UserIdentity $userIdentity,
int $oldid,
Method doReview
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function doReview( User $user, RevisionRecord $revRecord ): bool {
$dbw = $this->loadBalancer->getConnection( DB_PRIMARY );
$dbw->newInsertQueryBuilder()
->insertInto( 'translate_reviews' )
->ignore()
Method __construct
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function __construct() {
parent::__construct();
$this->addDescription( 'Creates a dump file that can be imported to a TtmServer' );
$this->addOption(
Method formatWebSuggestions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function formatWebSuggestions( array $queryData ): array {
$service = $queryData['service'];
$response = $queryData['response'];
$sourceLanguage = $queryData['language'];
$sourceText = $queryData['text'];
Method query
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function query( string $sourceLanguage, string $targetLanguage, string $text ): array {
// Calculate the bounds of the string length which are able
// to satisfy the cutoff percentage in edit distance.
$len = mb_strlen( $text );
$min = ceil( max( $len * $this->config['cutoff'], 2 ) );
Method getHopefullyValidConfigurations
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getHopefullyValidConfigurations( string $data, ?callable $callback = null ): array {
if ( !is_callable( $callback ) ) {
$callback = static function ( $unused1, $unused2, $unused3 ) {
/*noop*/
};
Method getGroupErrorInfo
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getGroupErrorInfo( string $groupId ): GroupSynchronizationResponse {
$groupMessageErrorTag = $this->getGroupMessageErrorTag( $groupId );
$groupMessageEntries = $this->cache->getByTag( $groupMessageErrorTag );
$groupErrorKey = $this->getGroupErrorKey( $groupId );
Method languageCloud
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function languageCloud(): array {
$cacheKey = $this->cache->makeKey( 'translate-supportedlanguages-language-cloud', 'v2' );
$data = $this->cache->get( $cacheKey );
if ( is_array( $data ) ) {
Method execute
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute() {
$params = $this->extractRequestParams();
$target = $this->validateTargetParamater( $params );
$cache = $this->loadStatistics( $target, MessageGroupStats::FLAG_CACHE_ONLY );
Method getLanguagesFromHeader
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function getLanguagesFromHeader( array $csvHeader ): Status {
if ( count( $csvHeader ) < 2 ) {
return Status::newFatal(
'CSV has < 2 columns. Assuming that there are no languages to import'
);
Method getAllowedParams
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function getAllowedParams(): array {
return [
'do' => [
ParamValidator::PARAM_TYPE => [ 'associate', 'dissociate', 'remove', 'add', 'update' ],
ParamValidator::PARAM_REQUIRED => true,
Method __construct
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function __construct() {
parent::__construct();
$this->addDescription( 'Import translations for a CSV file' );
$this->addArg(
Method fixMessageParams
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function fixMessageParams( IContextSource $context, array $params ): array {
$out = [];
$lang = $context->getLanguage();
foreach ( $params as $param ) {
Method pluralFormsCheck
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function pluralFormsCheck(
Message $message, string $code, ValidationIssues $issues
): void {
$translation = $message->translation();
// Are there any plural forms for this language in this message?
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
MessageIndexStore $store,
WANObjectCache $statusCache,
JobQueueGroup $jobQueueGroup,
HookRunner $hookRunner,
LoggerInterface $logger,
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
MovePageFactory $movePageFactory,
JobQueueGroup $jobQueue,
LinkBatchFactory $linkBatchFactory,
TranslatableBundleFactory $bundleFactory,
SubpageListBuilder $subpageBuilder,