felixarntz/wpdlib

View on GitHub

Showing 156 of 160 total issues

Function _setupRepeatable has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        _setupRepeatable: function( selector ) {
            var self = WPDLibFieldManager;
            var $fields = this._getJQuery( selector );

            $fields.each(function() {
Severity: Major
Found in assets/src/js/fields.js - About 2 hrs to fix

    Function _setupRepeatable has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _setupRepeatable: function( selector ) {
                var self = WPDLibFieldManager;
                var $fields = this._getJQuery( selector );
    
                $fields.each(function() {
    Severity: Major
    Found in assets/dist/js/fields.js - About 2 hrs to fix

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

              public function parse( $val, $formatted = false ) {
                  if ( 'url' === $this->args['store'] ) {
                      $val = FieldManager::format( $val, 'url', 'input' );
                  } else {
                      $val = absint( $val );
      Severity: Minor
      Found in inc/WPDLib/FieldTypes/Media.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 get_components_results has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

              private static function get_components_results( $component_path, $current_children, $class_path_children ) {
                  $results = array();
      
                  if ( '*' == $component_path[0] ) {
                      if ( isset( $component_path[1] ) ) {
      Severity: Minor
      Found in inc/WPDLib/Components/Manager.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 validate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

              public function validate( $val = null ) {
                  if ( ! $val ) {
                      if ( 'url' === $this->args['store'] ) {
                          return '';
                      }
      Severity: Minor
      Found in inc/WPDLib/FieldTypes/Media.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 get has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

              public static function get( $component_path, $class_path = '', $single = false ) {
                  $component_path = explode( '.', $component_path, 2 );
                  $class_path = explode( '.', $class_path, 2 );
      
                  $toplevel_components = array();
      Severity: Minor
      Found in inc/WPDLib/Components/Manager.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 15 (exceeds 5 allowed). Consider refactoring.
      Open

              public function __construct( $type, $args ) {
                  $this->type = $type;
                  $this->args = wp_parse_args( $args, array(
                      'id'          => '',
                      'name'        => '',
      Severity: Minor
      Found in inc/WPDLib/FieldTypes/Base.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 add has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

              public static function add( $component ) {
                  if ( self::is_too_late() ) {
                      return new UtilError( 'too_late_component', sprintf( __( 'Components must not be added later than the %s hook.', 'wpdlib' ), '<code>init</code>' ), '', self::$current_scope );
                  }
      
      
      Severity: Minor
      Found in inc/WPDLib/Components/Manager.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 parse has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

              public function parse( $val, $formatted = false ) {
                  if ( 'coords' === $this->args['store'] ) {
                      $val = explode( '|', $val );
                      if ( 2 !== count( $val ) ) {
                          return '';
      Severity: Minor
      Found in inc/WPDLib/FieldTypes/Map.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 13 (exceeds 5 allowed). Consider refactoring.
      Open

              public function __construct( $type, $args ) {
                  $args = wp_parse_args( $args, array(
                      'repeatable' => array(),
                  ) );
                  if ( ! is_array( $args['repeatable'] ) ) {
      Severity: Minor
      Found in inc/WPDLib/FieldTypes/Repeatable.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 parse_bool has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

              private static function parse_bool( $value ) {
                  if ( is_int( $value ) ) {
                      if ( $value > 0 ) {
                          return true;
                      }
      Severity: Minor
      Found in inc/WPDLib/FieldTypes/Manager.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 init has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              init: function() {
                  var self = WPDLibFieldManager;
      
                  self.select2_args = {
                      width: 'element',
      Severity: Minor
      Found in assets/dist/js/fields.js - About 1 hr to fix

        Function init has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                init: function() {
                    var self = WPDLibFieldManager;
        
                    self.select2_args = {
                        width: 'element',
        Severity: Minor
        Found in assets/src/js/fields.js - About 1 hr to fix

          Method verify_mime_types has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  protected function verify_mime_types( $accepted_types ) {
                      if ( 'all' === $accepted_types ) {
                          return array();
                      }
          
          
          Severity: Minor
          Found in inc/WPDLib/FieldTypes/Media.php - About 1 hr to fix

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

                    public function add( $component ) {
                        if ( ComponentManager::is_too_late() ) {
                            return new UtilError( 'too_late_component', sprintf( __( 'Components must not be added later than the %s hook.', 'wpdlib' ), '<code>init</code>' ), '', ComponentManager::get_scope() );
                        }
            
            
            Severity: Minor
            Found in inc/WPDLib/Components/Base.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 display_item has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                    protected function display_item( $value, $label, $single_type, $id, $name, $current = '', $echo = true ) {
                        $option_atts = array(
                            'value'    => $value,
                            'selected' => $this->is_value_checked_or_selected( $current, $value ),
                        );
            Severity: Minor
            Found in inc/WPDLib/FieldTypes/Select.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 get_dependency_info has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                    public static function get_dependency_info( $dependency, $field = '' ) {
                        $bower_file = self::get_base_dir() . '/assets/vendor/' . $dependency . '/.bower.json';
                        if ( ! file_exists( $bower_file ) ) {
                            $bower_file = self::get_base_dir() . '/assets/vendor/' . $dependency . '/bower.json';
                        }
            Severity: Minor
            Found in inc/WPDLib/Components/Manager.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 maybe_generate_additional_item_output has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                    protected function maybe_generate_additional_item_output( $id, $data, $checked = false ) {
                        $output = $class = $label = '';
                        if ( isset( $data['image'] ) || isset( $data['color'] ) ) {
                            $output = '<div id="' . $id . '-asset"';
            
            
            Severity: Minor
            Found in inc/WPDLib/FieldTypes/Radio.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 exists has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                    public static function exists( $slug, $class, $check_slug = '' ) {
                        if ( ! isset( self::$component_finder[ $class ] ) ) {
                            self::$component_finder[ $class ] = array();
                        }
            
            
            Severity: Minor
            Found in inc/WPDLib/Components/Manager.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 display has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    public function display( $val, $echo = true ) {
                        if ( ! is_array( $val ) ) {
                            $val = array();
                        }
            
            
            Severity: Minor
            Found in inc/WPDLib/FieldTypes/Repeatable.php - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language