Showing 311 of 524 total issues
File index.js
has 657 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
var schedule = require('node-schedule');
var EventEmitter = require('events').EventEmitter;
var logger = require('./../../common').logger.prefix('triggers');
Function track_hardware_changes
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
exp.track_hardware_changes = (dataTrack) => {
const data = dataTrack;
if (data.tpm_module) delete data.tpm_module;
if (data.os_edition) delete data.os_edition;
if (data.winsvc_version) delete data.winsvc_version;
- 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 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
File index.js
has 474 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 activate
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
exports.activate = (trigger) => {
try {
var index = trigger.automation_events.findIndex(
(obj) => obj.type === 'exact_time' || obj.type === 'repeat_time'
),
- 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 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');
ConfigDelegate
has 47 functions (exceeds 20 allowed). Consider refactoring. Open
class ConfigDelegate(NSObject):
def windowWillClose_(self, sender):
self.terminate(sender)
Function start
has 158 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(() => {
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 perform
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
exports.perform = function (command, persist = 1) {
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 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 startWebsocket
has 130 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.startWebsocket = () => {
clearAndResetIntervals();
notifyActionInterval = setInterval(retryQueuedResponses, 5000); // <-revisar el tiempo
notifyAckInterval = setInterval(retryAckResponses, 4 * 1000);
getStatusInterval = setInterval(getStatusByInterval, 5 * 60 * 1000);
Function sync
has 120 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.sync = (id, err, triggers, stored, cb) => {
var watching = [];
if (err) {
logger.error('error starting async: ' + err);
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');
Function activate
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.activate = (trigger) => {
try {
var index = trigger.automation_events.findIndex(
(obj) => obj.type === 'exact_time' || obj.type === 'repeat_time'
),
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);