srveit/insteon-hub2

View on GitHub

Showing 38 of 62 total issues

File deviceCategories.js has 2191 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict'
/* eslint quote-props: "off" */module.exports = {
  '00': {
    categoryId: '00',
    categoryName: 'Generalized Controllers',
Severity: Major
Found in lib/deviceCategories.js - About 6 days to fix

    File parseInsteonCommand.js has 510 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict'
    const { createAllLinkRecord } = require('./allLinkRecord')
    const { ENGINE_VERSION_NAMES, OUTLET_CODES, OUTLET_NAMES, X10_HOUSE_CODES, X10_UNIT_CODES, NAK_ERRORS } =
      require('./constants')
    const allLinkParsers = {}
    Severity: Major
    Found in lib/parseInsteonCommand.js - About 1 day to fix

      File parsers.js has 331 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      'use strict'
      const { parseInsteonCommand } = require('./parseInsteonCommand')
      const {
        X10_COMMANDS, X10_HOUSE_CODES, X10_UNIT_CODES, INSTEON_MESSAGE_TYPES,
        ALL_LINK_TYPES, BUTTON_EVENTS, ALL_LINK_CONTROL_NAMES,
      Severity: Minor
      Found in lib/parsers.js - About 3 hrs to fix

        File encodeCommand.js has 314 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        'use strict'
        
        // Also look at
        //   2475SDBdev-112011-en.pdf
        //   2477Sdev-072012-en.pdf
        Severity: Minor
        Found in lib/encodeCommand.js - About 3 hrs to fix

          Function combineCategories has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

          function combineCategories (categories, categories2) {
            for (const category2 of Object.values(categories2)) {
              for (const device2 of Object.values(category2.subcategories)) {
                const subcategories = categories[device2.categoryId] &&
                  categories[device2.categoryId].subcategories
          Severity: Minor
          Found in tools/createDeviceCategories.js - About 2 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 createPlmBase has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          const createPlmBase = ({ username, password, host, port }) => {
            let hubInfo
          
            const authHeader = () => {
              const data = Buffer.from(`${username}:${password}`)
          Severity: Minor
          Found in lib/plmBase.js - About 2 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 createPlmCommandQueue has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const createPlmCommandQueue = (
            sendCommandBuffer,
            setTimeoutFn = setTimeout
          ) => {
            /* eslint no-use-before-define: "off" */
          Severity: Major
          Found in lib/plmCommandQueue.js - About 2 hrs to fix

            Function createPlmStream has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const createPlmStream = (plmBase, pollingInterval = 50) => {
              let log = []
              let monitoring
              /* eslint prefer-const: "off" */
              let monitor
            Severity: Major
            Found in lib/plmStream.js - About 2 hrs to fix

              Function createPlmBufferProcessor has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

              const createPlmBufferProcessor = () => {
                let previousBuffer = ''
              
                const processPlmBuffer = buffer => {
                  const previousBufferLength = previousBuffer.length > 2
              Severity: Minor
              Found in lib/plmBufferProcessor.js - About 2 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 createPlmStream has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

              const createPlmStream = (plmBase, pollingInterval = 50) => {
                let log = []
                let monitoring
                /* eslint prefer-const: "off" */
                let monitor
              Severity: Minor
              Found in lib/plmStream.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 createDevice has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

              function createDevice ({ id, name }) {
                const properties = {
                  id,
                  name,
                }
              Severity: Minor
              Found in lib/device.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 createPlmCommandStream has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const createPlmCommandStream = (parsingLogger = defaultLogger) => {
                let currentBuffer = ''
                let previousParsedCommand
              
                const transform = (chunk, encoding, callback) => {
              Severity: Minor
              Found in lib/plmCommandStream.js - About 1 hr to fix

                Function parsePlmBuffer has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const parsePlmBuffer = (inputBuffer, previousCommand) => {
                  let command
                  const startOfText = inputBuffer.indexOf('02')
                  const buffer = inputBuffer.substring(startOfText)
                  if (startOfText < 0) {
                Severity: Minor
                Found in lib/parsePlmBuffer.js - About 1 hr to fix

                  Function createPlmCommandQueue has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const createPlmCommandQueue = (
                    sendCommandBuffer,
                    setTimeoutFn = setTimeout
                  ) => {
                    /* eslint no-use-before-define: "off" */
                  Severity: Minor
                  Found in lib/plmCommandQueue.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 createAllLinkDatabase has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const createAllLinkDatabase = () => {
                    const entries = {}
                  
                    const addAllLinkRecord = record => {
                      if (record.insteonCommand && record.insteonCommand.type === 'Record Response') {
                  Severity: Minor
                  Found in lib/allLinkDatabase.js - About 1 hr to fix

                    Function parseInsteonCommand has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const parseInsteonCommand = (response, previousCommand) => {
                      let messageType = response.messageType
                      let command1 = response.command1
                      let command2 = response.command2
                    
                    
                    Severity: Minor
                    Found in lib/parseInsteonCommand.js - About 1 hr to fix

                      Function parseInsteonCommand has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const parseInsteonCommand = (response, previousCommand) => {
                        let messageType = response.messageType
                        let command1 = response.command1
                        let command2 = response.command2
                      
                      
                      Severity: Minor
                      Found in lib/parseInsteonCommand.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 createCommandAnnotator has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const createCommandAnnotator = (deviceNames) => {
                        const addDeviceName = command => {
                          if (command.fromAddress) {
                            command.fromDevice = deviceNames[command.fromAddress]
                          }
                      Severity: Minor
                      Found in lib/commandAnnotator.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 createPlmCommandStream has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const createPlmCommandStream = (parsingLogger = defaultLogger) => {
                        let currentBuffer = ''
                        let previousParsedCommand
                      
                        const transform = (chunk, encoding, callback) => {
                      Severity: Minor
                      Found in lib/plmCommandStream.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 update has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        const update = command => {
                          const propertyNames = [
                            'deviceCategory',
                            'deviceSubcategory',
                            'firmware',
                      Severity: Minor
                      Found in lib/device.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language