Showing 11,498 of 11,498 total issues
Method handleInternalLinks2
has 267 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function handleInternalLinks2( &$s ) {
static $tc = false, $e1, $e1_img;
# the % is needed to support urlencoded titles as well
if ( !$tc ) {
$tc = Title::legalChars() . '#%';
Function execute
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
public function execute( $par ) {
$this->setHeaders();
$this->outputHeader();
$config = $this->getConfig();
- 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
LocalFile
has 71 functions (exceeds 20 allowed). Consider refactoring. Open
class LocalFile extends File {
private const VERSION = 13; // cache version
private const CACHE_FIELD_MAX_LEN = 1000;
File ApiQueryImageInfo.php
has 604 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
*
* This program is free software; you can redistribute it and/or modify
Function deflate$1
has 261 lines of code (exceeds 25 allowed). Consider refactoring. Open
const deflate$1 = (strm, flush) => {
if (deflateStateCheck(strm) || flush > Z_BLOCK || flush < 0) {
return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;
}
Method showHistory
has 261 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function showHistory() {
$this->checkReadOnly();
$out = $this->getOutput();
if ( $this->mAllowed ) {
File ChangeTags.php
has 601 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Recent changes tagging.
*
* This program is free software; you can redistribute it and/or modify
Function execute
has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring. Open
public function execute( $par ) {
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
// Modules required for viewing the list of contributions (also when included on other pages)
- 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 66 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
// Cache may vary on the user because ParserOptions gets data from it
$this->getMain()->setCacheMode( 'anon-public-user-private' );
// Get parameters
- 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 showDiffPage
has 260 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function showDiffPage( $diffOnly = false ) {
# Allow frames except in certain special cases
$out = $this->getOutput();
$out->setPreventClickjacking( false );
$out->setRobotPolicy( 'noindex,nofollow' );
File recompressTracked.php
has 600 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Moves blobs indexed by trackBlobs.php to a specified list of destination
* clusters, and recompresses them in the process.
*
File Preprocessor_Hash.php
has 599 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Preprocessor using PHP arrays
*
* This program is free software; you can redistribute it and/or modify
Function ajax
has 259 lines of code (exceeds 25 allowed). Consider refactoring. Open
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
Identical blocks of code found in 2 locations. Consider refactoring. Open
protected function loadMetadataFromString( $metadataString ) {
$this->extraDataLoaded = true;
$this->metadataArray = [];
$this->metadataBlobs = [];
$this->unloadedMetadataBlobs = [];
- 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 294.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
protected function loadMetadataFromString( $metadataString ) {
$this->extraDataLoaded = true;
$this->metadataArray = [];
$this->metadataBlobs = [];
$this->unloadedMetadataBlobs = [];
- 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 294.
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
ResourceLoader
has 70 functions (exceeds 20 allowed). Consider refactoring. Open
class ResourceLoader implements LoggerAwareInterface {
/** @var int */
public const CACHE_VERSION = 9;
/** @var string JavaScript / CSS pragma to disable minification. * */
public const FILTER_NOMIN = '/*@nomin*/';
SpecialPage
has 70 functions (exceeds 20 allowed). Consider refactoring. Open
class SpecialPage implements MessageLocalizer {
/**
* @var string The canonical name of this special page
* Also used as the message key for the default <h1> heading,
* @see getDescription()
File DatabaseSqlite.php
has 593 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
File Html.php
has 593 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Collection of methods to generate HTML content
*
* Copyright © 2009 Aryeh Gregor
File LogFormatter.php
has 593 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Contains a class for formatting log entries
*
* This program is free software; you can redistribute it and/or modify