lgaticaq/tz-parser

View on GitHub

Showing 12 of 28 total issues

File responses.js has 486 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict'

const nmea = require('node-nmea')
const patterns = require('./patterns')
const langEs = require('./messages/es.json')
Severity: Minor
Found in src/responses.js - About 7 hrs to fix

    Function getCommand has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const getCommand = (raw, lang) => {
      const messages = langs[lang] || langs['es']
      const match = patterns.receiveOk.exec(raw.toString())
      const password = match[1]
      const code = match[2]
    Severity: Major
    Found in src/responses.js - About 2 hrs to fix

      Function exports has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = raw => {
        const match = patterns.avl08.exec(raw.toString())
        const gprmcData = nmea.parse(match[4])
        const data = {
          raw: match[0],
      Severity: Major
      Found in src/avl08.js - About 2 hrs to fix

        Function exports has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = raw => {
          const match = patterns.avl05.exec(raw.toString())
          const gprmcData = nmea.parse(match[4])
          const data = {
            raw: match[0],
        Severity: Major
        Found in src/avl05.js - About 2 hrs to fix

          Function exports has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = raw => {
            const match = patterns.avl201.exec(raw.toString())
            const gprmcData = nmea.parse(match[4])
            const data = {
              raw: match[0],
          Severity: Major
          Found in src/avl201.js - About 2 hrs to fix

            Function exports has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = data => {
              const match = patterns.info.exec(data.toString())
              const lat = degToDec(match[1].replace(/(\d+)\.(\d+)(\w{1})/, '$1.$2,$3'))
              const lng = degToDec(match[2].replace(/(\d+)\.(\d+)(\w{1})/, '$1.$2,$3'))
              return {
            Severity: Major
            Found in src/info.js - About 2 hrs to fix

              Function getAlarm has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const getAlarm = (alarm, speed, rfid) => {
                const messages = langs['es']
                const alarmTypes = {
                  '01': { type: 'SOS_Button', message: messages[alarm] },
                  '49': { type: 'DI', number: 5, status: true, message: messages[alarm] },
              Severity: Minor
              Found in src/utils.js - About 1 hr to fix

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

                const parseCommand = data => {
                  let command = null
                  data.password = data.password || '000000'
                  const parsers = [
                    { pattern: /^set_password$/, parser: parseSetUserPassword },
                Severity: Minor
                Found in src/commands.js - About 1 hr to fix

                  Function parseDir has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const parseDir = dir => {
                    let raw
                    if (/^-/.test(dir)) {
                      if (dir.split('.')[0].length === 5) {
                        raw = `${dir.substr(1)},S`
                  Severity: Minor
                  Found in src/responses.js - About 45 mins 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 exports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  module.exports = raw => {
                    const match = patterns.avl08.exec(raw.toString())
                    const gprmcData = nmea.parse(match[4])
                    const data = {
                      raw: match[0],
                  Severity: Minor
                  Found in src/avl08.js - About 35 mins 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 exports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  module.exports = raw => {
                    const match = patterns.avl201.exec(raw.toString())
                    const gprmcData = nmea.parse(match[4])
                    const data = {
                      raw: match[0],
                  Severity: Minor
                  Found in src/avl201.js - About 25 mins 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 exports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  module.exports = raw => {
                    const match = patterns.avl05.exec(raw.toString())
                    const gprmcData = nmea.parse(match[4])
                    const data = {
                      raw: match[0],
                  Severity: Minor
                  Found in src/avl05.js - About 25 mins 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

                  Severity
                  Category
                  Status
                  Source
                  Language