Showing 754 of 2,690 total issues
Function createActions
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createActions(store) {
const houseActions = createActionsHouse(store);
const actions = {
async getZWaveDevices(state) {
store.setState({
Function render
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render({ disabled }, { mqttMode, mqttUrl, mqttUsername, mqttPassword, showPassword }) {
return (
<div>
<p>
<Text id="integration.zigbee2mqtt.setup.modes.remote.detailsDescription" />
Function createActions
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createActions(store) {
const houseActions = createActionsHouse(store);
const actions = {
async getLANManagerDevices(state) {
store.setState({
Function exports
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = (sequelize, DataTypes) => {
const device = sequelize.define(
't_device',
{
id: {
Function newValueMotionSensor
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function newValueMotionSensor(message, data) {
const { sid } = message;
logger.debug(`Xiaomi : New value motion sensor, sid = ${sid}`);
const newSensor = {
service_id: this.serviceId,
Function updateNAModule4
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function updateNAModule4(deviceGladys, deviceNetatmo, externalId) {
const { room, dashboard_data: dashboardData } = deviceNetatmo;
try {
deviceGladys.features
.filter((feature) => feature.external_id === `${externalId}:battery_percent`)
Function purgeStatesByFeatureId
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function purgeStatesByFeatureId(deviceFeatureId, jobId) {
logger.info(`Purging states of device feature ${deviceFeatureId}`);
const numberOfDeviceFeatureStateToDelete = await db.DeviceFeatureState.count({
where: {
File index.js
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Component } from 'preact';
import { connect } from 'unistore/preact';
import { route } from 'preact-router';
import SetupTab from './SetupTab';
import NetatmoPage from '../NetatmoPage';
Function GatewayController
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function GatewayController(gladys) {
/**
* @api {get} /api/v1/gateway/status
* @apiName getStatus
* @apiGroup Gateway
Function exports
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = (sequelize, DataTypes) => {
const session = sequelize.define(
't_session',
{
id: {
Function convertDeviceEnergy
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function convertDeviceEnergy(netatmoDevice) {
const { home, name, type: model, room = {}, plug = {} } = netatmoDevice;
const id = netatmoDevice.id || netatmoDevice._id;
const homeId = home || netatmoDevice.home_id;
const nameDevice = name || netatmoDevice.module_name;
Function updateNAModule2
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function updateNAModule2(deviceGladys, deviceNetatmo, externalId) {
const { dashboard_data: dashboardData } = deviceNetatmo;
try {
deviceGladys.features
.filter((feature) => feature.external_id === `${externalId}:battery_percent`)
Function getDeviceFeaturesAggregates
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function getDeviceFeaturesAggregates(selector, intervalInMinutes, maxStates = 100) {
const deviceFeature = this.stateManager.get('deviceFeature', selector);
if (deviceFeature === null) {
throw new NotFoundError('DeviceFeature not found');
}
Function formatRecurringEvents
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function formatRecurringEvents(event, gladysCalendar) {
const { tz } = event.start;
let startDate = this.dayjs.tz(this.dayjs(event.start).format('YYYY-MM-DDTHH:mm:ss'), tz);
let endDate;
File RemoteFeatureEditionPanel.jsx
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Component } from 'preact';
import { MarkupText, Text, translate } from 'preact-i18n';
import { WEBSOCKET_MESSAGE_TYPES } from '../../../../../../../server/utils/constants';
Function render
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render({ ...props }) {
return (
<div>
<div class="form-group">
<label class="form-label" for="deviceName">
Function ACTIONS.CONDITION.CHECK_TIME
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
Open
[ACTIONS.CONDITION.CHECK_TIME]: async (self, action, scope) => {
const now = dayjs.tz(dayjs(), self.timezone);
let beforeDate;
let afterDate;
let isBeforeCondition = true;
- 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 21 (exceeds 5 allowed). Consider refactoring. Open
Open
function createActions(store) {
const integrationActions = createActionsIntegration(store);
const actions = {
async loadProps(state) {
let eweLinkUsername;
- 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 CalDAVService
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function CalDAVService(gladys, serviceId) {
const ical = require('ical');
const dav = require('dav-request');
const dayjs = require('dayjs');
const objectSupport = require('dayjs/plugin/objectSupport');
Function render
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props, state) {
return (
<div class="card">
<div class="card-header">
<h1 class="card-title">