EvanHerman/timeline-express

View on GitHub

Showing 35 of 44 total issues

File helpers.php has 433 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Timeline Express Helper Functions
 * By Code Parrots
 *
Severity: Minor
Found in lib/helpers.php - About 6 hrs to fix

    File class-timeline-express-admin.php has 393 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Timeline Express :: Admin Class
     *
     * @author Code Parrots
    Severity: Minor
    Found in lib/classes/class-timeline-express-admin.php - About 5 hrs to fix

      File page.addons.php has 351 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Addon Template - Admin Page
       *
       * @package Timeline Express
      Severity: Minor
      Found in lib/admin/pages/page.addons.php - About 4 hrs to fix

        Method timeline_express_add_on_activation has 78 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function timeline_express_add_on_activation() {
        
                if ( ! current_user_can( 'install_plugins' ) ) {
        
                    wp_die( __( 'Sorry, you are not allowed to activate plugins on this site.', 'timeline-express' ) );
        Severity: Major
        Found in lib/classes/class-timeline-express-admin.php - About 3 hrs to fix

          Timeline_Express_Admin has 23 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Timeline_Express_Admin {
              /**
               * Main constructor
               */
              public function __construct() {
          Severity: Minor
          Found in lib/classes/class-timeline-express-admin.php - About 2 hrs to fix

            Method timeline_express_addon_details has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function timeline_express_addon_details( $data ) {
            
                ?>
            
                <div class="plugin-card-bottom">
            Severity: Major
            Found in lib/admin/pages/page.addons.php - About 2 hrs to fix

              Method timeline_express_render_addon has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function timeline_express_render_addon( $addon, $free = false ) {
              
                  /**
                   * Allowed tags for the byline - borrowed from WordPress core.
                   *
              Severity: Major
              Found in lib/admin/pages/page.addons.php - About 2 hrs to fix

                Method timeline_express_build_bootstrap_icon_dropdown has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function timeline_express_build_bootstrap_icon_dropdown( $field, $meta ) {
                
                    $screen = get_current_screen();
                
                    $screen_base = $screen->base;
                Severity: Major
                Found in lib/helpers.php - About 2 hrs to fix

                  Function edit has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    edit: props => {
                  
                      const { attributes: { announcementLimit, displayOrder, timeFrame }, className, setAttributes } = props;
                  
                      return [
                  Severity: Major
                  Found in lib/admin/blocks/timeline/js/timeline-block.js - About 2 hrs to fix

                    Method timeline_express_add_on_installer has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function timeline_express_add_on_installer() {
                    
                            if ( ! current_user_can( 'install_plugins' ) ) {
                    
                                wp_die( __( 'Sorry, you are not allowed to install plugins on this site.', 'timeline-express' ) );
                    Severity: Minor
                    Found in lib/classes/class-timeline-express-admin.php - About 2 hrs to fix

                      Method timeline_express_get_announcement_image has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function timeline_express_get_announcement_image( $post_id, $image_size = 'timeline-express' ) {
                      
                          if ( ! get_post_meta( $post_id, 'announcement_image_id', true ) && ! get_post_meta( $post_id, 'announcement_image', true ) ) {
                      
                              return;
                      Severity: Minor
                      Found in lib/helpers.php - About 1 hr to fix

                        Method timeline_express_build_addon_data has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function timeline_express_build_addon_data( $data, $free = false ) {
                        
                            $all_plugins = get_plugins();
                        
                            $slug        = isset( $data['slug'] ) ? $data['slug'] : sanitize_title( $data['name'] . ' Add-On' );
                        Severity: Minor
                        Found in lib/admin/pages/page.addons.php - About 1 hr to fix

                          Method timeline_express_print_inline_styles has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function timeline_express_print_inline_styles( $timeline_express_options ) {
                          
                                  $content_background = ( '' === $timeline_express_options['announcement-bg-color'] ) ? 'transparent' : $timeline_express_options['announcement-bg-color'];
                          
                                  $content_shadow = ( '' === $timeline_express_options['announcement-box-shadow-color'] ) ? '0 3px 0 transparent' : '0 3px 0 ' . $timeline_express_options['announcement-box-shadow-color'];
                          Severity: Minor
                          Found in lib/classes/class-timeline-express-initialize.php - About 1 hr to fix

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

                                public function generate_timeline_express( $timeline_express_options, $atts ) {
                            
                                    ob_start();
                            
                                    global $post;
                            Severity: Minor
                            Found in lib/classes/class-timeline-express-initialize.php - About 1 hr to fix

                              Method timeline_express_get_announcement_icon_markup has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function timeline_express_get_announcement_icon_markup( $post_id, $link = true ) {
                              
                                  $timeline_express_options = timeline_express_get_options();
                              
                                  $custom_icon_html = apply_filters( 'timeline_express_custom_icon_html', apply_filters( 'timeline-express-custom-icon-html', false, $post_id, $timeline_express_options ), $post_id, $timeline_express_options );
                              Severity: Minor
                              Found in lib/helpers.php - About 1 hr to fix

                                Function timeline_express_build_bootstrap_icon_dropdown has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function timeline_express_build_bootstrap_icon_dropdown( $field, $meta ) {
                                
                                    $screen = get_current_screen();
                                
                                    $screen_base = $screen->base;
                                Severity: Minor
                                Found in lib/helpers.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

                                Function install_plugin has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    cnkt_installer.install_plugin = function( el, plugin ) {
                                
                                        // Confirm activation
                                        var r = confirm( te_installer_localize.install_now );
                                
                                
                                Severity: Minor
                                Found in lib/admin/js/timeline-express-add-ons.js - About 1 hr to fix

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

                                  function manage_timeline_express_column_content( $column_name, $id ) {
                                  
                                      switch ( $column_name ) {
                                  
                                          case 'color':
                                  Severity: Minor
                                  Found in lib/admin/cpt/timeline-express-admin-columns.php - About 1 hr to fix

                                    Function te_get_advertisment has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    function te_get_advertisment( $part = '' ) {
                                    
                                        $advertisment = get_transient( 'timeline_express_ad_transient' );
                                    
                                        // Check for a transient before continuing
                                    Severity: Minor
                                    Found in lib/admin/metaboxes/metaboxes.announcements.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

                                    Function timeline_express_add_on_activation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        public function timeline_express_add_on_activation() {
                                    
                                            if ( ! current_user_can( 'install_plugins' ) ) {
                                    
                                                wp_die( __( 'Sorry, you are not allowed to activate plugins on this site.', 'timeline-express' ) );
                                    Severity: Minor
                                    Found in lib/classes/class-timeline-express-admin.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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language