Showing 742 of 2,674 total issues
Function command
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async function command(message, classification, context) {
let humidityResult;
const roomEntity = classification.entities.find((entity) => entity.entity === 'room');
try {
switch (classification.intent) {
- 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 getEvents
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async function getEvents(userId, options) {
const where = {};
if (options.from || options.to) {
const oneWeekAgo = new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000);
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
function createActions(store) {
const houseActions = createActionsHouse(store);
const integrationActions = createActionsIntegration(store);
const actions = {
async getXiaomiSensors(state) {
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
function createActions(store) {
const integrationActions = createActionsIntegration(store);
const houseActions = createActionsHouse(store);
const actions = {
async getZigbee2mqttDevices(state, take, skip) {
- 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 BaseEditBox
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const BaseEditBox = ({ children, ...props }) => {
const { x, y } = props;
const ref = useRef(null);
const [{ isDragging }, drag, preview] = useDrag(() => ({
type: DASHBOARD_EDIT_BOX_TYPE,
- 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 AppRouter
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
)(props => (
<div id="app">
<Layout currentUrl={props.currentUrl}>
<Header
currentUrl={props.currentUrl}
- 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 render
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
render(props) {
let alertMessage = null;
const { connectMqttStatus, mqttConnected, mqttConnectionError } = props;
switch (connectMqttStatus) {
- 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 EdfTempoService
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function EdfTempoService(gladys, serviceId) {
const dayjs = require('dayjs');
const axios = require('axios').default;
const utc = require('dayjs/plugin/utc');
const timezone = require('dayjs/plugin/timezone');
Function convertFeature
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function convertFeature(tuyaFunctions, externalId) {
const { code, values, name, readOnly } = tuyaFunctions;
const featuresCategoryAndType = mappings[code];
if (!featuresCategoryAndType) {
Function poll
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function poll(device) {
const externalId = device.external_id;
const [prefix, topic] = device.external_id.split(':');
if (prefix !== 'melcloud') {
Function onReportState
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function onReportState(body) {
const deviceSelector = get(body, 'directive.endpoint.endpointId');
const device = this.gladys.stateManager.get('device', deviceSelector);
if (!device) {
throw new NotFoundError(`Device "${deviceSelector}" not found`);
Function checkBatteries
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function checkBatteries() {
const enabled = await this.variable.getValue(SYSTEM_VARIABLE_NAMES.DEVICE_BATTERY_LEVEL_WARNING_ENABLED);
if (!enabled) {
return;
}
Function add
has 31 lines of code (exceeds 25 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) => {
Function login
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
async login(state, e) {
if (e) {
e.preventDefault();
}
if (!validateEmail(state.loginFormEmailValue)) {
Function componentWillMount
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
async componentWillMount() {
let { deviceSelector } = this.props;
let device;
await Promise.all([this.props.getIntegrationByName(this.props.integrationName), this.props.getHouses()]);
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(props) {
return (
<div class="row g-2 mb-2">
<div class="col-5">
<Localizer>
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(props, { selectedDeviceFeaturesOptions, deviceOptions, loading, room }) {
const roomName = room && room.name;
return (
<BaseEditBox {...props} titleKey="dashboard.boxTitle.devices-in-room" titleValue={roomName}>
<div class={loading ? 'dimmer active' : 'dimmer'}>
Function createDevice
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createDevice = (networkAddress, serviceId, username, password) => {
const externalId = `tasmota:${networkAddress}`;
const device = {
name: networkAddress,
external_id: externalId,
Function scanPresence
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function scanPresence() {
const devices = await this.gladys.device.get({
service: 'lan-manager',
device_feature_category: DEVICE_FEATURE_CATEGORIES.PRESENCE_SENSOR,
});
Function up
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable('t_device_feature_state', {
id: {
allowNull: false,
primaryKey: true,