Showing 994 of 1,238 total issues
Method __construct
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct( Title $source, Title $target ) {
$this->map[$source->getNamespace()] = [
$target->getNamespace(),
$source->getText(),
$target->getText(),
Method disallowLangTranslations
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function disallowLangTranslations(
Title $title,
User $user,
string $action,
&$result
Method doPairs
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function doPairs(): array {
if ( !isset( $this->config['key'] ) ) {
throw new TranslationWebServiceConfigurationException( 'key is not set' );
}
Method isExcluded
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function isExcluded( string $groupId, string $code ): bool {
if ( $this->priorityCache === null ) {
// TODO: Ideally, this should use the injected ILoadBalancer to make it mockable.
$db = Utilities::getSafeReadDB();
$res = $db->newSelectQueryBuilder()
Method flattenCLDRPlurals
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function flattenCLDRPlurals( array $messages ) {
$hasNonPluralKeys = false;
$pluralKeys = [];
foreach ( $messages as $key => $value ) {
if ( is_array( $value ) ) {
Method validate
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validate( Title $pageTitle, MessageBundleContent $content ): void {
$content->validate();
// Verify that the language code is valid
$metadata = $content->getMetadata();
$sourceLanguageCode = $metadata->getSourceLanguageCode();
Method execute
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$this->pageImportCount = 0;
$importFilePath = $this->getPathOfFileToImport();
$importUser = $this->getImportUser();
$comment = $this->getOption( 'comment' );
Method createQueryBuilder
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createQueryBuilder( IReadableDatabase $database, string $caller ): SelectQueryBuilder {
global $wgTranslateMessageNamespaces;
$fields = [ 'rc_timestamp' ];
Method getDefinitions
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDefinitions() {
if ( !$this->language ) {
throw new BadMethodCallException( 'Language not set' );
}
Method getIssues
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getIssues( Message $message, string $targetLanguage ): ValidationIssues {
$issues = new ValidationIssues();
preg_match_all( $this->validationRegex, $message->definition(), $definitionMatch );
preg_match_all( $this->validationRegex, $message->translation(), $translationMatch );
Function EntitySelectorWidget
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
var EntitySelectorWidget = function ( config ) {
// Parent constructor
OO.ui.TextInputWidget.call( this, {
classes: [ 'tes-entity-selector' ],
placeholder: mw.msg( 'translate-tes-type-to-search' ),
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function actionLinks
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function actionLinks( array $page, string $type ): string {
// Performance optimization to avoid calling $this->msg in a loop
static $messageCache = null;
if ( $messageCache === null ) {
$messageCache = [
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getTextForRendering
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getTextForRendering(
?Message $msg,
Language $sourceLanguage,
Language $targetLanguage,
bool $wrapUntranslated,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function sourcePageHeader
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function sourcePageHeader( IContextSource $context ) {
$linker = MediaWikiServices::getInstance()->getLinkRenderer();
$language = $context->getLanguage();
$title = $context->getTitle();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function tabify
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function tabify( Skin $skin, array &$tabs ): bool {
$title = $skin->getTitle();
if ( !$title->isSpecialPage() ) {
return true;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function checkAndAdd
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function checkAndAdd( array &$hugeArray, MessageGroup $g, bool $ignore = false ): void {
$keys = $g->getKeys();
$id = $g->getId();
$namespace = $g->getNamespace();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function processGroups
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function processGroups( array $groups ): array {
$fixedGroups = [];
foreach ( $groups as $g ) {
$name = $g['name'];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getTargetLanguage
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function getTargetLanguage(): Language {
$ui = $this->getLanguage();
$source = $this->getSourceLanguage();
if ( !$ui->equals( $source ) ) {
return $ui;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method __construct
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
UserFactory $userFactory,
IConnectionProvider $dbProvider,
PermissionManager $permissionManager,
AuthManager $authManager,
UserGroupManager $userGroupManager,
Function doQuery
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function doQuery( string $sourceLanguage, string $targetLanguage, string $text ): array {
if ( !$this->useWikimediaExtraPlugin() ) {
// ElasticTTM is currently not compatible with elasticsearch 2.x/5.x
// It needs FuzzyLikeThis ported via the wmf extra plugin
throw new RuntimeException( 'The wikimedia extra plugin is mandatory.' );
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"