felixarntz/theme-boilerplate

View on GitHub

Showing 194 of 194 total issues

Method print_base_color_style_footer has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function print_base_color_style_footer() {
        $footer_text_color       = $this->get( 'footer_text_color' );
        $footer_link_color       = $this->get( 'footer_link_color' );
        $footer_link_focus_color = $this->util()->darken_color( $footer_link_color, 25 );
        $footer_background_color = $this->get( 'footer_background_color' );
Severity: Minor
Found in inc/library/colors/class-colors.php - About 1 hr to fix

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

    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 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Method print_base_color_style_header has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function print_base_color_style_header() {
              $header_text_color       = $this->get( 'header_textcolor' );
              $header_link_color       = $this->get( 'header_link_color' );
              $header_link_focus_color = $this->util()->darken_color( $header_link_color, 25 );
              $header_background_color = $this->get( 'header_background_color' );
      Severity: Minor
      Found in inc/library/colors/class-colors.php - About 1 hr to fix

        Function _resolveWidth has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          Select2.prototype._resolveWidth = function ($element, method) {
            var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
        
            if (method == 'resolve') {
              var styleWidth = this._resolveWidth($element, 'style');
        Severity: Minor
        Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix

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

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

            Function tokenizer has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
                var separators = options.get('tokenSeparators') || [];
                var term = params.term;
                var i = 0;
            
            
            Severity: Minor
            Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix

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

                Method get_svg has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function get_svg( $icon, array $args = array() ) {
                        $this->needs_svg = true;
                
                        $args = wp_parse_args( $args, array(
                            'title'    => '',
                Severity: Minor
                Found in inc/library/icons/class-icons.php - About 1 hr to fix

                  Function destroy has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    Select2.prototype.destroy = function () {
                      this.$container.remove();
                  
                      if (this.$element[0].detachEvent) {
                        this.$element[0].detachEvent('onpropertychange', this._syncA);
                  Severity: Minor
                  Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix

                    Method register_base_colors_general has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function register_base_colors_general() {
                            $this->register_group( 'general_colors', __( 'General Colors', 'super-awesome-theme' ) );
                    
                            $this->register_color( new Super_Awesome_Theme_Color( 'text_color', array(
                                Super_Awesome_Theme_Color::PROP_GROUP   => 'general_colors',
                    Severity: Minor
                    Found in inc/library/colors/class-colors.php - About 1 hr to fix

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

                        Tokenizer.prototype.query = function (decorated, params, callback) {
                          var self = this;
                      
                          function createAndSelect (data) {
                            // Normalize the data object so we can use it for checks
                      Severity: Minor
                      Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix

                        Method get_fonts_url has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function get_fonts_url( array $fonts ) {
                                $font_families = array();
                        
                                foreach ( $fonts as $font ) {
                                    if ( ! $font['family'] instanceof Super_Awesome_Theme_Webfont_Family ) {
                        Severity: Minor
                        Found in inc/library/fonts/class-google-webfont-api.php - About 1 hr to fix

                          Function convertToOptions has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            ArrayAdapter.prototype.convertToOptions = function (data) {
                              var self = this;
                          
                              var $existing = this.$element.find('option');
                              var existingIds = $existing.map(function () {
                          Severity: Minor
                          Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix

                            Method register_customize_controls_js has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected function register_customize_controls_js( $assets ) {
                                    $data = array(
                                        'groups'            => array(),
                                        'colors'            => array(),
                                        'footerWidgetAreas' => super_awesome_theme( 'footer_widget_areas' )->get_widget_area_names(),
                            Severity: Minor
                            Found in inc/library/colors/class-colors.php - About 1 hr to fix

                              Function option has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                SelectAdapter.prototype.option = function (data) {
                                  var option;
                              
                                  if (data.children) {
                                    option = document.createElement('optgroup');
                              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

                                        if ( ! empty( $button_primary_text_color ) && ! empty( $button_primary_background_color ) && ! empty( $button_primary_background_focus_color ) ) {
                                            ?>
                                            button.button-primary,
                                            input[type="button"].button-primary,
                                            input[type="reset"].button-primary,
                                Severity: Major
                                Found in inc/library/colors/class-colors.php and 1 other location - About 1 hr to fix
                                inc/library/colors/class-colors.php on lines 747..782

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

                                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( $button_text_color ) && ! empty( $button_background_color ) && ! empty( $button_background_focus_color ) ) {
                                            ?>
                                            button,
                                            input[type="button"],
                                            input[type="reset"],
                                Severity: Major
                                Found in inc/library/colors/class-colors.php and 1 other location - About 1 hr to fix
                                inc/library/colors/class-colors.php on lines 784..819

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

                                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

                                Method content_template has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function content_template() {
                                        ?>
                                        <# var defaultValue = '#RRGGBB', defaultValueAttr = '',
                                            isHueSlider = data.mode === 'hue';
                                        if ( data.defaultValue && _.isString( data.defaultValue ) && ! isHueSlider ) {
                                Severity: Minor
                                Found in inc/library/fonts/class-font-customize-control.php - About 1 hr to fix

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

                                    Select2.prototype._syncSubtree = function (evt, mutations) {
                                      var changed = false;
                                      var self = this;
                                  
                                      // Ignore any mutation events raised for elements that aren't options or
                                  Severity: Minor
                                  Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language