Showing 7 of 29 total issues
Function exports
has 890 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = (transmissionReason, transmissionReasonSpecificData) => {
const tx = core.convertBase(transmissionReason, 16, 10);
const txDataDec = core.convertBase(transmissionReasonSpecificData, 16, 10);
const txDataBin = core.hex2bin(transmissionReasonSpecificData);
let alarm = {};
File alarms.js
has 894 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
const core = require('./core');
module.exports = (transmissionReason, transmissionReasonSpecificData) => {
Function exports
has a Cognitive Complexity of 81 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = (transmissionReason, transmissionReasonSpecificData) => {
const tx = core.convertBase(transmissionReason, 16, 10);
const txDataDec = core.convertBase(transmissionReasonSpecificData, 16, 10);
const txDataBin = core.hex2bin(transmissionReasonSpecificData);
let alarm = {};
- 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
File utils.js
has 322 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
const hardwares = require('./hardwares');
const core = require('./core');
const parseAlarm = require('./alarms');
Function getData
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const getData = raw => {
const bytes = raw.toString('hex').split(/([A-F0-9]{2})/i).filter(x => x !== '');
const seconds = bytes[62];
const io = parseIO(bytes.slice(20, 24).join(''));
const unitsStatusCurrentGsmOperator = parseUnitsStatusCurrentGsmOperator(bytes[15]);
Function parse
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
const parse = raw => {
const rawString = raw.toString('hex');
if (!utils.patterns.data.test(rawString)) return {type: 'UNKNOWN', raw: rawString};
const results = rawString.split(utils.patterns.multi).filter(x => utils.patterns.data.test(x)).map(utils.getData);
const incompleteData = rawString.split(utils.patterns.multi).filter(x => !utils.patterns.data.test(x) && x !== '');
- 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 parseMode1
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const parseMode1 = byte42 => {
const pModes = {
'0': 'No navigation solution',
'1': '1 satellite solution',
'2': '2 satellite solution',