felixarntz/theme-boilerplate

View on GitHub

Showing 194 of 194 total issues

Function initializeSubmenuFocus has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    initializeSubmenuFocus( menu ) {
        let parentLinks;

        if ( ! menu ) {
            return;
Severity: Minor
Found in assets/src/js/theme/navigation.js - About 1 hr to fix

    Function detect_post_type has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function detect_post_type() {
            switch ( true ) {
                case is_front_page():
                    if ( is_home() ) {
                        return 'post';
    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 register_widget has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function register_widget( $widget_class_name ) {
            global $wp_widget_factory;
    
            if ( ! is_subclass_of( $widget_class_name, 'Super_Awesome_Theme_Widget' ) ) {
                if ( is_object( $widget_class_name ) ) {
    Severity: Minor
    Found in inc/library/widgets/class-widgets.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 register_customize_partial has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function register_customize_partial( $customizer ) {
            $partial_colors = array();
    
            if ( ! empty( $this->groups ) ) {
                $customizer->add_panel( 'colors', array(
    Severity: Minor
    Found in inc/library/colors/class-colors.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 resolve_dependencies has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function resolve_dependencies() {
            foreach ( $this->components as $component ) {
                foreach ( $this->dependants_map as $class_name => $dependants ) {
                    if ( $component instanceof $class_name ) {
                        foreach ( $dependants as $dependant ) {
    Severity: Minor
    Found in inc/library/class-theme.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

    Method print_color_style has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function print_color_style( $colors ) {
            $bottom_bar_text_color       = $colors->get( 'bottom_bar_text_color' );
            $bottom_bar_background_color = $colors->get( 'bottom_bar_background_color' );
    
            if ( empty( $bottom_bar_text_color ) || empty( $bottom_bar_background_color ) ) {
    Severity: Minor
    Found in inc/library/bottom-bar/class-bottom-bar.php - About 1 hr to fix

      Method print_color_style has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function print_color_style( $colors ) {
              $top_bar_text_color       = $colors->get( 'top_bar_text_color' );
              $top_bar_background_color = $colors->get( 'top_bar_background_color' );
      
              if ( empty( $top_bar_text_color ) || empty( $top_bar_background_color ) ) {
      Severity: Minor
      Found in inc/library/top-bar/class-top-bar.php - About 1 hr to fix

        Method __construct has 27 lines of code (exceeds 25 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

          Function current has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            InputData.prototype.current = function (_, callback) {
              function getSelected (data, selectedIds) {
                var selected = [];
          
                if (data.selected || $.inArray(data.id, selectedIds) !== -1) {
          Severity: Minor
          Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix

            Function selectWoo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                $.fn.selectWoo = function (options) {
                  options = options || {};
            
                  if (typeof options === 'object') {
                    this.each(function () {
            Severity: Minor
            Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix

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

                StopPropagation.prototype.bind = function (decorated, container, $container) {
                  decorated.call(this, container, $container);
              
                  var stoppedEvents = [
                    'blur',
              Severity: Minor
              Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix

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

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

                  Function select has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    SelectAdapter.prototype.select = function (data) {
                      var self = this;
                  
                      data.selected = true;
                  
                  
                  Severity: Minor
                  Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix

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

                      StopPropagation.prototype.bind = function (decorated, container, $container) {
                        decorated.call(this, container, $container);
                    
                        var stoppedEvents = [
                        'blur',
                    Severity: Minor
                    Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix

                      Method register_widget_areas has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function register_widget_areas( $widgets ) {
                              $widgets->register_widget_area( new Super_Awesome_Theme_Widget_Area(
                                  'primary',
                                  array(
                                      Super_Awesome_Theme_Widget_Area::PROP_TITLE       => __( 'Primary Sidebar', 'super-awesome-theme' ),
                      Severity: Minor
                      Found in inc/library/sidebar/class-sidebar.php - About 1 hr to fix

                        Function render has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          ContainerCSS.prototype.render = function (decorated) {
                            var $container = decorated.call(this);
                        
                            var containerCssClass = this.options.get('containerCssClass') || '';
                        
                        
                        Severity: Minor
                        Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix

                          Function render has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            DropdownCSS.prototype.render = function (decorated) {
                              var $dropdown = decorated.call(this);
                          
                              var dropdownCssClass = this.options.get('dropdownCssClass') || '';
                          
                          
                          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

                                            $customizer->add_partial( $post_type->name . '_archive_content', array(
                                                Super_Awesome_Theme_Customize_Partial::PROP_SETTINGS            => array( $post_type->name . '_use_excerpt' ),
                                                Super_Awesome_Theme_Customize_Partial::PROP_SELECTOR            => '.type-' . $post_type->name . '.archive-view .entry-content',
                                                Super_Awesome_Theme_Customize_Partial::PROP_RENDER_CALLBACK     => array( $this, 'partial_entry_content' ),
                                                Super_Awesome_Theme_Customize_Partial::PROP_CONTAINER_INCLUSIVE => true,
                            Severity: Minor
                            Found in inc/library/content-types/class-content-types.php and 1 other location - About 1 hr to fix
                            inc/library/content-types/class-content-types.php on lines 425..432

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

                            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

                                            $customizer->add_partial( $post_type->name . '_entry_authorbox', array(
                                                Super_Awesome_Theme_Customize_Partial::PROP_SETTINGS            => array( $post_type->name . '_show_authorbox' ),
                                                Super_Awesome_Theme_Customize_Partial::PROP_SELECTOR            => '.type-' . $post_type->name . ' .entry-authorbox',
                                                Super_Awesome_Theme_Customize_Partial::PROP_RENDER_CALLBACK     => array( $this, 'partial_entry_authorbox' ),
                                                Super_Awesome_Theme_Customize_Partial::PROP_CONTAINER_INCLUSIVE => true,
                            Severity: Minor
                            Found in inc/library/content-types/class-content-types.php and 1 other location - About 1 hr to fix
                            inc/library/content-types/class-content-types.php on lines 394..401

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

                            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

                                            if ( ! empty( $entry_attachment_meta_settings ) ) {
                                                $customizer->add_partial( $post_type->name . '_entry_attachment_meta', array(
                                                    Super_Awesome_Theme_Customize_Partial::PROP_SETTINGS            => $entry_attachment_meta_settings,
                                                    Super_Awesome_Theme_Customize_Partial::PROP_SELECTOR            => '.type-' . $post_type->name . ' .entry-attachment-meta',
                                                    Super_Awesome_Theme_Customize_Partial::PROP_RENDER_CALLBACK     => array( $this, 'partial_entry_attachment_meta' ),
                            Severity: Minor
                            Found in inc/library/content-types/class-content-types.php and 1 other location - About 55 mins to fix
                            inc/library/content-types/class-content-types.php on lines 444..453

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

                            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