Showing 11,545 of 11,545 total issues
File jquery.ui.autocomplete.js
has 463 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* jQuery UI Autocomplete 1.9.2
* http://jqueryui.com
*
* Copyright 2012 jQuery Foundation and other contributors
File mustache.js
has 462 lines of code (exceeds 250 allowed). Consider refactoring. Open
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.Mustache = factory());
}(this, (function () { 'use strict';
File BlockLevelPass.php
has 462 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* This is the part of the wikitext parser which handles automatic paragraphs
* and conversion of start-of-line prefixes to HTML lists.
Function conditionParse
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
function conditionParse( $root, spec ) {
let v, fields, func;
const op = spec[ 0 ];
let l = spec.length;
- 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 46 (exceeds 5 allowed). Consider refactoring. Open
private function run( $resultPageSet = null ) {
$params = $this->extractRequestParams();
// Extract parameters
$query = $params['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 processDbResults
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
private function processDbResults( $res, $page, $params ) {
$revisions = [];
if ( $res ) {
$sizes = [];
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (nodeName == 'input') {
target.disabled = false;
inst.trigger.filter('button').
each(function() { this.disabled = false; }).end().
filter('img').css({opacity: '1.0', cursor: ''});
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 176.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (nodeName == 'input') {
target.disabled = true;
inst.trigger.filter('button').
each(function() { this.disabled = true; }).end().
filter('img').css({opacity: '0.5', cursor: 'default'});
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 176.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method showRevision
has 176 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function showRevision( $timestamp ) {
if ( !preg_match( '/[0-9]{14}/', $timestamp ) ) {
return;
}
$out = $this->getOutput();
File MaintenanceRunner.php
has 460 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace MediaWiki\Maintenance;
use Exception;
File checkStorage.php
has 460 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Fsck for MediaWiki
*
* This program is free software; you can redistribute it and/or modify
Session
has 50 functions (exceeds 20 allowed). Consider refactoring. Open
class Session implements \Countable, \Iterator, \ArrayAccess {
/** @var null|string[] Encryption algorithm to use */
private static $encryptionAlgorithm = null;
/** @var SessionBackend Session backend */
Method find_middle_snake
has 174 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function find_middle_snake( $bottoml1, $topl1, $bottoml2, $topl2, &$V, &$snake ) {
$from = &$this->from;
$to = &$this->to;
$V0 = &$V[0];
$V1 = &$V[1];
Method parse
has 174 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function parse( $rawData ) {
$parsed = iptcparse( $rawData );
$data = [];
if ( !is_array( $parsed ) ) {
return $data;
File XmlDumpWriter.php
has 456 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* XmlDumpWriter
*
* Copyright © 2003, 2005, 2006 Brooke Vibber <bvibber@wikimedia.org>
File URL.js
has 455 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* global Symbol */
// URL Polyfill
// Draft specification: https://url.spec.whatwg.org
// Notes:
Method doGuessMimeType
has 173 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function doGuessMimeType( string $file ) {
// Read a chunk of the file
AtEase::suppressWarnings();
$f = fopen( $file, 'rb' );
AtEase::restoreWarnings();
Method getDefaultText
has 173 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getDefaultText() {
if ( !$this->values['wgImageMagickConvertCommand'] ) {
$this->values['wgImageMagickConvertCommand'] = '/usr/bin/convert';
$magic = '#';
} else {
Function getInclusiveMetrics
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
public function getInclusiveMetrics() {
if ( $this->inclusive === null ) {
$main = $this->hieraData['main()'];
$hasCpu = isset( $main['cpu'] );
$hasMu = isset( $main['mu'] );
- 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 recentChangesBlockGroup
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
protected function recentChangesBlockGroup( $block ) {
$recentChangesFlags = $this->getConfig()->get( MainConfigNames::RecentChangesFlags );
# Add the namespace and title of the block as part of the class
$tableClasses = [ 'mw-enhanced-rc', 'mw-changeslist-line' ];
- 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"