Showing 742 of 2,674 total issues
Function WeatherController
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function WeatherController(gladys) {
/**
* @api {get} /api/v1/user/:user_selector/weather get weather user
* @apiName getWeatherUser
* @apiGroup Weather
Function associate
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
User.associate = (models) => {
User.hasMany(models.Location, {
foreignKey: 'user_id',
sourceKey: 'id',
as: 'locations',
Function transformDevice
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function transformDevice(device) {
const { mac, hostname, ip, vendor } = device;
const deviceExternalId = `lan-manager:${mac.replaceAll(':', '').toLowerCase()}`;
const params = [];
Function downloadBackup
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function downloadBackup(fileUrl) {
const encryptKey = await this.variable.getValue('GLADYS_GATEWAY_BACKUP_KEY');
if (encryptKey === null) {
throw new NotFoundError('GLADYS_GATEWAY_BACKUP_KEY_NOT_FOUND');
}
Function discover
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function discover() {
if (!this.connected) {
await this.connect();
}
Function loginTwoFactor
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function loginTwoFactor(twoFactorToken, twoFactorCode) {
// We login with two factor code
await this.gladysGatewayClient.loginInstance(twoFactorToken, twoFactorCode);
// we get all variables
const gladysGatewayRefreshToken = await this.variable.getValue('GLADYS_GATEWAY_REFRESH_TOKEN');
Function addFeature
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
addFeature() {
const featureData = this.state.selectedFeature.split('|');
let defaultValues = {};
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render({}, { houses }) {
return (
<div>
{this.props.trigger.type === EVENTS.HOUSE.EMPTY && (
<p>
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props, { selectedOption, userOptions, houseOptions, selectedHouseOption }) {
return (
<div>
<p>
{props.action.type === ACTIONS.USER.SET_SEEN_AT_HOME && (
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props, { userOptions, selectedOption, houseOptions, selectedHouseOption }) {
return (
<div>
<p>
{props.trigger.type === EVENTS.USER_PRESENCE.BACK_HOME && (
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props, { selectedDeviceFeature }) {
let binaryDevice = false;
let presenceDevice = false;
let buttonClickDevice = false;
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props, {}) {
const boxData = get(props, `${DASHBOARD_BOX_DATA_KEY}HumidityInRoom.${props.x}_${props.y}`);
const boxStatus = get(props, `${DASHBOARD_BOX_STATUS_KEY}HumidityInRoom.${props.x}_${props.y}`);
const humidity = get(boxData, 'room.humidity.humidity');
const unit = get(boxData, 'room.humidity.unit');
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props, { userOptions, selectedOption, areaOptions, selectedAreaOption }) {
return (
<div>
<p>
{props.trigger.type === EVENTS.AREA.USER_ENTERED && (
Function up
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable('t_script', {
id: {
allowNull: false,
primaryKey: true,
Function connect
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function connect(configuration) {
const { baseUrl, accessKey, secretKey } = configuration;
if (!baseUrl || !accessKey || !secretKey) {
this.status = STATUS.NOT_INITIALIZED;
Function determineTypeAndTraits
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function determineTypeAndTraits(device) {
const featureCategoryTypes = {};
let type;
const traits = [];
let attributes = {};
Function poll
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function poll(device) {
const externalId = device.external_id;
const [prefix, topic] = device.external_id.split(':');
if (prefix !== 'tuya') {
Function AreaController
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function AreaController(gladys) {
/**
* @api {post} /api/v1/area create
* @apiName create
* @apiGroup Area
Function EwelinkController
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function EwelinkController(eweLinkHandler) {
/**
* @api {post} /api/v1/service/ewelink/connect Connect to eWeLink cloud account.
* @apiName save
* @apiGroup Ewelink
Function throwErrorIfNeeded
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function throwErrorIfNeeded(response, emit = false, config = false) {
if (response.error) {
if (response.error === 406) {
this.connected = false;
this.accessToken = '';