Showing 9 of 27 total issues
Function wordWrap
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const wordWrap = function (string, max = 80) {
function getWords(str) {
return str
.toString()
.split(/(\S+\s+)/)
- Create a ticketCreate a ticket
Function default
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function (headers) {
function shouldHave(_keys) {
let passed = true
const mustHave = ['x-xss-protection', 'x-frame-options']
mustHave.forEach(key => {
- Create a ticketCreate a ticket
Function default
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function (url) {
return new Promise((resolve, reject) => {
const get = getInsightsURL(url)
https.get(get, res => {
- Create a ticketCreate a ticket
Function default
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function (data) {
const $ = cheerio.load(data.body)
return [
{
- Create a ticketCreate a ticket
Function default
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function (url) {
return new Promise((resolve, reject) => {
const get = getInsightsURL(url, 'mobile')
https.get(get, res => {
- Create a ticketCreate a ticket
Function default
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function ($) {
if (!$) {
throw new Error('No cheerio object provided')
}
const $head = $('head')
- Create a ticketCreate a ticket
Function default
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function ($) {
const $head = $('head')
const elements = {
title: $head.find('title'),
description: $head.find('meta[name="description"]'),
- Create a ticketCreate a ticket
Function wordWrap
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
export const wordWrap = function (string, max = 80) {
function getWords(str) {
return str
.toString()
.split(/(\S+\s+)/)
- Read upRead up
- Create a ticketCreate a ticket
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 getLines
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getLines(words) {
return words.reduce((lines, word) => {
if (word === '') {
return lines
}
- Create a ticketCreate a ticket