soderlind/read-offline

View on GitHub

Showing 1,262 of 1,262 total issues

Method setUp has 1052 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function setUp() {
        // Root menu
        $this->setRootMenuPage(
            'Read Offline',    // specify the name of the page group
            'dashicons-book'
Severity: Major
Found in inc/class-read-offline-admin-settings.php - About 5 days to fix

    File class-read-offline-admin-settings.php has 1134 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    
    // Include the library
    if ( ! class_exists( 'AdminPageFramework' ) ) {
    Severity: Major
    Found in inc/class-read-offline-admin-settings.php - About 2 days to fix

      File class-read-offline-create.php has 789 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      use PHPePub\Core\EPub;
      use PHPePub\Core\EPubChapterSplitter;
      use PHPePub\Core\Logger;
      use PHPePub\Core\Structure\OPF\DublinCore;
      Severity: Major
      Found in inc/class-read-offline-create.php - About 1 day to fix

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

                $this->addSettingFields(
                    array(
                        'field_id'         => 'add_toc',
                        'section_id'       => 'mobi',
                        'title'            => __( 'Table of Contents', 'read-offline' ),
        Severity: Major
        Found in inc/class-read-offline-admin-settings.php and 1 other location - About 1 day to fix
        inc/class-read-offline-admin-settings.php on lines 1038..1082

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

        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

                $this->addSettingFields(
                    array(  // Single set of radio buttons
                        'field_id'         => 'add_toc',
                        'section_id'       => 'epub',
                        'title'            => __( 'Table of Contents', 'read-offline' ),
        Severity: Major
        Found in inc/class-read-offline-admin-settings.php and 1 other location - About 1 day to fix
        inc/class-read-offline-admin-settings.php on lines 1166..1210

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

        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

        Method pdf has 326 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function pdf( $post ) {
        
                $html = $this->html;
        
                define( '_MPDF_TEMP_PATH', READOFFLINE_CACHE . '/tmp/' );
        Severity: Major
        Found in inc/class-read-offline-create.php - About 1 day to fix

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

                          $pdf->DefFooterByName(
                              'pdffooter',
                              array(
                                  'L'    => array(
                                      'content'     => ( '0' != parent::$options['pdf_footer']['default_footer'][0] ) ? $this->_header_footer( $post, parent::$options['pdf_footer']['default_footer'][0] ) : '',
          Severity: Major
          Found in inc/class-read-offline-create.php and 1 other location - About 1 day to fix
          inc/class-read-offline-create.php on lines 503..529

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

          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

                          $pdf->DefHeaderByName(
                              'pdfheader',
                              array(
                                  'L'    => array(
                                      'content'     => ( '0' != parent::$options['pdf_header']['default_header'][0] ) ? $this->_header_footer( $post, parent::$options['pdf_header']['default_header'][0] ) : '',
          Severity: Major
          Found in inc/class-read-offline-create.php and 1 other location - About 1 day to fix
          inc/class-read-offline-create.php on lines 548..574

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

          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

                          array(
                              'label'        => array(
                                  '0'                => __( '-- Center --', 'read-offline' ),
                                  'author'               => __( 'Author', 'read-offline' ),
                                  'document_title'       => __( 'Document Title', 'read-offline' ),
          Severity: Major
          Found in inc/class-read-offline-admin-settings.php and 1 other location - About 6 hrs to fix
          inc/class-read-offline-admin-settings.php on lines 704..722

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

          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

                          array(
                              'label'        => array(
                                  '0'                => __( '-- Center --', 'read-offline' ),
                                  'author'           => __( 'Author', 'read-offline' ),
                                  'document_title'   => __( 'Document Title', 'read-offline' ),
          Severity: Major
          Found in inc/class-read-offline-admin-settings.php and 1 other location - About 6 hrs to fix
          inc/class-read-offline-admin-settings.php on lines 590..608

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

          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

          Function pdf has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
          Open

              function pdf( $post ) {
          
                  $html = $this->html;
          
                  define( '_MPDF_TEMP_PATH', READOFFLINE_CACHE . '/tmp/' );
          Severity: Minor
          Found in inc/class-read-offline-create.php - About 6 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

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

                      array(
                          'field_id'         => 'custom_footer',
                          'section_id'       => 'pdf_footer',
                          'title'            => __( 'Custom Footer', 'read-offline' ),
                          'type'             => 'ace',
          Severity: Major
          Found in inc/class-read-offline-admin-settings.php and 1 other location - About 6 hrs to fix
          inc/class-read-offline-admin-settings.php on lines 630..646

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

          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

                      array(
                          'field_id'         => 'custom_header',
                          'section_id'       => 'pdf_header',
                          'title'            => __( 'Custom Header', 'read-offline' ),
                          'type'             => 'ace',
          Severity: Major
          Found in inc/class-read-offline-admin-settings.php and 1 other location - About 6 hrs to fix
          inc/class-read-offline-admin-settings.php on lines 744..760

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

          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

          Function parse_request has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
          Open

              function parse_request( $wp_query ) {
                  global $post;
                  $create_new = true;
                  if ( '1' == parent::$options['misc']['cache'] ) {
                      $create_new = false;
          Severity: Minor
          Found in inc/class-read-offline-parser.php - About 6 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

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

                          array(
                              'label'        => array(
                                '0'                  => __( '-- Right --', 'read-offline' ),
                                'author'               => __( 'Author', 'read-offline' ),
                                'document_title'       => __( 'Document Title', 'read-offline' ),
          Severity: Major
          Found in inc/class-read-offline-admin-settings.php and 1 other location - About 5 hrs to fix
          inc/class-read-offline-admin-settings.php on lines 723..741

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

          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

                          array(
                              'label'        => array(
                                  '0'                => __( '-- Right --', 'read-offline' ),
                                  'author'           => __( 'Author', 'read-offline' ),
                                  'document_title'   => __( 'Document Title', 'read-offline' ),
          Severity: Major
          Found in inc/class-read-offline-admin-settings.php and 1 other location - About 5 hrs to fix
          inc/class-read-offline-admin-settings.php on lines 609..627

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

          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 5 locations. Consider refactoring.
          Open

                      array(
                          'field_id'         => 'art',
                          'section_id'       => 'epub',
                          'title'            => __( 'Cover Art', 'read-offline' ),
                          'type'             => 'revealer',
          Severity: Major
          Found in inc/class-read-offline-admin-settings.php and 4 other locations - About 4 hrs to fix
          inc/class-read-offline-admin-settings.php on lines 792..810
          inc/class-read-offline-admin-settings.php on lines 828..846
          inc/class-read-offline-admin-settings.php on lines 899..917
          inc/class-read-offline-admin-settings.php on lines 1327..1345

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

          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 3 locations. Consider refactoring.
          Open

                      array(
                          'field_id'         => 'header',
                          'section_id'       => 'pdf_header',
                          'title'            => __( 'Header', 'read-offline' ),
                          //'description'      => __( 'This is multiple sets of drop down list.', 'read-offline' ),
          Severity: Major
          Found in inc/class-read-offline-admin-settings.php and 2 other locations - About 4 hrs to fix
          inc/class-read-offline-admin-settings.php on lines 318..337
          inc/class-read-offline-admin-settings.php on lines 658..678

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

          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 5 locations. Consider refactoring.
          Open

                      array(  // Single set of radio buttons
                          'field_id'         => 'custom_css',
                          'section_id'       => 'pdf_css',
                          'title'            => __( 'Custom CSS', 'read-offline' ),
                          //'description'      => __( 'Choose one from the radio buttons.',
          Severity: Major
          Found in inc/class-read-offline-admin-settings.php and 4 other locations - About 4 hrs to fix
          inc/class-read-offline-admin-settings.php on lines 792..810
          inc/class-read-offline-admin-settings.php on lines 899..917
          inc/class-read-offline-admin-settings.php on lines 1085..1103
          inc/class-read-offline-admin-settings.php on lines 1327..1345

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

          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 5 locations. Consider refactoring.
          Open

                      array(  // Single set of radio buttons
                          'field_id'         => 'style',
                          'section_id'       => 'print',
                          'title'            => __( 'Print Style', 'read-offline' ),
                          //'description'      => __( 'Choose one from the radio buttons.', 'read-offline' ),
          Severity: Major
          Found in inc/class-read-offline-admin-settings.php and 4 other locations - About 4 hrs to fix
          inc/class-read-offline-admin-settings.php on lines 792..810
          inc/class-read-offline-admin-settings.php on lines 828..846
          inc/class-read-offline-admin-settings.php on lines 899..917
          inc/class-read-offline-admin-settings.php on lines 1085..1103

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

          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