Showing 737 of 2,655 total issues
File ActionCard.jsx
has 392 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { h } from 'preact';
import { Text } from 'preact-i18n';
import cx from 'classnames';
import { useRef } from 'preact/hooks';
import { useDrag, useDrop } from 'react-dnd';
Function render
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(
{
deviceIndex,
editable,
editButton,
Function render
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(
{
deviceIndex,
editable,
editButton,
Function createActions
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
Open
function createActions(store) {
const actionsProfilePicture = createActionsProfilePicture(store);
const actions = {
init(state, returnUrl) {
const newState = {
- 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 129 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createActions(store) {
const actionsProfilePicture = createActionsProfilePicture(store);
const actions = {
init(state, returnUrl) {
const newState = {
Function onExecute
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function onExecute(body) {
const directiveNamespace = get(body, 'directive.header.namespace');
const directiveName = get(body, 'directive.header.name');
const endpointId = get(body, 'directive.endpoint.endpointId');
const correlationToken = get(body, 'directive.header.correlationToken');
Function render
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(
props,
{
loading,
configured,
Function render
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render({ trigger }, { calendarsOptions, selectedCalendarsOptions }) {
return (
<div>
<div class="row">
<div class="col-md-12">
Function command
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
Open
async function command(message, classification, context) {
try {
const houses = await this.house.get();
const house = houses[0];
if (!house || !house.latitude || !house.longitude) {
- 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 loadDevices
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function loadDevices() {
let listDevices = [];
if (this.configuration.energyApi || (!this.configuration.energyApi && !this.configuration.weatherApi)) {
try {
Function createActions
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createActions(store) {
const actions = {
scrollToBottom() {
setTimeout(() => {
const chatWindow = document.getElementById('chat-window');
Function render
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render({ device, houses }, { loading }) {
const manufacturer = device.params.find(param => param.name === PARAMS.MANUFACTURER);
const macAddress = device.params.find(param => param.name === PARAMS.MAC);
const orginalName = device.params.find(param => param.name === PARAMS.NAME);
Function createActions
has 120 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createActions(store) {
const actions = {
initRoomList() {
store.setState({
signupRooms: []
Function createActions
has 120 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createActions(store) {
const houseActions = createActionsHouse(store);
const integrationActions = createActionsIntegration(store);
const actions = {
async getMqttDevices(state) {
Function saveHistoricalState
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function saveHistoricalState(deviceFeature, newValue, newValueCreatedAt) {
// Validate that the number is correct
if (Number.isNaN(newValue)) {
throw new BadParameters(`device.saveHistoricalState of NaN value on ${deviceFeature.selector}`);
}
File profile.jsx
has 362 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Text, Localizer } from 'preact-i18n';
import cx from 'classnames';
import dayjs from 'dayjs';
import get from 'get-value';
import EditableProfilePicture from './EditableProfilePicture';
Function convertDeviceWeather
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function convertDeviceWeather(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 || netatmoDevice.station_name;
Function calculateAggregateChildProcess
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function calculateAggregateChildProcess(params) {
const {
AGGREGATE_STATES_PER_INTERVAL,
DEVICE_FEATURE_STATE_AGGREGATE_TYPES,
LAST_AGGREGATE_ATTRIBUTES,
Function render
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(
{ deviceIndex, editable, deleteButton, housesWithRooms },
{ device, loading, errorMessage, tooMuchStatesError, statesNumber }
) {
const validModel = device.features && device.features.length > 0;
Function render
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props, { house, loading, arming }) {
const armingDisabled = (house && house.alarm_mode === ALARM_MODES.ARMED) || arming;
const partialArmDisabled = (house && house.alarm_mode === ALARM_MODES.PARTIALLY_ARMED) || arming;
const isCurrentlyArmingWithCoutdown = arming && house.alarm_delay_before_arming > 0;
return (