Showing 194 of 194 total issues
Function S2
has 4921 lines of code (exceeds 25 allowed). Consider refactoring. Open
var S2 =(function () {
// Restore the Select2 AMD loader so it can be used
// Needed mostly in the language files, where the loader is not inserted
if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
var S2 = jQuery.fn.select2.amd;
File selectWoo.full.js
has 4948 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* SelectWoo 1.0.1
* https://github.com/woocommerce/selectWoo
*
* Released under the MIT license
Similar blocks of code found in 2 locations. Consider refactoring. Open
<?php
/**
* Super_Awesome_Theme_Bottom_Bar class
*
* @package Super_Awesome_Theme
- 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 1189.
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
<?php
/**
* Super_Awesome_Theme_Top_Bar class
*
* @package Super_Awesome_Theme
- 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 1189.
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
File class-colors.php
has 626 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Super_Awesome_Theme_Colors class
*
* @package Super_Awesome_Theme
Function apply
has 191 lines of code (exceeds 25 allowed). Consider refactoring. Open
Defaults.prototype.apply = function (options) {
options = $.extend(true, {}, this.defaults, options);
if (options.dataAdapter == null) {
if (options.ajax != null) {
Function bind
has 166 lines of code (exceeds 25 allowed). Consider refactoring. Open
Results.prototype.bind = function (container, $container) {
var self = this;
var id = container.id + '-results';
Function get_for_post
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
public function get_for_post( $post = null ) {
$post = get_post( $post );
if ( ! $post ) {
return false;
}
- 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 print_base_color_style_general
has 134 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function print_base_color_style_general() {
$text_color = $this->get( 'text_color' );
$text_focus_color = $this->util()->darken_color( $text_color, 25 );
$text_light_color = $this->util()->lighten_color( $text_color, 100 );
$link_color = $this->get( 'link_color' );
Similar blocks of code found in 2 locations. Consider refactoring. Open
protected function support_side_navbar_toggle() {
$state_id = $this->args['state_id'];
$navbar = $this->dom->getElementById( 'site-navbar' );
if ( ! $navbar ) {
- 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 175.
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
protected function support_mobile_menu_toggle() {
$state_id = $this->args['state_id'];
$navigation = $this->dom->getElementById( 'site-navigation' );
if ( ! $navigation ) {
- 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 175.
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 register_default_families
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function register_default_families() {
$families = array(
// System fonts.
new Super_Awesome_Theme_Font_Family( 'system', array(
File class-content-types.php
has 330 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Super_Awesome_Theme_Content_Types class
*
* @package Super_Awesome_Theme
Function initializeFontFamilySelect
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
initializeFontFamilySelect: function( $element ) {
const selectData = {};
const includedData = {};
const excludedData = {};
const settingValue = this.setting.get();
File gulpfile.js
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* ---- THE FOLLOWING CONFIG SHOULD BE EDITED ---- */
const pkg = require( './package.json' );
const tags = [
Function initializeCommentForm
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
initializeCommentForm( commentForm, comments, statusDiv ) {
const options = this.options;
if ( ! commentForm ) {
return;
File class-fonts.php
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Super_Awesome_Theme_Fonts class
*
* @package Super_Awesome_Theme
Method render_form_field
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function render_form_field( $id, $args, $value ) {
$control_id = $this->get_field_id( $id );
$control_name = $this->get_field_name( $id );
$type = $args[ self::FIELD_ARG_TYPE ];
$title = $args[ self::FIELD_ARG_TITLE ];
Function calculate_content_image_sizes
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
protected function calculate_content_image_sizes( $sizes, $size ) {
$settings = $this->get_dependency( 'settings' );
$sidebar = $this->get_dependency( 'sidebar' );
$rem = 16;
- 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 initializeCommentForm
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
initializeCommentForm( commentForm, comments, statusDiv ) {
const options = this.options;
if ( ! commentForm ) {
return;
- 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"