Showing 742 of 2,674 total issues
Function render
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props, { loading, error }) {
return (
<Layout>
<div class="container mt-4">
<div class="row">
Function backup
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function backup(jobId) {
const encryptKey = await this.variable.getValue('GLADYS_GATEWAY_BACKUP_KEY');
if (encryptKey === null) {
throw new NotFoundError('GLADYS_GATEWAY_BACKUP_KEY_NOT_FOUND');
}
File HttpRequest.jsx
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Component } from 'preact';
import { connect } from 'unistore/preact';
import { Text, Localizer } from 'preact-i18n';
import cx from 'classnames';
import update from 'immutability-helper';
Function convertToGladysDevice
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const convertToGladysDevice = (serviceId, device) => {
return {
name: device.name,
external_id: `sonos:${device.uuid}`,
service_id: serviceId,
Function saveHouse
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async saveHouse(state, houseIndex) {
store.setState({
houseUpdateStatus: RequestStatus.Getting
});
const house = state.houses[houseIndex];
File house.js
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { RequestStatus } from '../utils/consts';
import update, { extend } from 'immutability-helper';
extend('$auto', (value, object) => {
return object ? update(object, value) : update({}, value);
Function createActions
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createActions(store) {
const actions = {
checkErrors(state) {
let newSceneErrors = {};
if (!state.newScene.name) {
Function render
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props, state) {
let discoverable = false;
if (state.searchByRange) {
discoverable =
IP_PATTERN.test(state.firstAddress) &&
Function render
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const language = get(this.props, 'user.language');
const localeSet = language === 'fr' ? fr : 'en';
const before = this.props.action.before
? new Date().setHours(this.props.action.before.substr(0, 2), this.props.action.before.substr(3, 2))
actionsFunc
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
Open
const actionsFunc = {
[ACTIONS.DEVICE.SET_VALUE]: async (self, action, scope, columnIndex, rowIndex) => {
let device;
let deviceFeature;
if (action.device_feature) {
EditScene
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class EditScene extends Component {
getSceneBySelector = async () => {
this.setState({
SceneGetStatus: RequestStatus.Getting
});
Function up
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable('t_device_feature', {
id: {
allowNull: false,
primaryKey: true,
Function render
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props, { batteryLevel, loading, tooMuchStatesError, statesNumber }) {
return (
<div class="col-md-4">
<div class="card">
<div class="card-header">
Function render
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render({ device, houses }, { batteryLevel, loading, tooMuchStatesError, statesNumber }) {
return (
<div class="col-md-6">
<div class="card">
<div class="card-header">
File SetupTab.jsx
has 305 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Component } from 'preact';
import { Text, MarkupText } from 'preact-i18n';
import { RequestStatus } from '../../../../../utils/consts';
import CheckStatus from './CheckStatus.js';
import classNames from 'classnames/bind';
Function NetatmoController
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function NetatmoController(netatmoHandler) {
/**
* @api {get} /api/v1/service/netatmo/configuration Get Netatmo Configuration.
* @apiName getConfiguration
* @apiGroup Netatmo
Function handleNewMessage
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
Open
async function handleNewMessage(data, rawMessage, cb) {
if (data.type === 'gladys-api-call') {
const rsaPublicKey = await this.gladysGatewayClient.generateFingerprint(rawMessage.rsaPublicKeyRaw);
const ecdsaPublicKey = await this.gladysGatewayClient.generateFingerprint(rawMessage.ecdsaPublicKeyRaw);
const found = this.usersKeys.find(
- 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 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props, {}) {
const boxData = get(props, `${DASHBOARD_BOX_DATA_KEY}Weather.${props.x}_${props.y}`);
const boxStatus = get(props, `${DASHBOARD_BOX_STATUS_KEY}Weather.${props.x}_${props.y}`);
const weatherObject = get(boxData, 'weather');
const displayMode = this.props.box.modes || {};
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 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({