felixarntz/theme-boilerplate

View on GitHub

Showing 194 of 194 total issues

Function initializeDropdownMenus has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    initializeDropdownMenus( menu ) {
        const options = this.options;

        let parentLinks;

Severity: Minor
Found in assets/src/js/theme/navigation.js - About 1 hr to fix

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

      Search.prototype.bind = function (decorated, container, $container) {
        var self = this;
        var resultsId = container.id + '-results';
    
        decorated.call(this, container, $container);
    Severity: Minor
    Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix

      Method get_social_links_icons has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function get_social_links_icons() {
              if ( is_array( $this->social_links_icons ) ) {
                  return $this->social_links_icons;
              }
      
      
      Severity: Minor
      Found in inc/library/social-navigation/class-social-navigation.php - About 1 hr to fix

        Method handle_sticky_elements has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function handle_sticky_elements() {
        
                // Skip for now since it is neither possible to set state nor animate position style based on position observer.
                if ( ! $this->is_amp() || true ) {
                    return;
        Severity: Minor
        Found in inc/library/amp/class-amp.php - About 1 hr to fix

          Function Select2 has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            var Select2 = function ($element, options) {
              if ($element.data('select2') != null) {
                $element.data('select2').destroy();
              }
          
          
          Severity: Minor
          Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix

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

                protected function register_customize_preview_js( $assets ) {
                    $assets->register_asset( new Super_Awesome_Theme_Script(
                        'super-awesome-theme-sidebar-customize-preview',
                        get_theme_file_uri( '/assets/dist/js/sidebar.customize-preview.js' ),
                        array(
            Severity: Major
            Found in inc/library/sidebar/class-sidebar.php and 1 other location - About 1 hr to fix
            inc/library/navbar/class-navbar.php on lines 303..319

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

            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 register_customize_preview_js( $assets ) {
                    $assets->register_asset( new Super_Awesome_Theme_Script(
                        'super-awesome-theme-navbar-customize-preview',
                        get_theme_file_uri( '/assets/dist/js/navbar.customize-preview.js' ),
                        array(
            Severity: Major
            Found in inc/library/navbar/class-navbar.php and 1 other location - About 1 hr to fix
            inc/library/sidebar/class-sidebar.php on lines 338..354

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

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

                protected function register_settings() {
                    $settings                  = $this->get_dependency( 'settings' );
                    $this->attachment_metadata = new Super_Awesome_Theme_Attachment_Metadata( $settings );
            
                    $boolean_settings = array();
            Severity: Minor
            Found in inc/library/content-types/class-content-types.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 __construct has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                public function __construct( $id, array $args = array() ) {
                    $this->id = (string) $id;
            
                    $defaults = $this->get_defaults();
                    foreach ( $defaults as $prop => $default_value ) {
            Severity: Minor
            Found in inc/library/widgets/class-widget-area.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 bind has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              BaseSelection.prototype.bind = function (container, $container) {
                var self = this;
            
                var id = container.id + '-container';
                var resultsId = container.id + '-results';
            Severity: Minor
            Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix

              Method register_customize_controls_js has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function register_customize_controls_js( $assets ) {
                      $data = array(
                          'postTypes' => array(),
                      );
              
              
              Severity: Minor
              Found in inc/library/content-types/class-content-types.php - About 1 hr to fix

                Function query has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  Tags.prototype.query = function (decorated, params, callback) {
                    var self = this;
                
                    this._removeOldTags();
                
                
                Severity: Minor
                Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix

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

                      protected function fetch_families() {
                          $filename = get_theme_file_path( 'assets/resources/google-webfonts.json' );
                          if ( ! file_exists( $filename ) ) {
                              return array();
                          }
                  Severity: Minor
                  Found in inc/library/fonts/class-google-webfont-api.php - About 1 hr to fix

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

                        protected function print_base_font_style_general() {
                            $base_font    = $this->get( 'base_font' );
                            $heading_font = $this->get( 'heading_font' );
                    
                            if ( ! empty( $base_font['family_stack'] ) ) {
                    Severity: Minor
                    Found in inc/library/fonts/class-fonts.php - About 1 hr to fix

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

                              <?php if ( ! is_singular( get_post_type() ) && ! post_password_required() && post_type_supports( get_post_type(), 'comments' ) && comments_open() ) : ?>
                                  <span class="comments-link">
                                      <?php
                                      comments_popup_link(
                                          sprintf(
                      Severity: Major
                      Found in template-parts/content/entry-footer.php and 1 other location - About 1 hr to fix
                      template-parts/content/entry-footer-attachment.php on lines 18..37

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

                      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

                              <?php if ( ! is_singular( get_post_type() ) && ! post_password_required() && post_type_supports( get_post_type(), 'comments' ) && comments_open() ) : ?>
                                  <span class="comments-link">
                                      <?php
                                      comments_popup_link(
                                          sprintf(
                      Severity: Major
                      Found in template-parts/content/entry-footer-attachment.php and 1 other location - About 1 hr to fix
                      template-parts/content/entry-footer.php on lines 16..35

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

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

                          protected function add_field( $id, array $args = array() ) {
                              if ( ! isset( $args[ self::FIELD_ARG_TYPE ] ) ) {
                                  $args[ self::FIELD_ARG_TYPE ] = self::FIELD_TYPE_TEXT;
                              }
                      
                      
                      Severity: Minor
                      Found in inc/library/widgets/class-widget.php - About 1 hr to fix

                        Function __call has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function __call( $method, $args ) {
                                switch ( $method ) {
                                    case 'register_settings':
                                    case 'register_customize_partials':
                                    case 'register_customize_controls_js':
                        Severity: Minor
                        Found in inc/library/content-types/class-content-types.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 default_sanitize_callback has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function default_sanitize_callback( $value, $args ) {
                                switch ( $args[ self::FIELD_ARG_TYPE ] ) {
                                    case self::FIELD_TYPE_NUMBER:
                                        if ( isset( $args[ self::FIELD_ARG_INPUT_ATTRS ]['step'] ) && is_int( $args[ self::FIELD_ARG_INPUT_ATTRS ]['step'] ) ) {
                                            $value = (int) $value;
                        Severity: Minor
                        Found in inc/library/widgets/class-widget.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 Decorate has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          Utils.Decorate = function (SuperClass, DecoratorClass) {
                            var decoratedMethods = getMethods(DecoratorClass);
                            var superMethods = getMethods(SuperClass);
                        
                            function DecoratedClass () {
                        Severity: Minor
                        Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language