Showing 194 of 194 total issues
Method render_comment
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render_comment( $comment = null, $args = array(), $depth = 0, $close = false ) {
$reset_global_comment = false;
if ( ! isset( $GLOBALS['comment'] ) ) {
if ( null === $comment ) {
Function checkStickyContainers
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
checkStickyContainers() {
const pageWrap = this.pageWrap;
const topOffsets = this.stickToTopOffsets;
const bottomOffsets = this.stickToBottomOffsets;
Method register_main_assets
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function register_main_assets() {
$this->register_asset( new Super_Awesome_Theme_Script(
'wp-i18n',
get_theme_file_uri( '/assets/dist/js/wp-i18n.js' ),
array(
Similar blocks of code found in 2 locations. Consider refactoring. Open
protected function default_parsing_callback( $value ) {
$value = (array) $value;
foreach ( $this->properties_settings as $setting ) {
$id = $setting->get_prop( Super_Awesome_Theme_Setting::PROP_ID );
- 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 111.
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 default_sanitization_callback( $value ) {
$value = (array) $value;
foreach ( $this->properties_settings as $setting ) {
$id = $setting->get_prop( Super_Awesome_Theme_Setting::PROP_ID );
- 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 111.
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 addRemoveStickyContainer
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
addRemoveStickyContainer( selector, location, remove ) {
const container = document.querySelector( selector );
let selectorsHandle, containersHandle, offsetsHandle, exists;
if ( 'top' === location ) {
selectorsHandle = 'stickToTopSelectors';
Method default_sanitize_callback
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function default_sanitize_callback( $value, $args ) {
switch ( $args[ self::FIELD_ARG_TYPE ] ) {
case self::FIELD_TYPE_NUMBER:
if ( isset( $args[ self::FIELD_ARG_INPUT_ATTRS ]['step'] ) && is_int( $args[ self::FIELD_ARG_INPUT_ATTRS ]['step'] ) ) {
$value = (int) $value;
Method register_customize_partial
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function register_customize_partial( $customizer ) {
$partial_colors = array();
if ( ! empty( $this->groups ) ) {
$customizer->add_panel( 'colors', array(
Function ready
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
ready: function() {
const value = this.setting.get();
const $familySelect = this.container.find( '[data-setting-property="family"]' );
const $weightSelect = this.container.find( '[data-setting-property="weight"]' );
const $sizeInput = this.container.find( '[data-setting-property="size"]' );
Similar blocks of code found in 2 locations. Consider refactoring. Open
protected function register_settings() {
$settings = $this->get_dependency( 'settings' );
$settings->register_setting( new Super_Awesome_Theme_Enum_String_Setting(
'branding_location',
- 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 109.
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 register_settings() {
$settings = $this->get_dependency( 'settings' );
$settings->register_setting( new Super_Awesome_Theme_Enum_String_Setting(
'navbar_position',
- 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 109.
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 handle_ajax_comment
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function handle_ajax_comment( $id, $status ) {
if ( empty( $_GET['is_ajax'] ) || 'true' !== $_GET['is_ajax'] ) {
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"
Further reading
Function bind
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
SingleSelection.prototype.bind = function (container, $container) {
var self = this;
SingleSelection.__super__.bind.apply(this, arguments);
Method __construct
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct( $id, array $args = array() ) {
$this->id = (string) $id;
$defaults = $this->get_defaults();
foreach ( $defaults as $prop => $default_value ) {
Method __call
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __call( $method, $args ) {
switch ( $method ) {
case 'ensure_inline_widgets_whitelist':
case 'register_customize_controls':
case 'register_customize_controls_js':
Function wrapper
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wrapper (obj, child) {
var data = obj.results;
for (var i = 0; i < data.length; i++) {
var option = data[i];
Method render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function render( array $instance ) {
$login_url = '';
$login_label = '';
$register_url = '';
$register_label = '';
Function handleSubmission
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handleSubmission( e ) {
const formUrl = commentForm.getAttribute( 'action' ) + ( commentForm.getAttribute( 'action' ).indexOf( '?' ) > -1 ? '&' : '?' ) + 'is_ajax=true';
const fields = commentForm.querySelectorAll( 'input, textarea' );
let hasError = false;
Method register_settings
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function register_settings() {
$settings = $this->get_dependency( 'settings' );
$this->attachment_metadata = new Super_Awesome_Theme_Attachment_Metadata( $settings );
$boolean_settings = array();
Function item
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
SelectAdapter.prototype.item = function ($option) {
var data = {};
data = $.data($option[0], 'data');