soderlind/read-offline

View on GitHub

Showing 35 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

        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

          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

          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

          Function epub has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

              function epub( $post ) {
          
                  $iso6391 = ( '' == get_locale() ) ? 'en' : strtolower( substr( get_locale(), 0, 2 ) ); // only ISO 639-1
                  if ( is_rtl() ) {
                      $writing_direction = EPub::DIRECTION_RIGHT_TO_LEFT;
          Severity: Minor
          Found in inc/class-read-offline-create.php - About 4 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

          Method epub has 88 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function epub( $post ) {
          
                  $iso6391 = ( '' == get_locale() ) ? 'en' : strtolower( substr( get_locale(), 0, 2 ) ); // only ISO 639-1
                  if ( is_rtl() ) {
                      $writing_direction = EPub::DIRECTION_RIGHT_TO_LEFT;
          Severity: Major
          Found in inc/class-read-offline-create.php - About 3 hrs to fix

            Function _split_content has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                private function _split_content( $html, $header ) {
            
                    $all_tags   = ( 'all' === $header );
                    $content    = array();
                    $title      = '';
            Severity: Minor
            Found in inc/class-read-offline-create.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

            Method save_as_attachment_to_post_type has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function save_as_attachment_to_post_type( $post_id, $post ) {
            
                    // Autosave, do nothing
                    if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
                            return $post_id; }
            Severity: Major
            Found in inc/class-read-offline.php - About 2 hrs to fix

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

              <?php
              
              if ( ! defined( 'FS_CHMOD_DIR' ) ) {
                  define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) );
              }
              Severity: Minor
              Found in inc/class-read-offline.php - About 2 hrs to fix

                Method parse_request has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function parse_request( $wp_query ) {
                        global $post;
                        $create_new = true;
                        if ( '1' == parent::$options['misc']['cache'] ) {
                            $create_new = false;
                Severity: Major
                Found in inc/class-read-offline-parser.php - About 2 hrs to fix

                  Function mobi has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                      function mobi( $post ) {
                  
                          $html = $this->html;
                          $mobi = new MOBI();
                          /*
                  Severity: Minor
                  Found in inc/class-read-offline-create.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 save_as_attachment_to_post_type has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function save_as_attachment_to_post_type( $post_id, $post ) {
                  
                          // Autosave, do nothing
                          if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
                                  return $post_id; }
                  Severity: Minor
                  Found in inc/class-read-offline.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

                  Method embed_post has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function embed_post( $content ) {
                          global $post;
                          if ( ! is_object( $post ) ) { return; }
                  
                          $placements = array_intersect_assoc(
                  Severity: Major
                  Found in inc/class-read-offline-ux.php - About 2 hrs to fix

                    Method mobi has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function mobi( $post ) {
                    
                            $html = $this->html;
                            $mobi = new MOBI();
                            /*
                    Severity: Minor
                    Found in inc/class-read-offline-create.php - About 2 hrs to fix

                      Method widget has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function widget($args, $instance) {
                              global $post;
                      
                              if (!is_single() && !is_page()) return;
                      
                      
                      Severity: Minor
                      Found in inc/class-read-offline-widget.php - About 1 hr to fix

                        Method _split_content has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function _split_content( $html, $header ) {
                        
                                $all_tags   = ( 'all' === $header );
                                $content    = array();
                                $title      = '';
                        Severity: Minor
                        Found in inc/class-read-offline-create.php - About 1 hr to fix

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

                              private function _create_tmp_directories() {
                                  global $wp_filesystem;
                                  if ( ! $wp_filesystem || ! is_object( $wp_filesystem ) ) {
                                      WP_Filesystem(); }
                                  if ( ! is_object( $wp_filesystem ) ) {
                          Severity: Minor
                          Found in inc/class-read-offline.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 __construct has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function __construct() {
                          
                                  self::$options = get_option( 'Read_Offline_Admin_Settings' );
                          
                                  // Only generate files for formats selected in plugin settings
                          Severity: Minor
                          Found in inc/class-read-offline.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language