Showing 24 of 47 total issues
File isbn.js
has 2055 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
//
// isbn.js
//
// The MIT License
// Copyright (c) 2007, 2010 hetappi <hetappi.pm (a) gmail.com>
Function createServer
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var createServer = function(portNo) {
var app = express();
app.locals.pretty = true;
app.set('views', __dirname + '/views');
app.set('view engine', 'pug');
Function getByISBN
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
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();
Function getByISBN
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.getByISBN = function(pISBN) {
var domain = 'http://www.eslite.com/';
var searchUrl = 'Search_BW.aspx?query=';
var bookObj = {};
var deferred = Q.defer();
Function merge
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function merge(target, src) {
var array = Array.isArray(src) || Array.isArray(target);
var dst = (array && []) || {};
if (array) {
- Read upRead up
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
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();
Function getByISBN
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.getByISBN = function(pISBN) {
var domain = 'http://m.kingstone.com.tw';
var searchUrl = '/search.asp?q=';
var bookObj = {};
var deferred = Q.defer();
Function getByISBN
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.getByISBN = function(pISBN) {
var domain = 'http://www.jointpublishing.com';
var searchUrl =
'/Special-Page/search-result.aspx?searchmode=anyword&searchtext=';
var bookObj = {};
Function merge
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function merge(target, src) {
var array = Array.isArray(src) || Array.isArray(target);
var dst = (array && []) || {};
if (array) {
Function getByISBN
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.getByISBN = function(pISBN) {
var searchUrl = 'http://www.cp1897.com.hk/product_info.php?BookId=';
var bookObj = {};
var deferred = Q.defer();
Function parse
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
parse: function(val) {
var ret;
// correct for misplaced hyphens
// val = val.replace(/ -/,'');
ret = val.match(/^\d{9}[\dX]$/) ?
Function fill
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
fill: function(codes) {
var rec, prefix, ck10, ck13, parts13, parts10;
if (!codes) {
return null;
Avoid deeply nested control flow statements. Open
Open
if (text.length !== 2) {
continue;
}
Avoid deeply nested control flow statements. Open
Open
if (text2.length !== 2) {
continue;
}
Avoid deeply nested control flow statements. Open
Open
if (page !== '0') {
bookObj.Pages = page;
}
Avoid deeply nested control flow statements. Open
Open
switch (title) {
case 'ISBN':
bookObj.ISBN = content;
break;
case '出版社':
Avoid deeply nested control flow statements. Open
Open
switch (title2) {
case 'ISBN':
bookObj.ISBN = content2;
break;
case '叢書系列':
Avoid deeply nested control flow statements. Open
Open
if (dst[key].indexOf(src[key]) === -1) {
dst[key].push(src[key]);
}
Avoid deeply nested control flow statements. Open
Open
switch (title) {
//原文作者
//譯者
case '出版社':
bookObj.Publisher = content;
Avoid deeply nested control flow statements. Open
Open
if (text.length !== 2) {
continue;
}