Showing 312 of 527 total issues
Function watch_stopped
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
var watch_stopped = function () {
if (!watching) return;
hooks.on('action', function (event, id) {
if (event == 'stopped' || event == 'failed') {
Function start
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
const start = function (type, id, name, opts, cb) {
// Action with same id is not executed
if (running[id]) {
const err = new Error(`Already running: ${running[id].name} with id: ${id}`);
hooks.emit('error', err);
Function update_version_attempt
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
package.update_version_attempt = (old_version, new_version, attempt_plus, set_notified, error, cb) => {
var create_version = function(version, cb) {
// Before creating the registry the table it's cleared
storage.do('clear', {type: 'versions'}, (err) => {
if (err) return cb(new Error("Unable to edit local database, update cancelled"));
Function get_tree
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
module.exports.get_tree = function(options, cb) {
var dir = options.path;
// We need to run the tree walker script personifying
- 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 check_and_show
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
exports.check_and_show = function(values, cb) {
var force = values['-f'] === true;
var old_config = (values['-c'] || values['--check-file']) && values.positional[0];
var show = function() {
- 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 retryQueuedResponses
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const retryQueuedResponses = () => {
if (exports.responses_queue.length === 0) return;
exports.responses_queue.forEach((respQueued) => {
exports.notify_action(
- 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 init
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
var init = function (type, path, cb) {
storage_path = path ? path : storage_path ? storage_path : join(config, 'commands.db');
backup_path = storage_path;
var create_db = () => {
db_comm = new sqlite3.Database(storage_path, function (err) {
- 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_os_edition
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.get_os_edition = (callback) => {
if (os_name != "windows") {
if (typeof callback !== 'function')
return;
return callback(new Error('Only for Windows'));
Function parse
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.parse = function (body) {
var c;
var matches;
if ((matches = body.match(/^help\s?(\w+)?/))) c = ['help', matches[1]];
Function reconnect
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.reconnect = function(done) {
var network_service,
airport_name = '',
providers = require('./../../agent/providers');
Function check_zones
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
var check_zones = function() {
if (!location || checking) return;
checking = true;
zones.forEach(function (zone) {
Function start
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.start = function(opts, cb) {
hooks.on('geofencing_start', function(fences) {
if (!fences) return;
zones = fences;
Function get_status
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.get_status = (cb) => {
if (exports.status) {
return cb(null, exports.status);
}
if (!timeoutGetStatus) {
Function retrieve_file_as_user
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const retrieve_file_as_user = function (options, cb) {
if (os_name == 'windows') {
path_arg = path.resolve(options.path);
name_arg = path.resolve(options.name);
} else {
Function init
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
var init = function (type, path, cb) {
storage_path = path ? path : storage_path ? storage_path : join(config, 'commands.db');
backup_path = storage_path;
var create_db = () => {
db_comm = new sqlite3.Database(storage_path, function (err) {
Function get_battery_status
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
exports.get_battery_status = function(cb) {
var keys = 'Availability,BatteryStatus,EstimatedChargeRemaining,EstimatedRunTime';
var get_state = function(num) {
- 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 check
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
exports.check = function (id, target, opts, cb) {
function done(err) {
if (cb && typeof cb === 'function') return cb && cb(err);
}
- 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_access_points_list
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
exports.get_access_points_list = function(callback, attempt) {
get_first_wireless_interface(function(err, wifi_device) {
if (err || !wifi_device)
return callback(new Error(err || 'No wireless adapter found.'));
- 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_active_access_point
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
exports.get_active_access_point = function(callback) {
// There's not enough information using the command related to the current AP, so we need to consult the AP list.
// TODO: Optimize the AP list command usage.
exports.get_active_access_point_mac((err, ap_mac) => {
if (err || !ap_mac) return callback(err || new Error('No active access point found.'));
- 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 read
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
exports.read = function(file, cb) {
fs.stat(file, function(err, stat){
if (err) // not there probably
return cb(err);
- 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"