Showing 6 of 8 total issues
Function extractRSSPostImage
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
export function extractRSSPostImage(post) {
let imageURI = null;
if (post['media:content']) {
const validMediaContentImageURLs = post['media:content']
.map(media => media.$)
- 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 httpRequestIfModifiedSince
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function httpRequestIfModifiedSince(uri, dateTime) {
return new Promise((resolve, reject) => {
if (!dateTime || check.instance(dateTime, Date.prototype)) {
reject(new Error('Valid DateTime required'));
}
Function formatNewBlogsNotification
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
function formatNewBlogsNotification(usersToNewPosts) {
if (!check.array(usersToNewPosts) || usersToNewPosts.length === 0) {
throw new Error('Valid array of users with new posts required');
}
- 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 getUsersNewPosts
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function getUsersNewPosts(user) {
return new Promise((resolve, reject) => {
let lastModifiedDate = null;
requestUserFeed(user)
Function aggregate
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function aggregate() {
initDbLogger(log);
return new Promise((resolve, reject) => {
database.sync()
Function formatNewBlogsNotification
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function formatNewBlogsNotification(usersToNewPosts) {
if (!check.array(usersToNewPosts) || usersToNewPosts.length === 0) {
throw new Error('Valid array of users with new posts required');
}