Showing 742 of 2,674 total issues
Function BroadlinkController
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function BroadlinkController(broadlinkManager) {
/**
* @api {get} /api/v1/service/broadlink/peripheral Get discovered Broadlink peripherals.
* @apiName getPeripheral
* @apiGroup Broadlink
Function updateNAPlug
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function updateNAPlug(deviceGladys, deviceNetatmo, externalId) {
try {
deviceGladys.features
.filter((feature) => feature.external_id === `${externalId}:rf_strength`)
.forEach((feature) => {
Function DeviceManager
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const DeviceManager = function DeviceManager(
eventManager,
messageManager,
stateManager,
serviceManager,
Function load
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function load(gladys) {
const SERVICES_TO_LOAD = Object.keys(this.servicesFromFiles);
await Promise.all(
SERVICES_TO_LOAD.map(async (service) => {
const serviceToInsertOrUpdate = {
Function start
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
start: async () => {
// set wal mode
await db.sequelize.query('PRAGMA journal_mode=WAL;');
// Execute DB migrations
Function savePreferences
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async savePreferences(state) {
// saving user preferences
store.setState({
signupSaveUserPreferences: RequestStatus.Getting
});
Function render
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props, {}) {
const loading =
props.ProfileGetStatus === RequestStatus.Getting || props.ProfilePatchStatus === RequestStatus.Getting;
const profileSavedSuccess = props.ProfilePatchStatus === RequestStatus.Success;
return (
Function saveDevice
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async saveDevice() {
this.setState({
loading: true
});
try {
Function initLeafletMap
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async initLeafletMap(state) {
if (state.signupHouseLeafletMap) {
state.signupHouseLeafletMap.remove();
}
const leafletMap = leaflet.map('select-house-location-map').setView([48.8583, 2.2945], 2);
Function render
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props, { alarmModesOptions, houseOptions, selectedHouseOption, selectedAlarmModeOption }) {
return (
<div>
<p>
<Text id="editScene.actionsCard.alarmSetMode.description" />
Function render
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props, {}) {
const variableOptions = [];
props.actionsGroupsBefore.forEach((actionGroup, groupIndex) => {
actionGroup.forEach((action, index) => {
Function render
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props, { alarmModesOptions, houseOptions, selectedHouseOption, selectedAlarmModeOption }) {
return (
<div>
<p>
<Text id="editScene.actionsCard.alarmCheckMode.description" />
Function up
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
up: async (queryInterface, Sequelize) => {
const service = await db.Service.findOne({
where: {
name: 'enedis',
},
Function DashboardController
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function DashboardController(gladys) {
/**
* @api {post} /api/v1/dashboard create
* @apiName createDashoard
* @apiGroup Dashboard
Function setValue
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function setValue(device, deviceFeature, value) {
if (!deviceFeature.external_id.startsWith('zwavejs-ui:')) {
throw new BadParameters(
`ZWaveJs-UI deviceFeature external_id is invalid: "${deviceFeature.external_id}" should starts with "zwavejs-ui:"`,
);
Function VariableController
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function VariableController(gladys) {
/**
* @api {post} /api/service/:service_name/variable/:variable_key Save service variable
* @apiName SaveVariable
* @apiGroup Variable
Function exports
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = (sequelize, DataTypes) => {
const deviceFeatureState = sequelize.define(
't_device_feature_state',
{
id: {
Function buildFeatures
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function buildFeatures(deviceName, deviceExternalId, broadlinkDevice) {
const { TYPE, getEnergy } = broadlinkDevice;
const features = [];
// check for number of switch features
Function getConfiguration
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function getConfiguration() {
const mqttUrl = await this.gladys.variable.getValue(CONFIGURATION.MQTT_URL_KEY, this.serviceId);
const mqttUsername = await this.gladys.variable.getValue(CONFIGURATION.MQTT_USERNAME_KEY, this.serviceId);
const mqttPassword = await this.gladys.variable.getValue(CONFIGURATION.MQTT_PASSWORD_KEY, this.serviceId);
Function getUsersKeys
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function getUsersKeys() {
try {
const onlineUsers = await this.gladysGatewayClient.getUsersInstance();
let localUsers = await this.variable.getValue('GLADYS_GATEWAY_USERS_KEYS');
localUsers = localUsers !== null ? JSON.parse(localUsers) : [];