felixarntz/theme-boilerplate

View on GitHub

Showing 153 of 194 total issues

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

                          Function handle_sticky_elements has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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 initializeHeaderSiteBranding has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              initializeHeaderSiteBranding() {
                                  const headerSiteBranding = document.querySelector( '.site-custom-header .site-branding' );
                                  const offset             = headerSiteBranding ? ( headerSiteBranding.offsetTop ? headerSiteBranding.offsetTop : ( headerSiteBranding.offsetParent ? headerSiteBranding.offsetParent.offsetTop : 0 ) ) : 0;
                          
                                  if ( ! headerSiteBranding ) {
                          Severity: Minor
                          Found in assets/src/js/theme/sticky.js - About 55 mins 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

                          Avoid deeply nested control flow statements.
                          Open

                                              for (j = baseParts.length; j > 0; j -= 1) {
                                                  mapValue = map[baseParts.slice(0, j).join('/')];
                          
                                                  //baseName segment has  config, find if it has one for
                                                  //this name.
                          Severity: Major
                          Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 45 mins to fix

                            Function register_customize_controls_js has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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