soderlind/read-offline

View on GitHub

Showing 1,262 of 1,262 total issues

There must be no space before the colon in a CASE statement
Open

            case 3 :
Severity: Minor
Found in inc/class-read-offline.php by phpcodesniffer

Tabs must be used to indent lines; spaces are not allowed
Open

            break;
Severity: Minor
Found in inc/class-read-offline.php by phpcodesniffer

Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
Open

        $the_post = get_post( $post_id ); //Gets post ID
Severity: Minor
Found in inc/class-read-offline.php by phpcodesniffer

Tabs must be used to indent lines; spaces are not allowed
Open

                return $post_id; }
Severity: Minor
Found in inc/class-read-offline.php by phpcodesniffer

Tabs must be used to indent lines; spaces are not allowed
Open

                        $msg[] = '<strong>Read Offline</strong>: ';
Severity: Minor
Found in inc/class-read-offline.php by phpcodesniffer

Tabs must be used to indent lines; spaces are not allowed
Open

        foreach ( self::$mime_types as $file_extention => $mime_type ) {
Severity: Minor
Found in inc/class-read-offline.php by phpcodesniffer

Concat operator must be surrounded by a single space
Open

            header( 'Last-Modified: '.gmdate( 'D, d M Y H:i:s' ).' GMT' );
Severity: Minor
Found in inc/class-read-offline.php by phpcodesniffer

Concat operator must be surrounded by a single space
Open

            header( 'Last-Modified: '.gmdate( 'D, d M Y H:i:s' ).' GMT' );
Severity: Minor
Found in inc/class-read-offline.php by phpcodesniffer

Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
Open

            $post_id = $wp_query->query_vars['read_offline_id'];

Space found before comma in function call
Open

                if ( true !== $wp_filesystem->rmdir( $directory , true ) ) {
Severity: Minor
Found in inc/class-read-offline.php by phpcodesniffer

Tabs must be used to indent lines; spaces are not allowed
Open

                            $msg[] = '<strong>Read Offline</strong>: ';
Severity: Minor
Found in inc/class-read-offline.php by phpcodesniffer

Expected 1 space after comma in function call; 13 found
Open

        add_filter( 'admin_init',             array( $this, 'flush_rewrite_rules' ) );

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        if ( ! is_object( $wp_filesystem ) ) {
            wp_die( 'WP_Filesystem Error:' . print_r( $wp_filesystem,true ) ); }
Severity: Minor
Found in inc/class-read-offline.php and 1 other location - About 30 mins to fix
inc/class-read-offline.php on lines 281..282

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

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        if ( ! is_object( $wp_filesystem ) ) {
            wp_die( 'WP_Filesystem Error:' . print_r( $wp_filesystem,true ) ); }
Severity: Minor
Found in inc/class-read-offline.php and 1 other location - About 30 mins to fix
inc/class-read-offline.php on lines 309..310

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

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

Avoid too many return statements within this method.
Open

                return $post_id; }
Severity: Major
Found in inc/class-read-offline.php - About 30 mins to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                , ('print' == $type) ? sprintf( '<iframe style="display:none;" id="read_offline_print" name="read_offline_print" src="%s"></iframe>',parent::query_url( $post->ID,$post->post_name,$type ) ) : ''
    Severity: Minor
    Found in inc/class-read-offline-shortcode.php and 1 other location - About 30 mins to fix
    inc/class-read-offline-ux.php on lines 86..86

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

    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

    Avoid too many return statements within this method.
    Open

                    return add_action( 'admin_notices', function() use ( $error ) {
                            $msg[] = '<div class="error"><p>';
                            $msg[] = '<strong>Read Offline</strong>: ';
                            $msg[] = sprintf( __( 'wp_upload_bits failed,  error: "<strong>%s</strong>','read-offline' ), $error );
                            $msg[] = '</p></div>';
    Severity: Major
    Found in inc/class-read-offline.php - About 30 mins to fix

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

                      , ('print' == $type) ? sprintf( '<iframe style="display:none;" id="read_offline_print" name="read_offline_print" src="%s"></iframe>',parent::query_url( $post->ID,$post->post_name,$type ) ) : ''
      Severity: Minor
      Found in inc/class-read-offline-ux.php and 1 other location - About 30 mins to fix
      inc/class-read-offline-shortcode.php on lines 97..97

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

      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

              } else {
                  return sprintf('%s/index.php?read_offline_id=%s&read_offline_name=%s&&read_offline_format=%s%s',
                      site_url(),$post_id,$name,$format,
                      ( $refresh ) ? '&read-offline-code=' . $code  : ''
                  );
      Severity: Minor
      Found in inc/class-read-offline.php and 1 other location - About 30 mins to fix
      inc/class-read-offline.php on lines 72..82

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

      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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

                  $attachments = new WP_Query( array(
                      'post_type'      => 'attachment',
                      'post_status'    => 'any',
                      'posts_per_page' => 500,
                      'post_parent'    => $post_id,
      Severity: Minor
      Found in inc/class-read-offline.php and 1 other location - About 30 mins to fix
      inc/class-read-offline-parser.php on lines 67..73

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

      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

      Severity
      Category
      Status
      Source
      Language