Showing 644 of 644 total issues
Method __construct
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct( $config_id = 'global', $args = [] ) {
// In case the user only provides 1 argument,
// assume that the provided argument is $args and set $config_id = 'global'.
if ( is_array( $config_id ) && empty( $args ) ) {
- Create a ticketCreate a ticket
Method rgb_to_hsv
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function rgb_to_hsv( $color = array() ) {
$var_r = ( $color[0] / 255 );
$var_g = ( $color[1] / 255 );
$var_b = ( $color[2] / 255 );
$var_min = min( $var_r, $var_g, $var_b );
- Create a ticketCreate a ticket
Method get_value
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function get_value( $config_id = '', $field_id = '' ) {
// Make sure value is defined.
$value = '';
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
(hooks.__current || []).forEach(function (hookInfo) {
if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
hookInfo.currentIndex--;
}
});
- Read upRead up
- Create a ticketCreate a ticket
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 61.
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
(hooks.__current || []).forEach(function (hookInfo) {
if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
hookInfo.currentIndex++;
}
});
- Read upRead up
- Create a ticketCreate a ticket
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 61.
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
Function checkCondition
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
checkCondition: function( requirement, control, isOption, relation ) {
var self = this,
childRelation = ( 'AND' === relation ) ? 'OR' : 'AND',
nestedItems,
value,
- Create a ticketCreate a ticket
Function 226
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
},{"36":36,"44":44,"75":75}],226:[function(_dereq_,module,exports){
'use strict';
var anObject = _dereq_(16);
var toLength = _dereq_(117);
- Create a ticketCreate a ticket
Function 137
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
},{"104":104,"20":20,"40":40}],137:[function(_dereq_,module,exports){
'use strict';
var ctx = _dereq_(32);
var $export = _dereq_(40);
var toObject = _dereq_(118);
- Create a ticketCreate a ticket
Function 74
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
},{"118":118,"42":42,"53":53,"80":80,"83":83,"84":84}],74:[function(_dereq_,module,exports){
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var anObject = _dereq_(16);
var dPs = _dereq_(76);
var enumBugKeys = _dereq_(38);
- Create a ticketCreate a ticket
Method render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function render() {
$id = 'customize-control-' . str_replace( [ '[', ']' ], [ '-', '' ], $this->id );
$class = 'customize-control customize-control-kirki customize-control-' . $this->type;
$gap = isset( $this->wrapper_opts['gap'] ) ? $this->wrapper_opts['gap'] : 'default';
- Create a ticketCreate a ticket
Function 82
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
},{"101":101,"118":118,"47":47}],82:[function(_dereq_,module,exports){
var has = _dereq_(47);
var toIObject = _dereq_(116);
var arrayIndexOf = _dereq_(19)(false);
var IE_PROTO = _dereq_(101)('IE_PROTO');
- Read upRead up
- Create a ticketCreate a ticket
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 98
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
},{}],98:[function(_dereq_,module,exports){
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
var isObject = _dereq_(57);
var anObject = _dereq_(16);
- Read upRead up
- Create a ticketCreate a ticket
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 77
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
},{"16":16,"36":36,"75":75,"83":83}],77:[function(_dereq_,module,exports){
var pIE = _dereq_(84);
var createDesc = _dereq_(92);
var toIObject = _dereq_(116);
var toPrimitive = _dereq_(119);
- Read upRead up
- Create a ticketCreate a ticket
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 row_label
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function row_label( $args ) {
// Validating args for row labels.
if ( isset( $args['row_label'] ) && is_array( $args['row_label'] ) && ! empty( $args['row_label'] ) ) {
- Read upRead up
- Create a ticketCreate a ticket
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 getLoader
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
- Read upRead up
- Create a ticketCreate a ticket
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 css_dimension
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function css_dimension( $value ) {
// Trim it.
$value = trim( $value );
- Read upRead up
- Create a ticketCreate a ticket
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 filter_setting_args
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function filter_setting_args( $args, $wp_customize ) {
if ( $args['settings'] === $this->args['settings'] ) {
$args = parent::filter_setting_args( $args, $wp_customize );
// Set the sanitize-callback if none is defined.
- Read upRead up
- Create a ticketCreate a ticket
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
} else if (3 === val.length || 6 === val.length) {
if (!val.includes("#") && !val.includes("rg") && !val.includes("hs")) {
val = "#" + val;
}
}
- Read upRead up
- Create a ticketCreate a ticket
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 60.
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
Function process_output
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function process_output( $output, $value ) {
foreach ( $value as $key => $sub_value ) {
// If "element" is not defined, there's no reason to continue.
if ( ! isset( $output['element'] ) ) {
- Read upRead up
- Create a ticketCreate a ticket
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 render
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function render() {
$id = 'customize-control-' . str_replace( [ '[', ']' ], [ '-', '' ], $this->id );
$class = 'customize-control customize-control-kirki customize-control-' . $this->type;
$gap = isset( $this->wrapper_opts['gap'] ) ? $this->wrapper_opts['gap'] : 'default';
- Read upRead up
- Create a ticketCreate a ticket
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"