Showing 17 of 26 total issues
Function parseURL
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
function parseURL(feedURL, options, callback) {
if (typeof options === 'function' && !callback) {
callback = options;
options = {};
}
- 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 formatATOM
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
function formatATOM(json, options) {
var output = {
'type': 'atom',
items: []
};
File feed.js
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
//feed.js
var xml2js = require('xml2js'),
_ = require('underscore'),
request = require('request'),
URL = require('url'),
Function formatRSS
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
function formatRSS(json, options) {
var output = {
'type': 'rss',
items: []
};
Function formatATOM
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function formatATOM(json, options) {
var output = {
'type': 'atom',
items: []
};
- 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 parseURL
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseURL(feedURL, options, callback) {
if (typeof options === 'function' && !callback) {
callback = options;
options = {};
}
Function distance_of_time_in_words
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
distance_of_time_in_words: function(to, from) {
var distance_in_seconds = ((to - from) / 1000);
var distance_in_minutes = Math.floor(distance_in_seconds / 60);
var tense = distance_in_seconds < 0 ? " from now" : " ago";
distance_in_minutes = Math.abs(distance_in_minutes);
Function distance_of_time_in_words
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
distance_of_time_in_words: function(to, from) {
var distance_in_seconds = ((to - from) / 1000);
var distance_in_minutes = Math.floor(distance_in_seconds / 60);
var tense = distance_in_seconds < 0 ? " from now" : " ago";
distance_in_minutes = Math.abs(distance_in_minutes);
- 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 formatRSS
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function formatRSS(json, options) {
var output = {
'type': 'rss',
items: []
};
- 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 parseString
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseString(xml, options, callback) {
// we need to check that the input in not a null input
if (xml.split('<').length >= 3) {
var parser = new xml2js.Parser({
trim: false,
Avoid too many return
statements within this function. Open
return 'about ' + Math.floor(distance_in_minutes / 60) + ' hours' + tense;
Avoid too many return
statements within this function. Open
return 'about a year' + tense;
Avoid too many return
statements within this function. Open
return 'about a month' + tense;
Avoid too many return
statements within this function. Open
return Math.floor(distance_in_minutes / 43200) + ' months' + tense;
Avoid too many return
statements within this function. Open
return 'over ' + Math.floor(distance_in_minutes / 525960) + ' years';
Avoid too many return
statements within this function. Open
return 'a day' + tense;
Avoid too many return
statements within this function. Open
return Math.floor(distance_in_minutes / 1440) + ' days' + tense;