thorpelawrence/alexa-spotify-connect

View on GitHub

Showing 4 of 19 total issues

File connect.js has 490 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const alexa = require('alexa-app');
const request = require('request-promise-native');
const express = require('express');
const nodecache = require('node-cache');
const i18n = require('i18n');
Severity: Minor
Found in connect.js - About 7 hrs to fix

    Function getAndValidateVolumePercentFromSlot has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    const getAndValidateVolumePercentFromSlot = (req, res, isPercentIntent) => {
        const slotName = isPercentIntent ? "VOLUMEPERCENT" : "VOLUMELEVEL"
        // Check that the slot has a value
        if (req.slot(slotName)) {
            // Check if the slot is a number
    Severity: Minor
    Found in connect.js - About 4 hrs 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 generatedLocales has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const generatedLocales = Object.entries(locales).map(([name, locale]) => {
        let skillbuilder = {
            "intents": [
                {
                    "name": "AMAZON.HelpIntent",
    Severity: Minor
    Found in skill/skill-i18n.js - About 1 hr to fix

      Function getAndValidateVolumePercentFromSlot has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const getAndValidateVolumePercentFromSlot = (req, res, isPercentIntent) => {
          const slotName = isPercentIntent ? "VOLUMEPERCENT" : "VOLUMELEVEL"
          // Check that the slot has a value
          if (req.slot(slotName)) {
              // Check if the slot is a number
      Severity: Minor
      Found in connect.js - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language