felixarntz/theme-boilerplate

View on GitHub

Showing 194 of 194 total issues

Function S2 has 4921 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var S2 =(function () {
  // Restore the Select2 AMD loader so it can be used
  // Needed mostly in the language files, where the loader is not inserted
  if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
    var S2 = jQuery.fn.select2.amd;
Severity: Major
Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 3 wks to fix

    File selectWoo.full.js has 4948 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * SelectWoo 1.0.1
     * https://github.com/woocommerce/selectWoo
     *
     * Released under the MIT license
    Severity: Major
    Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 2 wks to fix

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

      <?php
      /**
       * Super_Awesome_Theme_Bottom_Bar class
       *
       * @package Super_Awesome_Theme
      Severity: Major
      Found in inc/library/bottom-bar/class-bottom-bar.php and 1 other location - About 6 days to fix
      inc/library/top-bar/class-top-bar.php on lines 1..280

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

      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
      /**
       * Super_Awesome_Theme_Top_Bar class
       *
       * @package Super_Awesome_Theme
      Severity: Major
      Found in inc/library/top-bar/class-top-bar.php and 1 other location - About 6 days to fix
      inc/library/bottom-bar/class-bottom-bar.php on lines 1..280

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

      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 class-colors.php has 626 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Super_Awesome_Theme_Colors class
       *
       * @package Super_Awesome_Theme
      Severity: Major
      Found in inc/library/colors/class-colors.php - About 1 day to fix

        Function apply has 191 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          Defaults.prototype.apply = function (options) {
            options = $.extend(true, {}, this.defaults, options);
        
            if (options.dataAdapter == null) {
              if (options.ajax != null) {
        Severity: Major
        Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 7 hrs to fix

          Function bind has 166 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            Results.prototype.bind = function (container, $container) {
              var self = this;
          
              var id = container.id + '-results';
          
          
          Severity: Major
          Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 6 hrs to fix

            Function get_for_post has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
            Open

                public function get_for_post( $post = null ) {
                    $post = get_post( $post );
                    if ( ! $post ) {
                        return false;
                    }
            Severity: Minor
            Found in inc/library/content-types/class-attachment-metadata.php - About 6 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 print_base_color_style_general has 134 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function print_base_color_style_general() {
                    $text_color            = $this->get( 'text_color' );
                    $text_focus_color      = $this->util()->darken_color( $text_color, 25 );
                    $text_light_color      = $this->util()->lighten_color( $text_color, 100 );
                    $link_color            = $this->get( 'link_color' );
            Severity: Major
            Found in inc/library/colors/class-colors.php - About 5 hrs to fix

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

                  protected function support_side_navbar_toggle() {
                      $state_id = $this->args['state_id'];
              
                      $navbar = $this->dom->getElementById( 'site-navbar' );
                      if ( ! $navbar ) {
              Severity: Major
              Found in inc/library/amp/class-amp-sanitizer.php and 1 other location - About 4 hrs to fix
              inc/library/amp/class-amp-sanitizer.php on lines 89..118

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

              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

                  protected function support_mobile_menu_toggle() {
                      $state_id = $this->args['state_id'];
              
                      $navigation = $this->dom->getElementById( 'site-navigation' );
                      if ( ! $navigation ) {
              Severity: Major
              Found in inc/library/amp/class-amp-sanitizer.php and 1 other location - About 4 hrs to fix
              inc/library/amp/class-amp-sanitizer.php on lines 125..154

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

              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 register_default_families has 102 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function register_default_families() {
                      $families = array(
              
                          // System fonts.
                          new Super_Awesome_Theme_Font_Family( 'system', array(
              Severity: Major
              Found in inc/library/fonts/class-font-families.php - About 4 hrs to fix

                File class-content-types.php has 330 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * Super_Awesome_Theme_Content_Types class
                 *
                 * @package Super_Awesome_Theme
                Severity: Minor
                Found in inc/library/content-types/class-content-types.php - About 3 hrs to fix

                  Function initializeFontFamilySelect has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          initializeFontFamilySelect: function( $element ) {
                              const selectData   = {};
                              const includedData = {};
                              const excludedData = {};
                              const settingValue = this.setting.get();
                  Severity: Major
                  Found in assets/src/js/fonts.customize-controls.js - About 3 hrs to fix

                    File gulpfile.js has 315 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /* ---- THE FOLLOWING CONFIG SHOULD BE EDITED ---- */
                    
                    const pkg = require( './package.json' );
                    
                    const tags = [
                    Severity: Minor
                    Found in gulpfile.js - About 3 hrs to fix

                      Function initializeCommentForm has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          initializeCommentForm( commentForm, comments, statusDiv ) {
                              const options = this.options;
                      
                              if ( ! commentForm ) {
                                  return;
                      Severity: Major
                      Found in assets/src/js/theme/comment-form.js - About 3 hrs to fix

                        File class-fonts.php has 314 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        /**
                         * Super_Awesome_Theme_Fonts class
                         *
                         * @package Super_Awesome_Theme
                        Severity: Minor
                        Found in inc/library/fonts/class-fonts.php - About 3 hrs to fix

                          Method render_form_field has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function render_form_field( $id, $args, $value ) {
                                  $control_id     = $this->get_field_id( $id );
                                  $control_name   = $this->get_field_name( $id );
                                  $type           = $args[ self::FIELD_ARG_TYPE ];
                                  $title          = $args[ self::FIELD_ARG_TITLE ];
                          Severity: Major
                          Found in inc/library/widgets/class-widget.php - About 3 hrs to fix

                            Function calculate_content_image_sizes has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                            Open

                                protected function calculate_content_image_sizes( $sizes, $size ) {
                                    $settings = $this->get_dependency( 'settings' );
                                    $sidebar  = $this->get_dependency( 'sidebar' );
                            
                                    $rem         = 16;
                            Severity: Minor
                            Found in inc/library/image-sizes/class-image-sizes.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 initializeCommentForm has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                            Open

                                initializeCommentForm( commentForm, comments, statusDiv ) {
                                    const options = this.options;
                            
                                    if ( ! commentForm ) {
                                        return;
                            Severity: Minor
                            Found in assets/src/js/theme/comment-form.js - 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

                            Severity
                            Category
                            Status
                            Source
                            Language