vampireneo/Book

View on GitHub

Showing 24 of 47 total issues

File isbn.js has 2055 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//
// isbn.js
//
// The MIT License
// Copyright (c) 2007, 2010 hetappi <hetappi.pm (a) gmail.com>
Severity: Major
Found in utility/isbn.js - About 5 days to fix

    Function createServer has 121 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var createServer = function(portNo) {
      var app = express();
      app.locals.pretty = true;
      app.set('views', __dirname + '/views');
      app.set('view engine', 'pug');
    Severity: Major
    Found in main.js - About 4 hrs to fix

      Function getByISBN has 101 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.getByISBN = function(pISBN) {
        var domain = 'http://search.books.com.tw';
        var searchUrl = '/exep/prod_search.php?cat=BKA&key=';
        var bookObj = {};
        var deferred = Q.defer();
      Severity: Major
      Found in bookParser/Books.js - About 4 hrs to fix

        Function getByISBN has 95 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.getByISBN = function(pISBN) {
          var domain = 'http://www.eslite.com/';
          var searchUrl = 'Search_BW.aspx?query=';
          var bookObj = {};
          var deferred = Q.defer();
        Severity: Major
        Found in bookParser/Eslite.js - About 3 hrs to fix

          Function merge has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = function merge(target, src) {
            var array = Array.isArray(src) || Array.isArray(target);
            var dst = (array && []) || {};
          
            if (array) {
          Severity: Minor
          Found in utility/merge.js - About 3 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 getByISBN has 77 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.getByISBN = function(pISBN) {
            var domain = 'http://www.hkbookcity.com/';
            var searchUrl = 'searchbook2.php?startnum=1&key=isbn&keyword=';
            var bookObj = {};
            var deferred = Q.defer();
          Severity: Major
          Found in bookParser/HkBookCity.js - About 3 hrs to fix

            Function getByISBN has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.getByISBN = function(pISBN) {
              var domain = 'http://m.kingstone.com.tw';
              var searchUrl = '/search.asp?q=';
              var bookObj = {};
              var deferred = Q.defer();
            Severity: Major
            Found in bookParser/Kingstone.js - About 2 hrs to fix

              Function getByISBN has 62 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports.getByISBN = function(pISBN) {
                var domain = 'http://www.jointpublishing.com';
                var searchUrl =
                  '/Special-Page/search-result.aspx?searchmode=anyword&searchtext=';
                var bookObj = {};
              Severity: Major
              Found in bookParser/JointPublishing.js - About 2 hrs to fix

                Function merge has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function merge(target, src) {
                  var array = Array.isArray(src) || Array.isArray(target);
                  var dst = (array && []) || {};
                
                  if (array) {
                Severity: Major
                Found in utility/merge.js - About 2 hrs to fix

                  Function getByISBN has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  exports.getByISBN = function(pISBN) {
                    var searchUrl = 'http://www.cp1897.com.hk/product_info.php?BookId=';
                    var bookObj = {};
                    var deferred = Q.defer();
                  
                  
                  Severity: Major
                  Found in bookParser/CommercialPress.js - About 2 hrs to fix

                    Function parse has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        parse: function(val) {
                          var ret;
                          // correct for misplaced hyphens
                          // val = val.replace(/ -/,'');
                          ret = val.match(/^\d{9}[\dX]$/) ?
                    Severity: Minor
                    Found in utility/isbn.js - About 2 hrs to fix

                      Function fill has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          fill: function(codes) {
                            var rec, prefix, ck10, ck13, parts13, parts10;
                      
                            if (!codes) {
                              return null;
                      Severity: Minor
                      Found in utility/isbn.js - About 1 hr to fix

                        Avoid deeply nested control flow statements.
                        Open

                                      if (text.length !== 2) {
                                        continue;
                                      }
                        Severity: Major
                        Found in bookParser/Books.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                        if (text2.length !== 2) {
                                          continue;
                                        }
                          Severity: Major
                          Found in bookParser/Books.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                            if (page !== '0') {
                                              bookObj.Pages = page;
                                            }
                            Severity: Major
                            Found in bookParser/JointPublishing.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                            switch (title) {
                                              case 'ISBN':
                                                bookObj.ISBN = content;
                                                break;
                                              case '出版社':
                              Severity: Major
                              Found in bookParser/Kingstone.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                              switch (title2) {
                                                case 'ISBN':
                                                  bookObj.ISBN = content2;
                                                  break;
                                                case '叢書系列':
                                Severity: Major
                                Found in bookParser/Books.js - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                              if (dst[key].indexOf(src[key]) === -1) {
                                                dst[key].push(src[key]);
                                              }
                                  Severity: Major
                                  Found in utility/merge.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                  switch (title) {
                                                    //原文作者
                                                    //譯者
                                                    case '出版社':
                                                      bookObj.Publisher = content;
                                    Severity: Major
                                    Found in bookParser/Books.js - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                    if (text.length !== 2) {
                                                      continue;
                                                    }
                                      Severity: Major
                                      Found in bookParser/Kingstone.js - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language