Showing 503 of 503 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function __construct( $prefix, $services, $translations ) {
$this->class_name = Element_Choice::class;
$this->collection_class_name = Element_Choice_Collection::class;
$this->query_class_name = Element_Choice_Query::class;
$this->rest_controller_class_name = REST_Element_Choices_Controller::class;
- 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 226.
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 upgrade_legacy_form_meta
has 169 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function upgrade_legacy_form_meta( $form_id ) {
global $wpdb;
$prefix = $this->get_prefix();
Function map_capabilities
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
public function map_capabilities( $mode ) {
$this->capability_mappings = array();
if ( $mode ) {
$this->capability_mappings[ $this->meta_capabilities['edit_item'] ] = array( $this, 'map_edit_item' );
- 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
File members.php
has 446 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Members access control class
*
* @package TorroForms
File email-notifications.php
has 443 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Email notifications action class
*
* @package TorroForms
Method register_template_tag_handlers
has 161 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function register_template_tag_handlers() {
$tags = array(
'sitetitle' => array(
'group' => 'global',
'label' => __( 'Site Title', 'torro-forms' ),
Method setup_hooks
has 159 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function setup_hooks() {
parent::setup_hooks();
if ( method_exists( $this, 'register_rest_routes' ) ) {
$this->filters[] = array(
File torro-forms.php
has 419 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Plugin main class
*
* @package TorroForms
Identical blocks of code found in 2 locations. Consider refactoring. Open
public function validate_field( $value, $element, $submission ) {
$settings = $this->get_settings( $element );
$choices = $this->get_choices_for_field( $element );
$value = trim( (string) $value );
- 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 198.
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
public function validate_field( $value, $element, $submission ) {
$settings = $this->get_settings( $element );
$choices = $this->get_choices_for_field( $element );
$value = trim( (string) $value );
- 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 198.
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 upgrade_legacy_settings
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public function upgrade_legacy_settings() {
$prefix = $this->get_prefix();
$general_mappings = array(
'modules' => array( $prefix . 'settings_general_modules', 'modules' ),
- 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 get_item_schema
has 138 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_item_schema() {
$schema = array(
'$schema' => 'http://json-schema.org/schema#',
'title' => $this->manager->get_singular_slug() . '_type',
'type' => 'object',
File submission.php
has 394 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Submission class
*
* @package TorroForms
Function validate_field
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
public function validate_field( $value, $element, $submission ) {
$settings = $this->get_settings( $element );
$value = absint( $value );
- 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 get_fields
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
protected function get_fields() {
$fields = array(
'form_id' => array(
'section' => 'associated_data',
'type' => 'autocomplete',
- 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_templates
has 134 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function print_templates() {
?>
<script type="text/html" id="tmpl-torro-failure">
<div class="torro-notice notice-error">
<p>
Method handle_form_submission
has 130 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function handle_form_submission( $form, $submission, $data = array() ) {
if ( $submission->has_errors() ) {
$submission->reset_errors();
}
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function get_item_schema() {
$schema = parent::get_item_schema();
$schema['properties']['element_id'] = array(
'description' => __( 'ID of the element this element choice belongs to.', 'torro-forms' ),
- 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 187.
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
public function get_item_schema() {
$schema = parent::get_item_schema();
$schema['properties']['element_id'] = array(
'description' => __( 'ID of the element this element setting belongs to.', 'torro-forms' ),
- 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 187.
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_template_tag_handlers
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function register_template_tag_handlers() {
$tags = array(
'sitetitle' => array(
'group' => 'global',
'label' => __( 'Site Title', 'torro-forms' ),