presscodes/maera

View on GitHub

Showing 39 of 43 total issues

Method get_context has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function get_context() {

        global $content_width;

        if ( class_exists( 'Easy_Digital_Downloads' ) ) {
Severity: Minor
Found in includes/class-maera-timber.php - About 1 hr to fix

    Method purchase_variable_pricing has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function purchase_variable_pricing( $download_id ) {
    
            $variable_pricing = edd_has_variable_prices( $download_id );
    
            if ( ! $variable_pricing ) {
    Severity: Minor
    Found in includes/class-maera-edd-mods.php - About 1 hr to fix

      Function form has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          function form( $instance ) {
      
              $defaults = array(
                  'title'           => 'Latest Articles',
                  'post_type'       => 'post',

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

          function colorposts_build_css( $styles ) {
      
              $src = $this->custom_header_url();
      
              if ( $src && get_template_directory_uri() . '/core-shell/assets/images/grid-back.png' != $src ) {
      Severity: Minor
      Found in core-shell/class-Maera_Shell_Core.php - About 1 hr 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

      Method context has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function context() {
      
              global $wp_query;
      
              $context = Maera()->cache->get_context();
      Severity: Minor
      Found in includes/class-maera-template.php - About 1 hr to fix

        Function colors has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            function colors() {
        
                $thumb_id  = get_post_thumbnail_id( $this->post_id );
                $thumb_url = wp_get_attachment_image_src( $thumb_id );
                $thumb_url = $thumb_url[0];
        Severity: Minor
        Found in includes/class-maera-edd-tonesque.php - About 55 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 cache_mode has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function cache_mode() {
        
                $options    = get_option( 'maera_admin_options', array() );
                $cache_mode = isset( $options['cache_mode'] ) ? $options['cache_mode'] : 'default';
        
        
        Severity: Minor
        Found in includes/class-maera-caching.php - About 55 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 widget_areas has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

                function widget_areas() {
        
                    $areas = $this->extra_widget_areas_array();
        
                    $class        = apply_filters( 'maera/widgets/class', '' );
        Severity: Minor
        Found in includes/class-maera-cwa.php - About 55 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 admin_page has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            function admin_page() {
        
                global $pagenow;
        
                $tabs    = $this->tabs();
        Severity: Minor
        Found in includes/class-maera-admin.php - About 45 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 context has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function context() {
        
                global $wp_query;
        
                $context = Maera()->cache->get_context();
        Severity: Minor
        Found in includes/class-maera-template.php - About 45 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 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            function validate( $settings ) {
        
                // Import the imported options
                if ( isset( $settings['import_data'] ) && ! empty( $settings['import_data'] ) ) {
        
        
        Severity: Minor
        Found in includes/class-maera-admin.php - About 45 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

        Consider simplifying this complex logical expression.
        Open

                if (isset($params[2])
                    && !is_int($params[2])
                    && !is_float($params[2])
                    && !is_string($params[2])
                    && !(is_object($params[2]) && method_exists($params[2], '__toString'))
        Severity: Major
        Found in includes/utils.php - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                  if (!is_int($params[1])
                      && !is_float($params[1])
                      && !is_string($params[1])
                      && $params[1] !== null
                      && !(is_object($params[1]) && method_exists($params[1], '__toString'))
          Severity: Major
          Found in includes/utils.php - About 40 mins to fix

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

                    function extra_widget_areas_wrapper( $area = null, $class = '' ) {
            
                        // Do not proceed if we have not specified an area
                        if ( is_null( $area ) ) {
                            return;
            Severity: Minor
            Found in includes/class-maera-cwa.php - About 35 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

            Avoid too many return statements within this method.
            Open

                    return $resultArray;
            Severity: Major
            Found in includes/utils.php - About 30 mins to fix

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

                  function custom_css_cached() {
              
                      if ( Maera()->dev->dev_mode() ) {
                          // Get our styles using the maera/styles filter
                          $data = apply_filters( 'maera/styles', null );
              Severity: Minor
              Found in includes/class-maera-caching.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 test_missing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function test_missing() {
              
                      $plugins = apply_filters( 'maera/plugins/required', array() );
                      $status  = get_transient( 'maera_required_plugins_status' );
              
              
              Severity: Minor
              Found in includes/class-maera-required-plugins.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 twig_locations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function twig_locations() {
              
                      $locations = array();
                      $location_roots = array();
              
              
              Severity: Minor
              Found in includes/class-maera-timber.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 required_plugins_notices has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  function required_plugins_notices() {
              
                      $plugin_messages = array();
              
                      include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
              Severity: Minor
              Found in includes/class-maera-required-plugins.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