Showing 323 of 551 total issues
File index.js
has 555 lines of code (exceeds 250 allowed). Consider refactoring. Open
const schedule = require('node-schedule');
const { EventEmitter } = require('events');
const logger = require('../../common').logger.prefix('triggers');
const api = require('../../control-panel/api');
const hooks = require('../../hooks');
Function track_hardware_changes
has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring. Open
exp.track_hardware_changes = (dataTrack) => {
const removeKeysFromObjectImmutable = (obj, keys) => Object.keys(obj).reduce((acc, key) => {
if (!keys.includes(key)) {
acc[key] = obj[key];
}
- 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 setUpHooks
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
const setUpHooks = () => {
if (Object.keys(eventTriggers).length === 0) return;
Object.keys(eventTriggers).forEach((event) => {
hooks.on(event.split('-')[0], (info) => {
- 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 index.js
has 545 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable indent */
// eslint-disable-next-line import/no-extraneous-dependencies
const WebSocket = require('ws');
// eslint-disable-next-line import/no-extraneous-dependencies
const HttpsProxyAgent = require('https-proxy-agent');
Function Operetta
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
var Operetta = function(args, scope) {
if (args) {
this.args = args;
} else {
if (process.argv[0].match(/node(\.exe)?$/))
- 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 start
has 180 lines of code (exceeds 25 allowed). Consider refactoring. Open
var start = function(cb) {
ensureAndCreateDb((err)=>{
if (err) return process.exit(1);
const config = require('../utils/configfile');
config.load(() => {
File package.js
has 443 lines of code (exceeds 250 allowed). Consider refactoring. Open
const fs = require('fs');
const path = require('path');
const needle = require('needle');
const createHash = require('crypto').createHash;
const rmdir = require('rimraf');
Function activate
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
exports.activate = (trigger) => {
let index;
let info;
let opts;
try {
- 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
ConfigDelegate
has 47 functions (exceeds 20 allowed). Consider refactoring. Open
class ConfigDelegate(NSObject):
def windowWillClose_(self, sender):
self.terminate(sender)
Function request
has 155 lines of code (exceeds 25 allowed). Consider refactoring. Open
const request = function () {
if (current_request) {
logger.debug('Already running request');
return;
}
File prey-config.py
has 424 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/python
# coding: utf-8
############################
# Prey OSX Configurator
Function webSocketSettings
has 153 lines of code (exceeds 25 allowed). Consider refactoring. Open
const webSocketSettings = () => {
notifyActionInterval = setInterval(retryQueuedResponses, 5000); // <-revisar el tiempo
notifyAckInterval = setInterval(retryAckResponses, 4 * 1000);
getStatusInterval = setInterval(getStatusByInterval, 5 * 60 * 1000);
setIntervalWSStatus = setInterval(exports.heartbeat, 30 * 1000);
Function notify_action
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
exports.notify_action = (status, id, action, opts, err, out, time, respId, retries = 0) => {
if (!id || id === 'report' || action === 'triggers' || action === 'geofencing') return;
if (retries >= retriesMax) {
storage.do('del', { type: 'responses', id: respId });
exports.responses_queue = exports.responses_queue.filter((x) => x.id !== respId);
- 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 testExistingConfigurations
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
const testExistingConfigurations = (cb) => {
exec(exports.existsNewPath, (_error, stdout) => {
if (stdout && stdout.trim() !== '') {
// look for old .plist and remove it
// eslint-disable-next-line consistent-return
- 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 sync
has 130 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.sync = (success, id, err, triggersSync, storedSync, cb) => {
let triggers = [...triggersSync];
const stored = [...storedSync];
const watching = [];
Function perform
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
exports.perform = function (command) {
if (!command) return handle_error(new Error('No command received'));
if (typeof command.options === 'string') {
try {
- 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 get_firmware_info
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
exports.get_firmware_info = (callback) => {
let data = {};
const fetch = (key, section, value) => {
wmic.get_value(section, value, null, (err, resp) => {
let res = resp;
- 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 preyconf.js
has 340 lines of code (exceeds 250 allowed). Consider refactoring. Open
const fs = require('fs');
const { join } = require('path');
const configPath = require('../../../common').system.paths.config;
const logger = require('../../common').logger.prefix('preyconf');
const storage = require('../storage');
File storage.js
has 334 lines of code (exceeds 250 allowed). Consider refactoring. Open
var fs = require('fs'),
async = require('async'),
join = require('path').join,
sqlite3 = require('sqlite3').verbose(),
//logger = require('../common').logger.prefix('storage'),
Function start
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.start = (id, options, cb) => {
const opts = options || {};
const token = opts.token || null;
// const confirm = opts.confirm === 'ireallyknowwhatiamdoing';
const items = validTypes(opts);