nielse63/launch-checklist

View on GitHub

Showing 9 of 27 total issues

Function wordWrap has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const wordWrap = function (string, max = 80) {
  function getWords(str) {
    return str
      .toString()
      .split(/(\S+\s+)/)
Severity: Major
Found in lib/utils.js - About 2 hrs to fix

Function default has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function (headers) {
  function shouldHave(_keys) {
    let passed = true
    const mustHave = ['x-xss-protection', 'x-frame-options']
    mustHave.forEach(key => {
Severity: Minor
Found in lib/tests/security.js - About 2 hrs to fix

Function default has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function (url) {
  return new Promise((resolve, reject) => {
    const get = getInsightsURL(url)

    https.get(get, res => {
Severity: Minor
Found in lib/tests/performance.js - About 1 hr to fix

Function default has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function (data) {
  const $ = cheerio.load(data.body)

  return [
    {
Severity: Minor
Found in lib/tests/index.js - About 1 hr to fix

Function default has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function (url) {
  return new Promise((resolve, reject) => {
    const get = getInsightsURL(url, 'mobile')

    https.get(get, res => {
Severity: Minor
Found in lib/tests/mobile.js - About 1 hr to fix

Function default has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function ($) {
  if (!$) {
    throw new Error('No cheerio object provided')
  }
  const $head = $('head')
Severity: Minor
Found in lib/tests/favicons.js - About 1 hr to fix

Function default has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function ($) {
  const $head = $('head')
  const elements = {
    title: $head.find('title'),
    description: $head.find('meta[name="description"]'),
Severity: Minor
Found in lib/tests/seo.js - About 1 hr to fix

Function wordWrap has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const wordWrap = function (string, max = 80) {
  function getWords(str) {
    return str
      .toString()
      .split(/(\S+\s+)/)
Severity: Minor
Found in lib/utils.js - About 1 hr to fix

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

  function getLines(words) {
    return words.reduce((lines, word) => {
      if (word === '') {
        return lines
      }
Severity: Minor
Found in lib/utils.js - About 1 hr to fix
Severity
Category
Status
Source
Language