Showing 754 of 2,690 total issues
Function VariableController
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function VariableController(gladys) {
/**
* @api {post} /api/service/:service_name/variable/:variable_key Save service variable
* @apiName SaveVariable
* @apiGroup Variable
- 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 poll
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function poll(userId) {
const bot = this.bots[userId];
let result = {};
let interval = 50;
- 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 onNewCameraFile
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
cameraSelector,
folderPath,
cameraFolder,
filename,
sharedObjectToVerify,
Function retrieveTokens
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function retrieveTokens(body) {
logger.debug('Getting tokens to Netatmo API...');
const { clientId, clientSecret, scopes } = this.configuration;
const { codeOAuth, state, redirectUri } = body;
if (!clientId || !clientSecret || !codeOAuth) {
- 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 configureContainer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function configureContainer(config) {
logger.info('Node-RED: Docker container is being configured...');
const { basePathOnContainer } = await this.gladys.system.getGladysBasePath();
- 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 buildFeatures
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function buildFeatures(deviceName, expose, parentType) {
const { type, name, property, access, value_min: minValue, value_max: maxValue, unit: deviceUnit, values } = expose;
const { names = {}, feature, getFeatureIndexes = () => [''] } = exposesMap[type] || {};
const byName = buildByName(names, name, parentType);
- 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 stopStreaming
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function stopStreaming(cameraSelector) {
const liveStream = this.liveStreams.get(cameraSelector);
if (!liveStream) {
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 syncUserCalendars
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function syncUserCalendars(userId) {
const CALDAV_HOST = await this.gladys.variable.getValue('CALDAV_HOST', this.serviceId, userId);
const CALDAV_HOME_URL = await this.gladys.variable.getValue('CALDAV_HOME_URL', this.serviceId, userId);
const CALDAV_USERNAME = await this.gladys.variable.getValue('CALDAV_USERNAME', this.serviceId, userId);
const CALDAV_PASSWORD = await this.gladys.variable.getValue('CALDAV_PASSWORD', this.serviceId, userId);
- 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 OpenWeatherService
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function OpenWeatherService(gladys, serviceId) {
const { default: axios } = require('axios');
let openWeatherApiKey;
/**
- 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 CalDAVHandler
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
const CalDAVHandler = function CalDAVHandler(gladys, serviceId, ical, dav, dayjs, xmlDom) {
Function saveHistoricalState
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function saveHistoricalState(deviceFeature, newValue, newValueCreatedAt) {
// Validate that the number is correct
if (Number.isNaN(newValue)) {
throw new BadParameters(`device.saveHistoricalState of NaN value on ${deviceFeature.selector}`);
}
- 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 add
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function add(device) {
this.stateManager.setState('device', device.selector, device);
this.stateManager.setState('deviceByExternalId', device.external_id, device);
this.stateManager.setState('deviceById', device.id, device);
device.features.forEach((feature) => {
- 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 createActions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function createActions(store) {
const boxActions = createBoxActions(store);
const actions = {
async getWeather(state, box, x, y) {
- 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 command
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function command(message, classification, context) {
let nbAffectedLights = 0;
const roomEntity = classification.entities.find((entity) => entity.entity === 'room');
try {
if (!roomEntity) {
- 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 create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function create(device) {
// separate object
const features = device.features || [];
const params = device.params || [];
delete device.features;
- 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 getDeviceFeaturesAggregates
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function getDeviceFeaturesAggregates(selector, intervalInMinutes, maxStates = 100) {
const deviceFeature = this.stateManager.get('deviceFeature', selector);
if (deviceFeature === null) {
throw new NotFoundError('DeviceFeature not 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 createActions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function createActions(store) {
const actions = {
async getUsers(state) {
store.setState({
usersGetStatus: RequestStatus.Getting
- 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 createActions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function createActions(store) {
const houseActions = createActionsHouse(store);
const actions = {
async getLANManagerDevices(state) {
store.setState({
- 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 updateFeatureProperty
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
updateFeatureProperty(state, listName, deviceIndex, featureIndex, property, value) {
Function createActions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const createActions = store => {
const houseActions = createActionsHouse(store);
const integrationActions = createActionsIntegration(store);
const bluetoothActions = createActionsBluetooth(store);
const actions = {
- 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"