Showing 17 of 22 total issues
Function exports
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (scope, logger, runners, workerLogPrefix) => (cb) => {
logger.debug('Trying to run page runners.');
if (runners.size === 0) {
logger.debug('No runners defined');
Function nextRunner
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
const nextRunner = () => {
if (done.called) {
logger.debug('Callback was called already.');
return;
}
Function exports
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (scope, logger, runners, workerLogPrefix) => (cb) => {
logger.debug('Trying to run page runners.');
if (runners.size === 0) {
logger.debug('No runners defined');
- 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 exports
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (scope, logger, finder, finderParameters, addUrl) => (cb) => {
logger.debug('Trying to run finder.');
if (!finder) {
logger.debug('No finder defined.');
cb();
CrawlKit
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class CrawlKit {
/**
* Create a CrawlKit instance
* @constructor
Function exports
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (crawlerInstance, writeResult, runnerKey, finderKey) => {
const suffix = crawlerInstance.name ? `:${crawlerInstance.name}` : '';
const prefix = `crawlkit${suffix}`;
const logger = l(prefix);
logger.info(`
Function exports
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (scope, logger, finder, finderParameters, addUrl) => (cb) => {
logger.debug('Trying to run finder.');
if (!finder) {
logger.debug('No finder defined.');
cb();
- 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 exports
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (scope, logger, addUrl, crawlerInstance) => {
const followRedirects = crawlerInstance.followRedirects;
const redirectFilter = crawlerInstance.redirectFilter;
return (cb) => {
Function exports
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (crawlerInstance, runnerKey, finderKey, prefix, pool, addUrl, processResult) => {
/**
* Gets a finder definition of a {@link CrawlKit} instance.
*
* @private
Function exports
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (logger, crawlerInstance, prefix) => {
const poolDebug = {};
const concurrency = crawlerInstance.concurrency;
const phantomParameters = crawlerInstance.phantomParameters;
const browserCookies = crawlerInstance.browserCookies;
Function doneAndNext
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const doneAndNext = callbackTimeout(once((res) => {
logger.debug(`Runner '${runnerId}' finished.`);
let err;
let result;
Function create
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
create: (callback) => {
async.waterfall([
function createPhantom(done) {
logger.debug('Creating PhantomJS instance');
driver.create({
Function phantomCallback
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function phantomCallback(err, urls) {
if (done.called) {
logger.debug('Callback alread called.');
return;
}
Function exports
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (logger, crawlerInstance, prefix) => {
const poolDebug = {};
const concurrency = crawlerInstance.concurrency;
const phantomParameters = crawlerInstance.phantomParameters;
const browserCookies = crawlerInstance.browserCookies;
- 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 onNavigationRequested
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const onNavigationRequested = (redirectedToUrl, type, willNavigate, mainFrame) => {
if (urijs(scope.url).equals(redirectedToUrl)) {
// this is the initial open of the task URL, ignore
return;
}
Function exports
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (scope, logger, crawlerInstance) => {
const phantomPageSettings = crawlerInstance.phantomPageSettings;
const followRedirects = crawlerInstance.followRedirects;
return (done) => {
Function exports
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (trace) => {
if (!(trace instanceof Array)) {
return false;
}
for (let i = 0; i < trace.length; i += 1) {
- 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"