abaicus/ti-onboarding

View on GitHub

Showing 96 of 96 total issues

Function fetch_remote_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function fetch_remote_file( $url, $post ) {
        // extract the file name and extension from the url
        $file_name = basename( $url );

        // get placeholder file in the upload dir with a unique, sanitized filename

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

    protected function post_process_menu_item( $post_id ) {
        $menu_object_id = get_post_meta( $post_id, '_wxr_import_menu_item', true );
        if ( empty( $menu_object_id ) ) {
            // No processing needed!
            return;

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

Avoid too many return statements within this method.
Open

            return new WP_REST_Response(
                array(
                    'data'    => 'ti__ob_front_page_id_err_1',
                    'success' => false,
                )
Severity: Major
Found in includes/importers/class-themeisle-ob-content-importer.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return $upload;

      Avoid too many return statements within this method.
      Open

                  return false;

        Avoid too many return statements within this method.
        Open

                return new WP_REST_Response(
                    array(
                        'success' => true,
                        'data'    => $import,
                    )
        Severity: Major
        Found in includes/class-themeisle-ob-rest-server.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return new WP_Error( 'import_file_error', $message );

            Avoid too many return statements within this method.
            Open

                    return false;
            Severity: Major
            Found in includes/class-themeisle-ob-rest-server.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return current_user_can( 'manage_options' );
              Severity: Major
              Found in includes/class-themeisle-ob-rest-server.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return new WP_Error( 'import_file_error', 'Zero size file downloaded' );

                  Avoid too many return statements within this method.
                  Open

                                      return current_user_can( 'manage_options' );
                  Severity: Major
                  Found in includes/class-themeisle-ob-rest-server.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return false;

                      Avoid too many return statements within this method.
                      Open

                                          return current_user_can( 'manage_options' );
                      Severity: Major
                      Found in includes/class-themeisle-ob-rest-server.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return new WP_REST_Response(
                                    array(
                                        'success'      => true,
                                        'frontpage_id' => $frontpage_id,
                                    )
                        Severity: Major
                        Found in includes/importers/class-themeisle-ob-content-importer.php - About 30 mins to fix

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

                              function remap_featured_images() {
                                  // cycle through posts that have a featured image
                                  foreach ( $this->featured_images as $post_id => $value ) {
                                      if ( isset( $this->mapping['post'][ $value ] ) ) {
                                          $new_id = $this->mapping['post'][ $value ];

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

                              public function skip_terms( $data, $meta ) {
                                  foreach ( $this->filtered_post_types as $post_type ) {
                                      if ( ! $this->post_map[ $post_type ] <= 2 ) {
                                          continue;
                                      }
                          Severity: Minor
                          Found in includes/importers/helpers/class-themeisle-ob-importer-alterator.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