EvanHerman/timeline-express

View on GitHub

Showing 41 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

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

                  <g opacity="0.2">
                      <g>
                          <defs>
                              <rect id="SVGID_5_" x="10.063" y="20.902" width="4.905" height="0.77"/>
                          </defs>
      Severity: Major
      Found in lib/admin/blocks/timeline/js/icons.js and 1 other location - About 5 hrs to fix
      lib/admin/blocks/timeline/js/icons.js on lines 73..86

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

      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

                      <g opacity="0.2">
                          <g>
                              <defs>
                                  <rect id="SVGID_7_" x="7.751" y="1.031" width="6.281" height="20.162"/>
                              </defs>
      Severity: Major
      Found in lib/admin/blocks/timeline/js/icons.js and 1 other location - About 5 hrs to fix
      lib/admin/blocks/timeline/js/icons.js on lines 24..38

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

      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

      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

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

                          $api = plugins_api(
                              'plugin_information',
                              array(
                                  'slug'   => $plugin,
                                  'fields' => array(
                  Severity: Major
                  Found in lib/classes/class-timeline-express-admin.php and 1 other location - About 2 hrs to fix
                  lib/classes/class-timeline-express-admin.php on lines 753..772

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

                  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

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

                          $api = plugins_api(
                              'plugin_information',
                              array(
                                  'slug'   => $plugin,
                                  'fields' => array(
                  Severity: Major
                  Found in lib/classes/class-timeline-express-admin.php and 1 other location - About 2 hrs to fix
                  lib/classes/class-timeline-express-admin.php on lines 647..666

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

                  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

                  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

                                Severity
                                Category
                                Status
                                Source
                                Language