Function exports
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (data, cb) => {
const config = data.config;
const plugins = data.plugins;
const isRetry = !!data.isRetry;
const url = data.url;
Function fetch
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
const fetch = () => {
const shasum = crypto.createHash('sha1');
shasum.update(url.url, 'utf8');
if (action === 'delete') {
File process.js
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Processes one url
*/
'use strict';
Function req
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
var req = client.request(httpOptions, (res) => {
let data = '';
const now = new Date();
const meta = {
date: now,
Function parse
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
const parse = (record, data, config) => {
const $ = cheerio.load(data);
// Process all selectors
_.each(config.selectors, (selector) => {
Function recursiveFindValue
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const recursiveFindValue = (node, array, attribs) => {
if (!node || node.type === 'comment') {
return 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 exports
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (data, cb) => {
const config = data.config;
const plugins = data.plugins;
const isRetry = !!data.isRetry;
const url = data.url;
- 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 recursiveFindValue
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const recursiveFindValue = (node, array, attribs) => {
if (!node || node.type === 'comment') {
return array;
}
Function trimmer
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const trimmer = (record, config) => {
const bytes = (s) => ~-encodeURI(s).split(/%..|./).length;
const jsonSize = (s) => bytes(JSON.stringify(s));
const limit = config.maxRecordSize;
const attributes = config.attributesToPop || defaultPoppedAttributes;
- 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"