felixarntz/site-icon-extended

View on GitHub

Showing 8 of 10 total issues

Method get_sizes has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        protected function get_sizes( $mode = '' ) {
            $sizes = array(
                'default'            => array(
                    16,
                    32,
Severity: Minor
Found in inc/WPSIE/App.php - About 1 hr to fix

    Function generate_ico_file has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

            private function generate_ico_file( $attachment_id, $source_file ) {
                $destination_file = explode( '.', $source_file );
                $destination_file[ count( $destination_file ) - 1 ] = 'ico';
                $destination_file = implode( '.', $destination_file );
    
    
    Severity: Minor
    Found in inc/WPSIE/ICOHandler.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_ico_attachment_check has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

            public function maybe_generate_ico_attachment_check() {
                if ( ! current_user_can( 'upload_files' ) ) {
                    return;
                }
    
    
    Severity: Minor
    Found in inc/WPSIE/ICOHandler.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 customize_register_pinned_tab_icon has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public function customize_register_pinned_tab_icon( $wp_customize ) {
                $site_icon_control = $wp_customize->get_control( 'site_icon' );
                if ( ! $site_icon_control ) {
                    return;
                }
    Severity: Minor
    Found in inc/WPSIE/PinnedTabIconHandler.php - About 1 hr to fix

      Function maybe_generate_ico_attachment has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              private function maybe_generate_ico_attachment( $attachment_id ) {
                  $attachment_context = get_post_meta( $attachment_id, '_wp_attachment_context', true );
      
                  if ( 'site-icon' !== $attachment_context ) {
                      return false;
      Severity: Minor
      Found in inc/WPSIE/ICOHandler.php - About 45 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_browserconfig has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              private function get_browserconfig() {
                  $content = '<browserconfig>' . "\n";
                  $content .= '<msapplication>' . "\n";
                  $content .= '<tile>' . "\n";
      
      
      Severity: Minor
      Found in inc/WPSIE/XMLHandler.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

      Avoid too many return statements within this method.
      Open

                  return true;
      Severity: Major
      Found in inc/WPSIE/ICOHandler.php - About 30 mins to fix

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

                public function maybe_delete_ico_file( $attachment_id ) {
                    $site_icon_id = get_option( 'site_icon' );
                    $ico_id = get_post_meta( $site_icon_id, 'wpsie_ico_id', true );
        
                    if ( $site_icon_id && $attachment_id == $site_icon_id ) {
        Severity: Minor
        Found in inc/WPSIE/ICOHandler.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