Showing 737 of 2,655 total issues
Function startStreaming
has 181 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function startStreaming(cameraSelector, isGladysGateway, segmentDuration = 1) {
// If stream already exist, return existing stream
if (this.liveStreams.has(cameraSelector)) {
const liveStream = this.liveStreams.get(cameraSelector);
// If we are in a local stream, and new request come from Gladys Plus
Function createActions
has 177 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createActions(store) {
const integrationActions = createActionsIntegration(store);
const actions = {
async getTasmotaDevices(state) {
store.setState({
File Chart.jsx
has 460 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Component } from 'preact';
import { connect } from 'unistore/preact';
import cx from 'classnames';
import { Text } from 'preact-i18n';
Function render
has 174 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(
{ housesWithRooms = [], broadlinkPeripherals = [], ...props },
{ device, selectedFeature, selectedValue, editedFeatures = {}, learning, learnAllMode, peripheral, saveStatus }
) {
const canSave = Object.keys(editedFeatures).length === 0 || !device.name;
File gateway.js
has 452 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import get from 'get-value';
import update from 'immutability-helper';
import { route } from 'preact-router';
import { RequestStatus, LoginStatus } from '../utils/consts';
import { validateEmail } from '../utils/validator';
Function render
has 162 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render({ feature, featureIndex, canEditCategory, device, ...props }) {
const allowModifyCategory =
canEditCategory && canEditCategory(device, feature) && DEVICE_FEATURE_COMPATIBLE_CATEGORY[feature.type];
return (
Function exports
has 160 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = (sequelize, DataTypes) => {
const User = sequelize.define(
't_user',
{
id: {
Function buildService
has 154 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function buildService(device, features, categoryMapping) {
const { Characteristic, CharacteristicEventTypes, Perms, Service } = this.hap;
const service = new Service[categoryMapping.service](device.name);
Function createActions
has 153 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createActions(store) {
const actions = {
async ping(state) {
store.setState({
PingStatus: RequestStatus.Getting
File RemoteCreation.jsx
has 417 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Component, Fragment } from 'preact';
import { Text, Localizer } from 'preact-i18n';
import { Link } from 'preact-router/match';
import update from 'immutability-helper';
import get from 'get-value';
Function Header
has 146 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Header = ({ ...props }) => {
if (isUrlInArray(props.currentUrl, PAGES_WITHOUT_HEADER)) {
return null;
}
// Adapt forum URL to user language
File SetupTab.jsx
has 406 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Component } from 'preact';
import { Text, MarkupText, Localizer } from 'preact-i18n';
import { RequestStatus } from '../../../../../utils/consts';
import CheckStatus from './CheckStatus.js';
import classNames from 'classnames/bind';
Function newValueVibration
has 142 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function newValueVibration(message, data) {
const { sid } = message;
logger.debug(`Xiaomi : New value vibration, sid = ${sid}`);
const newSensor = {
service_id: this.serviceId,
Function render
has 142 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props) {
return (
<div>
{props.philipsHueBridgesDevices && props.philipsHueBridgesDevices.length > 0 && (
<div class="card">
File NetatmoDeviceBox.jsx
has 403 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Component } from 'preact';
import { Text, Localizer, MarkupText } from 'preact-i18n';
import cx from 'classnames';
import { connect } from 'unistore/preact';
import dayjs from 'dayjs';
Function render
has 138 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props, state, { loading }) {
return (
<div class="card">
<div class="card-header">
<h1 class="card-title">
Function render
has 138 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(
{ deviceIndex, device, housesWithRooms, editable, ...props },
{ loading, errorMessage, tooMuchStatesError, statesNumber }
) {
const validModel = device.features && device.features.length > 0;
Function render
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props, { loading, saveError, testConnectionError, testConnectionErrorMessage }) {
return (
<div class="col-lg-6">
<div class="card">
<div
Function render
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render(props, { selectedDeviceFeaturesOptions, deviceOptions, loading, displayPreview }) {
return (
<BaseEditBox {...props} titleKey="dashboard.boxTitle.chart" titleValue={props.box.title}>
<div class={loading ? 'dimmer active' : 'dimmer'}>
<div class="loader" />
Function createActions
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
Open
function createActions(store) {
const actions = {
async getHouses(state) {
store.setState({
housesGetStatus: RequestStatus.Getting
- 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"