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')
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]
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],
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],
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],
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 {
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] },
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 },
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`
- Read upRead up
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],
- Read upRead up
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],
- Read upRead up
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],
- Read upRead up
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"