Showing 7,504 of 7,504 total issues
Function array_unique
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function array_unique($array)
{
if (version_compare(PHP_VERSION, '5.2', '>='))
{
return array_unique($array);
- 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 compatible_gzinflate
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function compatible_gzinflate($gzData) {
// Compressed data might contain a full header, if so strip it for gzinflate()
if ( substr($gzData, 0, 3) == "\x1f\x8b\x08" ) {
$i = 10;
- 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 CreateBody
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function CreateBody() {
$result = '';
if ($this->sign_key_file) {
$result .= $this->GetMailMIME();
}
- 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 transform
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Image.transform = function (file, transform, autoOrientation, fn){
function _transform(err, img){
// img -- info object
var
images = {}
Function _ExceptionDetails
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
var _ExceptionDetails = (function (_super) {
__extends(_ExceptionDetails, _super);
function _ExceptionDetails(exception) {
_super.call(this);
this.aiDataContract = {
Function hotelController
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
var hotelController = function ($http, $q, $location, dataService) {
var url = $location.absUrl();
var lastSlash = url.lastIndexOf('/');
var year = url.slice(lastSlash + 1);
Function renderIframeUI
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function renderIframeUI(args) {
var panel, resizeHandleCtrl, startSize;
if (args.skinUiCss) {
tinymce.DOM.loadCSS(args.skinUiCss);
Function filterStyles
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function filterStyles(node, styleValue) {
var outputStyles = {}, styles = editor.dom.parseStyle(styleValue);
// Parse out list indent level for lists
if (node.name === 'p') {
Function edInsertTag
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function edInsertTag(myField, i) {
//IE support
if (document.selection) {
myField.focus();
var sel = document.selection.createRange();
Method wp_write_post
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wp_write_post() {
global $user_ID;
if ( 'page' == $_POST['post_type'] ) {
if ( !current_user_can( 'edit_pages' ) )
Method prepare_items
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function prepare_items() {
global $status, $totals, $page, $orderby, $order, $s;
wp_reset_vars( array( 'orderby', 'order', 's' ) );
Method user_can_access_admin_page
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function user_can_access_admin_page() {
global $pagenow;
global $menu;
global $submenu;
global $_wp_menu_nopriv;
Method kubrick_add_theme_page
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function kubrick_add_theme_page() {
if ( isset( $_GET['page'] ) && $_GET['page'] == basename(__FILE__) ) {
if ( isset( $_REQUEST['action'] ) && 'save' == $_REQUEST['action'] ) {
check_admin_referer('kubrick-header');
if ( isset($_REQUEST['njform']) ) {
Method kubrick_theme_page
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function kubrick_theme_page() {
if ( isset( $_REQUEST['saved'] ) ) echo '<div id="message" class="updated fade"><p><strong>'.__('Options saved.').'</strong></p></div>';
?>
<div class='wrap'>
<h2><?php _e('Customize Header'); ?></h2>
Method wp_delete_attachment
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wp_delete_attachment( $post_id, $force_delete = false ) {
global $wpdb;
if ( !$post = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $post_id) ) )
return $post;
Method wp_explain_nonce
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wp_explain_nonce( $action ) {
if ( $action !== -1 && preg_match( '/([a-z]+)-([a-z]+)(_(.+))?/', $action, $matches ) ) {
$verb = $matches[1];
$noun = $matches[2];
Identical blocks of code found in 2 locations. Consider refactoring. Open
ed.dom.setAttribs(e, {
href : f.href.value,
title : f.linktitle.value,
target : f.target_list ? getSelectValue(f, "target_list") : null,
'class' : f.class_list ? getSelectValue(f, "class_list") : null
- 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 83.
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
ed.dom.setAttribs(e, {
href : f.href.value,
title : f.linktitle.value,
target : f.target_list ? getSelectValue(f, "target_list") : null,
'class' : f.class_list ? getSelectValue(f, "class_list") : null
- 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 83.
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
TelemetryContext.prototype._applySampleContext = function (envelope, sampleContext) {
if (sampleContext) {
var tagKeys = new AI.ContextTagKeys();
if (typeof sampleContext.sampleRate === "string") {
envelope.tags[tagKeys.sampleRate] = sampleContext.sampleRate;
- 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 83.
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
ed.addCommand('JustifyRight', function() {
var n = ed.selection.getNode();
if ( n.nodeName != 'IMG' )
ed.editorCommands.mceJustify('JustifyRight', 'right');
- 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 83.
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