AleksandarPredic/WordPress-Widget-Builder

View on GitHub

Showing 12 of 114 total issues

File font-awesome-icons.php has 789 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Font Awesome 4.7 icons array
 * http://fontawesome.io/cheatsheet/
 * 
Severity: Major
Found in predic-widget/lib/font-awesome-icons.php - About 1 day to fix

    Method __construct has 82 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __construct(array $atts ) {
    
            /**
             * Supported fields and their PHP classes
             */
    Severity: Major
    Found in predic-widget/class/class-predic-widget-factory.php - About 3 hrs to fix

      Function form has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public function form( $instance ) {
      
              // Widget admin form fields configuration array
              if ( ! is_array( $this->form_fields ) || empty( $this->form_fields ) ) {
                  return false;
      Severity: Minor
      Found in predic-widget/class/class-predic-widget-factory.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

      Method form has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function form( $instance ) {
      
              // Widget admin form fields configuration array
              if ( ! is_array( $this->form_fields ) || empty( $this->form_fields ) ) {
                  return false;
      Severity: Minor
      Found in predic-widget/class/class-predic-widget-factory.php - About 1 hr to fix

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

            public function update( $new_instance, $old_instance ) {
                
                if ( ! is_array( $this->form_fields ) || empty( $this->form_fields ) ) {
                    return;
                }
        Severity: Minor
        Found in predic-widget/class/class-predic-widget-factory.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 field has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function field() {
                
                $html = '';
                
                if ( empty( $this->name ) ) {

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

              private function validate_allowed_html_tags( $content ) {
                  
                  global $allowedposttags; 
          
                  $tags = array(
          Severity: Minor
          Found in predic-widget/class/class-predic-widget-factory.php - About 1 hr to fix

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

                public function field() {
                   
                    $html = '';
                    
                    if ( empty( $this->name ) ) {
            Severity: Minor
            Found in predic-widget/class/fields/class-predic-widget-select-field.php - About 1 hr to fix

              Function field has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function field() {
                     
                      $html = '';
                      
                      if ( empty( $this->name ) ) {
              Severity: Minor
              Found in predic-widget/class/fields/class-predic-widget-select-field.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 field has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function field() {
              
                      $html = '';
              
                      if ( empty( $this->name ) ) {

                Function field has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function field() {
                        
                        $html = '';
                        
                        if ( empty( $this->name ) ) {
                Severity: Minor
                Found in predic-widget/class/fields/class-predic-widget-image-uploader-field.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 fields_admin_scripts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function fields_admin_scripts() {
                
                        $method = 'admin_scripts';
                
                        foreach ( $this->field_php_classes as $class ) {
                Severity: Minor
                Found in predic-widget/class/class-predic-widget-factory.php - About 35 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