felixarntz/theme-boilerplate

View on GitHub

Showing 153 of 194 total issues

Function register_customize_partial has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function register_customize_partial( $customizer ) {
        $partial_fonts     = array();
        $has_default_group = false;
        foreach ( $this->fonts as $id => $font ) {
            if ( $font->get_prop( Super_Awesome_Theme_Font::PROP_LIVE_PREVIEW ) ) {
Severity: Minor
Found in inc/library/fonts/class-fonts.php - About 2 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 _positionDropdown has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  AttachBody.prototype._positionDropdown = function () {
    var $window = $(window);

    var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
    var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
Severity: Major
Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 2 hrs to fix

    Method __call has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __call( $method, $args ) {
            switch ( $method ) {
                case 'register_settings':
                case 'register_customize_partials':
                case 'register_customize_controls_js':
    Severity: Major
    Found in inc/library/content-types/class-content-types.php - About 2 hrs to fix

      Consider simplifying this complex logical expression.
      Open

      var S2;(function () { if (!S2 || !S2.requirejs) {
      if (!S2) { S2 = {}; } else { require = S2; }
      /**
       * @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
       * Released under MIT license, http://github.com/requirejs/almond/LICENSE
      Severity: Critical
      Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 2 hrs to fix

        Method add_control has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function add_control( $setting_id, $control_args = array() ) {
                if ( ! isset( $this->wp_customize ) ) {
                    throw Super_Awesome_Theme_Customizer_Not_Loaded_Exception::from_method_and_id( __METHOD__, $setting_id );
                }
        
        
        Severity: Minor
        Found in inc/library/customizer/class-customizer.php - About 1 hr to fix

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

            AjaxAdapter.prototype.query = function (params, callback) {
              var matches = [];
              var self = this;
          
              if (this._request != null) {
          Severity: Minor
          Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix

            Function add_field has a Cognitive Complexity of 15 (exceeds 5 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

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

                addRemoveStickyContainer( selector, location, remove ) {
                    const container = document.querySelector( selector );
                    let selectorsHandle, containersHandle, offsetsHandle, exists;
                    if ( 'top' === location ) {
                        selectorsHandle  = 'stickToTopSelectors';
            Severity: Minor
            Found in assets/src/js/theme/sticky.js - 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 _registerDomEvents has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              Select2.prototype._registerDomEvents = function () {
                var self = this;
            
                this.$element.on('change.select2', function () {
                  self.dataAdapter.current(function (data) {
            Severity: Minor
            Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix

              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

                        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
                                Severity
                                Category
                                Status
                                Source
                                Language