Showing 994 of 1,238 total issues
Function checkInput
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function checkInput(): Status {
$status = Status::newGood();
$msgGroup = MessageGroups::getGroup( $this->groupId );
if ( $msgGroup === null ) {
- 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 run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function run(): bool {
$lb = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
if ( !$lb->waitForReplication() ) {
$this->logWarning( 'Continuing despite replication lag' );
}
- 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 doAction
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function doAction(
string $action,
MessageGroup $group,
string $key,
string $message
- 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 getSubgroups
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getSubgroups( string $groupId ): ?array {
$groups = $this->get( $groupId, 'subgroups' );
if ( is_string( $groups ) ) {
if ( str_contains( $groups, '|' ) ) {
$groups = explode( '|', $groups );
- 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 execute
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$mwServices = MediaWikiServices::getInstance();
$config = $mwServices->getMainConfig();
if ( !$config->get( 'TranslateGroupSynchronizationCache' ) ) {
- 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 execute
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$name = $this->getOption( 'name', MessageChangeStorage::DEFAULT_NAME );
if ( !MessageChangeStorage::isValidCdbName( $name ) ) {
$this->fatalError( 'Invalid 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 getMappedAggregateGroupIds
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function getMappedAggregateGroupIds(): array {
$groupStructure = MessageGroups::getGroupStructure();
// Flatten the group structure for easy indexing
$groupIdAggregateMapped = [];
foreach ( $groupStructure as $groupId => $mappedGroups ) {
- 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 execute
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$ignoreTrailingWhitespace = $this->getOption( 'ignore-trailing-whitespace' );
$groups = $this->getGroups( $this->getArg( 0 ) );
$matched = count( $groups );
$this->output( "Pattern matched $matched file based message group(s).\n" );
- 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 getNewState
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function getNewState( array $stats, array $transitions ) {
foreach ( $transitions as [ $newState, $conditions ] ) {
$match = true;
foreach ( $conditions as $type => $typeConditions ) {
- 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 getGroupsById
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function getGroupsById( array $ids, bool $skipMeta = false ): array {
$groups = [];
foreach ( $ids as $id ) {
$group = self::getGroup( $id );
- 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 expandWildcards
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function expandWildcards( $ids ): array {
$all = [];
$ids = (array)$ids;
foreach ( $ids as $index => $id ) {
- 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 listSubgroups
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function listSubgroups( string $groupId, array $subGroupIds ): string {
$id = $this->htmlIdForGroup( $groupId, 'mw-tpa-grouplist-' );
$out = Html::openElement( 'ol', [ 'id' => $id ] );
// Get the respective groups and sort them
- 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 writeReal
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function writeReal( MessageCollection $collection ): string {
$header = $this->doHeader( $collection );
$header .= $this->doAuthors( $collection );
$header .= "\n";
- 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 readRow
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function readRow( string $line, string $sep ): array {
if ( !str_contains( $line, '\\' ) ) {
/* Nothing appears to be escaped in this line.
* Just read the key and the value. */
[ $key, $value ] = explode( $sep, $line, 2 );
- 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 write
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function write( MessageCollection $collection ): void {
$writePath = $this->writePath;
if ( $writePath === null ) {
throw new LogicException( 'Write path is not set. Set write path before calling write()' );
- 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 getDefinitions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getDefinitions() {
if ( !$this->language ) {
throw new BadMethodCallException( 'Language not set' );
}
- 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 getDimensions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getDimensions( elem ) {
var raw = elem[ 0 ];
if ( raw.nodeType === 9 ) {
return {
width: elem.width(),
Function hcg
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
convert.rgb.hcg = function (rgb) {
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
var max = Math.max(Math.max(r, g), b);
Function saveHandler
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function saveHandler() {
var list = [];
$( '.mw-tpm-sp-error__message' ).addClass( 'hide' );
if ( noOfSourceUnits < noOfTranslationUnits ) {
Function draw
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
draw: function() {
var ctx = this._chart.ctx;
var vm = this._view;
if (vm.opacity === 0) {