Showing 323 of 551 total issues
Function getLocation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const getLocation = (cb) => {
// eslint-disable-next-line consistent-return
system.get_os_version((_err, version) => {
if (version && greaterOrEqual(version, '10.6.0')) {
socket.writeMessage(nameArray[0], (err, data) => {
- 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 validate_new_user_fields
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def validate_new_user_fields(self, name, email, terms, age, passwd, passwd2 = None):
Function start
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports.start = (id, opts, cb) => {
const done = (err = null) => {
if (err) return cb(err);
if (!emitter) emitter = new Emitter();
cb(err, emitter);
- 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 reactToCheckLocationPerms
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const reactToCheckLocationPerms = (data) => {
permissionFile.setData('nativeLocation', data[1].result, () => {
network.isWifiPermissionActive((output) => {
permissionFile.setData('wifiLocation', stringBooleanOrEmpty(output), () => {
// eslint-disable-next-line max-len
- 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
Avoid deeply nested control flow statements. Open
if (reqPreyConf[count].possiblevalues) {
if (reqPreyConf[count].value && !reqPreyConf[count].value.test(line)) {
somethingWrong = true;
dataToFix[reqPreyConf[count].name] = false;
}
Function sync
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports.sync = (success, id, err, triggersSync, storedSync, cb) => {
let triggers = [...triggersSync];
const stored = [...storedSync];
const watching = [];
- 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 requestNativePermission
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const requestNativePermission = (cb) => {
if (osName.localeCompare('mac') !== 0) return cb(new Error('Action only allowed on MacOS'));
// eslint-disable-next-line consistent-return
socket.writeMessage(nameArray[1], () => {
const permissionNative = permissionFile.getData('nativeLocation');
- 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 linkDevice
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const linkDevice = (cb) => {
getDeviceData((err, deviceData) => {
const data = deviceData;
if (err) 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"
Further reading
Avoid deeply nested control flow statements. Open
if (preyConfDataToWrite) {
dataToInsert = preyConfDataToWrite[reqPreyConf[count].name] ? preyConfDataToWrite[reqPreyConf[count].name] : '';
} else {
dataToInsert = reqPreyConf[count].default
|| ((typeof reqPreyConf[count].default === 'boolean') && reqPreyConf[count].default === false) ? reqPreyConf[count].default : '';
Avoid deeply nested control flow statements. Open
if (line.match(reqPreyConf[count].value)) {
if (reqPreyConf[count].word === 'api_key') {
apiKeyValue = true;
} else if (reqPreyConf[count].word === 'device_key') {
deviceKeyValue = true;
Avoid deeply nested control flow statements. Open
if (match) {
const value = match[1];
const matchValue = reqPreyConf[count].possiblevalues.exec(value);
if (matchValue) {
preyConfData[reqPreyConf[count].name] = value;
Function start
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports.start = function (opts, cb) {
hooks.on('connected', () => {
network.get_active_access_point((err, ap) => {
if (was_disconnected) {
logger.info(`Connection achieved! ${ap ? ap.ssid || '' : ''}`);
- 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 drawImage
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def drawImage(self, file, width, height, x, y, view):
Function start
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports.start = (opts, cb) => {
hooks.on('mac_address_changed', () => {
fetchLocation('mac-address');
});
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self):
button_text = "Close"
title = args.title
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self):
button_text = "Close"
title = args.title
- 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
Consider simplifying this complex logical expression. Open
if (data.os_name == 'windows' && gte(os.release().trim(), "10.0.0") &&
data.os_edition && editions.includes(data.os_edition) &&
data.winsvc_version && gte(data.winsvc_version, "2.0.0"))
return true;
Consider simplifying this complex logical expression. Open
} else if ((body && body.key) || (body && body.user && body.user.key)) {
cb(null, set(body.key || body.user.key));
} else {
cb(errors.unknown(resp));
}
Consider simplifying this complex logical expression. Open
} else if (info.days_of_week && info.hour) {
// At least the days and hour
try {
const rule = new schedule.RecurrenceRule();
Consider simplifying this complex logical expression. Open
if (!dataToVerify || !dataFromDb
|| (typeof dataToVerify) !== 'object' || (typeof dataFromDb) !== 'object'
|| Object.keys(dataToVerify).length === 0
|| Object.keys(dataFromDb).length === 0) { return callback(false); }