felixarntz/theme-boilerplate

View on GitHub

Showing 153 of 194 total issues

Avoid too many return statements within this method.
Open

                    return $post_types;
Severity: Major
Found in inc/library/content-types/class-content-types.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                            return reset( $post_types );
    Severity: Major
    Found in inc/library/content-types/class-content-types.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                          return;
      Severity: Major
      Found in inc/library/content-types/class-content-types.php - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                  return matches[1];
        Severity: Major
        Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 30 mins to fix

          Function getToolbarOffset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              getToolbarOffset() {
                  const toolbar = document.getElementById( 'wpadminbar' );
          
                  if ( ! toolbar ) {
                      if ( document.body.classList.contains( 'admin-bar' ) ) {
          Severity: Minor
          Found in assets/src/js/theme/sticky.js - About 25 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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __construct( $handle, $uri, array $args = array() ) {
                  $this->handle = (string) $handle;
                  $this->uri    = (string) $uri;
          
                  $defaults = $this->get_defaults();
          Severity: Minor
          Found in inc/library/assets/class-asset.php - About 25 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 __call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __call( $method, $args ) {
                  switch ( $method ) {
                      case 'trigger_init':
                          if ( empty( $args ) ) {
                              return;
          Severity: Minor
          Found in inc/library/customizer/class-customizer.php - About 25 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 register_customize_controls_js has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function register_customize_controls_js( $assets ) {
                  $data = array(
                      'groups'           => array(),
                      'fonts'            => array(),
                      'fontFamilyGroups' => array(),
          Severity: Minor
          Found in inc/library/fonts/class-fonts.php - About 25 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 display_field_for_post has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function display_field_for_post( $field, $post = null ) {
                  if ( ! isset( $this->fields[ $field ] ) ) {
                      return false;
                  }
          
          
          Severity: Minor
          Found in inc/library/content-types/class-attachment-metadata.php - About 25 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 get_families has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function get_families() {
                  if ( null === $this->families ) {
                      $slug = $this->get_slug();
          
                      $this->families = get_transient( 'super_awesome_theme_' . SUPER_AWESOME_THEME_VERSION . '_' . $slug . '_fonts' );
          Severity: Minor
          Found in inc/library/fonts/class-webfont-api.php - About 25 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 group_webfonts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function group_webfonts( $fonts ) {
                  $font_families = $this->get_dependency( 'font_families' );
          
                  $webfonts = array();
          
          
          Severity: Minor
          Found in inc/library/fonts/class-fonts.php - About 25 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 register_customize_controls_js has a Cognitive Complexity of 6 (exceeds 5 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 25 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 super_awesome_theme_ajaxify_comments_warning has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function super_awesome_theme_ajaxify_comments_warning() {
              // 'deactivate_plugins' is not available in WordPress < 4.9.
              if ( version_compare( $GLOBALS['wp_version'], '4.9', '<' ) ) {
                  if ( ! current_user_can( 'activate_plugins' ) ) {
                      return;
          Severity: Minor
          Found in inc/plugin-compat/wp-ajaxify-comments.php - About 25 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