presscodes/maera

View on GitHub

Showing 43 of 43 total issues

Function array_column has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    function array_column($input = null, $columnKey = null, $indexKey = null)
    {
        // Using func_get_args() in order to check for proper number of
        // parameters and trigger errors exactly as the built-in array_column()
        // does in PHP 5.5.
Severity: Minor
Found in includes/utils.php - About 5 hrs 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 form has 122 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function form( $instance ) {

        $defaults = array(
            'title'           => 'Latest Articles',
            'post_type'       => 'post',

    Function maera_templates_sidebar has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    function maera_templates_sidebar() {
    
        global $wp_query;
        $templates = array();
    
    
    Severity: Minor
    Found in includes/template-hierarchy.php - About 3 hrs 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 modify_edd_download_shortcode has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        function modify_edd_download_shortcode( $display, $atts, $buy_button, $columns, $column_width, $downloads, $excerpt, $full_content, $price, $thumbnails, $query ) {
    
            $button_defaults = apply_filters( 'edd_purchase_link_defaults', array() );
            $button_defaults_class = $button_defaults['class'];
    
    
    Severity: Minor
    Found in includes/class-maera-edd-shortcodes.php - About 3 hrs 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 maera_templates_hierarchy has 84 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function maera_templates_hierarchy( $templates = array() ) {
    
        if ( ! isset( $templates ) ) {
            $templates = array();
        }
    Severity: Major
    Found in includes/template-hierarchy.php - About 3 hrs to fix

      Function maera_templates_hierarchy has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      function maera_templates_hierarchy( $templates = array() ) {
      
          if ( ! isset( $templates ) ) {
              $templates = array();
          }
      Severity: Minor
      Found in includes/template-hierarchy.php - About 3 hrs 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 fitVids has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        $.fn.fitVids = function( options ) {
          var settings = {
            customSelector: null
          };
      
      
      Severity: Major
      Found in assets/js/jquery.fitvids.js - About 3 hrs to fix

        Method modify_edd_download_shortcode has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function modify_edd_download_shortcode( $display, $atts, $buy_button, $columns, $column_width, $downloads, $excerpt, $full_content, $price, $thumbnails, $query ) {
        
                $button_defaults = apply_filters( 'edd_purchase_link_defaults', array() );
                $button_defaults_class = $button_defaults['class'];
        
        
        Severity: Major
        Found in includes/class-maera-edd-shortcodes.php - About 3 hrs to fix

          Method array_column has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function array_column($input = null, $columnKey = null, $indexKey = null)
              {
                  // Using func_get_args() in order to check for proper number of
                  // parameters and trigger errors exactly as the built-in array_column()
                  // does in PHP 5.5.
          Severity: Major
          Found in includes/utils.php - About 2 hrs to fix

            Method replacements has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function replacements() {
            
                    $replacements = array(
                        'maera_grid_container_open',
                        'maera_grid_container_close',
            Severity: Major
            Found in includes/class-maera-shell.php - About 2 hrs to fix

              Method create_settings has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function create_settings( $controls ) {
              
                      global $edd_options;
              
                      $controls[] = array(
              Severity: Major
              Found in includes/class-maera-edd-customizer.php - About 2 hrs to fix

                Method widget has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function widget( $args, $instance ) {
                
                        extract( $args );
                
                        if ( isset( $instance['term'] ) && 'any' != $instance['term'] ) {

                  Method add_controls has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function add_controls( $wp_customize ) {
                  
                          // Get the available shells and format the array properly
                          $available_shells = apply_filters( 'maera/shells/available', array() );
                          $shells = array();
                  Severity: Minor
                  Found in includes/class-maera-core-customizer.php - About 1 hr to fix

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    <?php
                    
                    Maera()->views->dependencies();
                    
                    $context = Maera()->cache->get_context();
                    Severity: Major
                    Found in bbpress.php and 1 other location - About 1 hr to fix
                    buddypress.php on lines 1..12

                    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

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    <?php
                    
                    Maera()->views->dependencies();
                    
                    $context = Maera()->cache->get_context();
                    Severity: Major
                    Found in buddypress.php and 1 other location - About 1 hr to fix
                    bbpress.php on lines 1..12

                    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

                    Further Reading

                    Method modify_edd_download_shortcode has 11 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        function modify_edd_download_shortcode( $display, $atts, $buy_button, $columns, $column_width, $downloads, $excerpt, $full_content, $price, $thumbnails, $query ) {
                    Severity: Major
                    Found in includes/class-maera-edd-shortcodes.php - About 1 hr to fix

                      Method maera_templates_sidebar has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function maera_templates_sidebar() {
                      
                          global $wp_query;
                          $templates = array();
                      
                      
                      Severity: Minor
                      Found in includes/template-hierarchy.php - About 1 hr to fix

                        Method admin_notice has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function admin_notice() {
                        
                                global $current_user ;
                                $user_id = $current_user->ID;
                        
                        
                        Severity: Minor
                        Found in includes/class-maera-admin.php - About 1 hr to fix

                          Method colors has 30 lines of code (exceeds 25 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 1 hr to fix

                            Identical blocks of code found in 2 locations. Consider refactoring.
                            Open

                                    $cache_modes = array(
                                        array( 'value' => 'none',      'label' => esc_html__( 'No Caching', 'maera' ) ),
                                        array( 'value' => 'object',    'label' => esc_html__( 'WP Object Caching', 'maera' ) ),
                                        array( 'value' => 'transient', 'label' => esc_html__( 'Transients', 'maera' ) ),
                                        array( 'value' => 'default',   'label' => esc_html__( 'Default', 'maera' ) ),
                            Severity: Major
                            Found in includes/class-maera-admin.php and 1 other location - About 1 hr to fix
                            includes/admin/tabs/settings.php on lines 15..20

                            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 104.

                            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

                            Further Reading

                            Severity
                            Category
                            Status
                            Source
                            Language