felixarntz/theme-boilerplate

View on GitHub

Showing 153 of 194 total issues

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

    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

        Method render_comment has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function render_comment( $comment = null, $args = array(), $depth = 0, $close = false ) {
                $reset_global_comment = false;
        
                if ( ! isset( $GLOBALS['comment'] ) ) {
                    if ( null === $comment ) {
        Severity: Minor
        Found in inc/library/comments/class-comments.php - About 1 hr to fix

          Function checkStickyContainers has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              checkStickyContainers() {
                  const pageWrap      = this.pageWrap;
                  const topOffsets    = this.stickToTopOffsets;
                  const bottomOffsets = this.stickToBottomOffsets;
          
          
          Severity: Minor
          Found in assets/src/js/theme/sticky.js - About 1 hr to fix

            Method register_main_assets has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function register_main_assets() {
                    $this->register_asset( new Super_Awesome_Theme_Script(
                        'wp-i18n',
                        get_theme_file_uri( '/assets/dist/js/wp-i18n.js' ),
                        array(
            Severity: Minor
            Found in inc/library/assets/class-assets.php - About 1 hr to fix

              Function addRemoveStickyContainer has 37 lines of code (exceeds 25 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

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

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

                    Function ready has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            ready: function() {
                                const value         = this.setting.get();
                                const $familySelect = this.container.find( '[data-setting-property="family"]' );
                                const $weightSelect = this.container.find( '[data-setting-property="weight"]' );
                                const $sizeInput    = this.container.find( '[data-setting-property="size"]' );
                    Severity: Minor
                    Found in assets/src/js/fonts.customize-controls.js - About 1 hr to fix

                      Function handle_ajax_comment has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function handle_ajax_comment( $id, $status ) {
                              if ( empty( $_GET['is_ajax'] ) || 'true' !== $_GET['is_ajax'] ) {
                                  return;
                              }
                      
                      
                      Severity: Minor
                      Found in inc/library/comments/class-comments.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 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        Method __construct has 34 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/fonts/class-font.php - About 1 hr to fix

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

                              public function __call( $method, $args ) {
                                  switch ( $method ) {
                                      case 'ensure_inline_widgets_whitelist':
                                      case 'register_customize_controls':
                                      case 'register_customize_controls_js':
                          Severity: Minor
                          Found in inc/library/widgets/class-widgets.php - About 1 hr to fix

                            Function wrapper has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                function wrapper (obj, child) {
                                  var data = obj.results;
                            
                                  for (var i = 0; i < data.length; i++) {
                                    var option = data[i];
                            Severity: Minor
                            Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix

                              Method render has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function render( array $instance ) {
                                      $login_url      = '';
                                      $login_label    = '';
                                      $register_url   = '';
                                      $register_label = '';
                              Severity: Minor
                              Found in inc/library/widgets/class-login-links-widget.php - About 1 hr to fix

                                Function handleSubmission has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        function handleSubmission( e ) {
                                            const formUrl = commentForm.getAttribute( 'action' ) + ( commentForm.getAttribute( 'action' ).indexOf( '?' ) > -1 ? '&' : '?' ) + 'is_ajax=true';
                                            const fields = commentForm.querySelectorAll( 'input, textarea' );
                                
                                            let hasError = false;
                                Severity: Minor
                                Found in assets/src/js/theme/comment-form.js - About 1 hr to fix

                                  Method register_settings has 32 lines of code (exceeds 25 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
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language