awsmug/torro-forms

View on GitHub

Showing 375 of 503 total issues

Function get_items_permissions_check has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_items_permissions_check( $request ) {
        $capabilities = $this->manager->capabilities();

        if ( 'edit' === $request['context'] && ( ! $capabilities || ! $capabilities->user_can_edit() ) ) {
            return new WP_Error( 'rest_cannot_edit_types', __( 'Sorry, you are not allowed to edit elements and their types.', 'torro-forms' ), array( 'status' => rest_authorization_required_code() ) );
Severity: Minor
Found in src/db-objects/elements/element-types/rest-element-types-controller.php - About 25 mins to fix

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_edit_submission_fields_args has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_edit_submission_fields_args( $element ) {
        $settings = $this->get_settings( $element );

        $slug = $this->get_edit_submission_field_slug( $element->id );
        $args = array(
Severity: Minor
Found in src/db-objects/elements/element-types/element-type.php - About 25 mins to fix

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 action_duplicate_form has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function action_duplicate_form() {
        $nonce   = filter_input( INPUT_GET, '_wpnonce' );
        $form_id = filter_input( INPUT_GET, 'form_id', FILTER_VALIDATE_INT );

        if ( empty( $form_id ) ) {
Severity: Minor
Found in src/db-objects/forms/form-edit-page-handler.php - About 25 mins to fix

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 add_page_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function add_page_content() {
        $tabs = $this->get_tabs();
        foreach ( $tabs as $slug => $args ) {
            $this->add_tab( $slug, $args );
        }
Severity: Minor
Found in src/db-objects/forms/form-settings-page.php - About 25 mins to fix

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 duplicate_metadata_for_form has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function duplicate_metadata_for_form( $form_id ) {
        $forbidden_meta = array( '_edit_lock', '_edit_last' );

        $meta = get_post_meta( $this->original->ID );
        foreach ( $meta as $meta_key => $meta_values ) {
Severity: Minor
Found in src/db-objects/forms/form.php - About 25 mins to fix

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 maybe_enqueue_assets has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function maybe_enqueue_assets( $hook_suffix ) {
        if ( 'post-new.php' !== $hook_suffix && 'post.php' !== $hook_suffix ) {
            return;
        }

Severity: Minor
Found in src/db-objects/forms/form-edit-page-handler.php - About 25 mins to fix

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_current_container has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_current_container() {
        $container_id = (int) $this->__get( 'current_container_id' );

        if ( ! empty( $container_id ) ) {
            $container = $this->manager->get_parent_manager( 'forms' )->get_child_manager( 'containers' )->get( $container_id );
Severity: Minor
Found in src/db-objects/submissions/submission.php - About 25 mins to fix

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_tabs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function get_tabs() {
        $tabs = array(
            'general' => array(
                'title' => _x( 'General', 'submission edit page tab', 'torro-forms' ),
            ),
Severity: Minor
Found in src/db-objects/submissions/submission-edit-page.php - About 25 mins to fix

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 map_args has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function map_args( $args ) {
        $mapped_args = $args;
        foreach ( $args as $query_var => $value ) {
            switch ( $query_var ) {
                case 'title':
Severity: Minor
Found in src/db-objects/form-categories/form-category-query.php - About 25 mins to fix

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 set_submission_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function set_submission_data( $submission, $form, $data ) {
        $identification_modes = $this->get_form_option( $form->id, 'identification_modes', array() );

        if ( in_array( 'ip_address', $identification_modes, true ) ) {
            $validated_ip = Fixes::php_filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP );
Severity: Minor
Found in src/modules/access-controls/user-identification.php - About 25 mins to fix

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_settings_sections has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function get_settings_sections() {
        $sections = array();

        foreach ( $this->submodules as $slug => $submodule ) {
            if ( ! is_a( $submodule, Settings_Submodule_Interface::class ) ) {
Severity: Minor
Found in src/modules/submodule-registry-trait.php - About 25 mins to fix

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 add_settings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    final protected function add_settings( $settings_page ) {
        $subtabs = $this->get_settings_subtabs();
        if ( empty( $subtabs ) ) {
            return;
        }
Severity: Minor
Found in src/modules/module.php - About 25 mins to fix

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 validate_tag_args_definition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function validate_tag_args_definition( $tag_args_definition ) {
        foreach ( $tag_args_definition as $type ) {
            switch ( $type ) {
                case 'string':
                case 'int':
Severity: Minor
Found in src/components/template-tag-handler.php - About 25 mins to fix

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 process_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function process_content( $content, $args ) {
        if ( false === strpos( $content, '{' ) ) {
            return $content;
        }

Severity: Minor
Found in src/components/template-tag-handler.php - About 25 mins to fix

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 delete_old_files has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function delete_old_files( $submission, $form, $element_id, $field = '_main', $ignore_id = 0 ) {
        $prefix = $this->get_prefix();

        if ( ! $field ) {
            $field = '_main';
Severity: Minor
Found in src/components/form-upload-manager.php - About 25 mins to fix

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

Severity
Category
Status
Source
Language