Showing 8 of 342 total issues
Function collect
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
Open
collect() {
// Preserve our reference to 'this'
const self = this;
// Get a list of app IDs
const appIds = _.keys(self.apps);
- 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 collect
has 135 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
collect() {
// Preserve our reference to 'this'
const self = this;
// Get a list of app IDs
const appIds = _.keys(self.apps);
File index.js
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
const Crawler = require('node-webcrawler');
const cheerio = require('cheerio');
const _ = require('lodash');
Function parse
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parse(result) {
const html = responseToHtml(result);
if (typeof html === 'undefined') {
// We got an invalid response
requeue();
Function htmlToReviews
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function htmlToReviews(html, appId, pageNum, emit) {
try {
const $ = cheerio.load(html);
const reviewObjs = $('.single-review');
const reviews = [];
Function constructor
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(apps, options) {
if (options && options.maxPages && options.checkBeforeContinue) {
console.error('Warning: The \'maxPages\' option will be ignored when \'checkBeforeContinue\' is present');
}
const defaults = {
Function responseToHtml
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
function responseToHtml(response) {
if (response.headers['content-type'] === 'application/json; charset=utf-8') {
try {
const decoded = decodeUnicode(decodeUTF8(response.body));
const body = JSON.parse(removeLeadingChars(decoded));
- 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
Avoid too many return
statements within this function. Open
Open
return undefined;