Showing 28 of 34 total issues
Function initLanguageSelector
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initLanguageSelector() {
$form.find( '.signup-language-selector' ).uls( {
onSelect: function ( language ) {
var $checkbox = $form.find( 'input[name="signuplanguage"][value="' + language + '"]' );
if ( $checkbox.length ) {
Method getStatsTiles
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getStatsTiles( $stats ): array {
return [
// Rows X cols
[
[
Method getSandboxRows
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getSandboxRows(): string {
global $wgTranslateSandboxLimit;
$count = count( $this->translationStashReader->getTranslations( $this->getUser() ) );
Function exports
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function ( grunt ) {
'use strict';
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
Function getCategoryFilter
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function getCategoryFilter( array $args ): ?string {
foreach ( $args as $arg ) {
if ( trim( $arg ) === '' ) {
continue;
}
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct( $key, $staleAge, $expiredAge, $worker, $onMiss = 'update' ) {
Function getStyles
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getStyles( Context $context ) {
$out = '';
foreach ( $this->getData() as $key => $value ) {
if ( !isset( $value['raster'] ) ) {
continue;
- 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 getProjects
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getProjects() {
$projects = [];
$cache = ObjectCache::getInstance( CACHE_ANYTHING );
$cacheKey = $cache->makeKey( __METHOD__ );
- 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"