felixarntz/theme-boilerplate

View on GitHub

Showing 194 of 194 total issues

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

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

            protected function default_parsing_callback( $value ) {
                $value = (array) $value;
        
                foreach ( $this->properties_settings as $setting ) {
                    $id             = $setting->get_prop( Super_Awesome_Theme_Setting::PROP_ID );
        Severity: Major
        Found in inc/library/settings/class-object-setting.php and 1 other location - About 1 hr to fix
        inc/library/settings/class-object-setting.php on lines 72..84

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

        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 default_sanitization_callback( $value ) {
                $value = (array) $value;
        
                foreach ( $this->properties_settings as $setting ) {
                    $id             = $setting->get_prop( Super_Awesome_Theme_Setting::PROP_ID );
        Severity: Major
        Found in inc/library/settings/class-object-setting.php and 1 other location - About 1 hr to fix
        inc/library/settings/class-object-setting.php on lines 94..106

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

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

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

                    protected function register_settings() {
                        $settings = $this->get_dependency( 'settings' );
                
                        $settings->register_setting( new Super_Awesome_Theme_Enum_String_Setting(
                            'branding_location',
                Severity: Major
                Found in inc/library/custom-header/class-custom-header.php and 1 other location - About 1 hr to fix
                inc/library/navbar/class-navbar.php on lines 165..183

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

                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_settings() {
                        $settings = $this->get_dependency( 'settings' );
                
                        $settings->register_setting( new Super_Awesome_Theme_Enum_String_Setting(
                            'navbar_position',
                Severity: Major
                Found in inc/library/navbar/class-navbar.php and 1 other location - About 1 hr to fix
                inc/library/custom-header/class-custom-header.php on lines 161..179

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

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

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

                                SelectAdapter.prototype.item = function ($option) {
                                  var data = {};
                              
                                  data = $.data($option[0], 'data');
                              
                              
                              Severity: Minor
                              Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language