Showing 754 of 2,690 total issues
Function DeviceManager
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
eventManager,
messageManager,
stateManager,
serviceManager,
roomManager,
Function convertDevice
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function convertDevice(melCloudDevice) {
const externalId = `melcloud:${melCloudDevice.DeviceID}`;
const gladysDevice = {
name: melCloudDevice.DeviceName,
Function ServiceController
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function ServiceController(gladys) {
/**
* @api {post} /api/v1/service/:service_name/start start
* @apiName start
* @apiGroup Service
Function MELCloudService
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function MELCloudService(gladys, serviceId) {
const axios = require('axios');
const client = axios.create({
baseURL: MELCLOUD_ENDPOINT,
Function setTabletMode
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function setTabletMode(userId, sessionId, tabletMode, houseSelector) {
const session = await db.Session.findOne({
attributes: ['id'],
where: {
id: sessionId,
Function mapUnit
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mapUnit(deviceUnit, featureUnit) {
switch (deviceUnit) {
case '%':
return DEVICE_FEATURE_UNITS.PERCENT;
case 'hPa':
Function setValue
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function setValue(broadlinkDevice, gladysDevice, deviceFeature, value) {
const { type } = deviceFeature;
const valueStr = value.toString();
// Check for valued code
Function learn
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function learn(peripheralIdentifier) {
logger.debug(`Broalink entering learn mode with ${peripheralIdentifier}`);
let peripheral;
try {
Function SceneManager
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const SceneManager = function SceneManager(
stateManager,
event,
device,
message,
Function waitForRestoreToFinish
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async waitForRestoreToFinish(state) {
try {
const restoreStatus = await state.httpClient.get('/api/v1/gateway/backup/restore/status');
if (restoreStatus.restore_in_progress) {
setTimeout(() => {
Function componentWillMount
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async componentWillMount() {
this.props.getHouses();
this.getDeviceFeaturesOptions();
await this.props.getIntegrationByName('mqtt');
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
render({}, { numberOfHoursBeforeStateIsOutdated }) {
return (
<div class="card">
<h4 class="card-header">
<Text id="systemSettings.numberOfHoursBeforeStateIsOutdated" />
Function connectBridge
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async connectBridge(state, bridge) {
store.setState({
philipsHueCreateDeviceStatus: RequestStatus.Getting
});
try {
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(props, {}) {
let temperature_min = this.props.box.temperature_min;
let temperature_max = this.props.box.temperature_max;
const unit = this.props.user.temperature_unit_preference;
Function newValueDuplexWirelessSwitch
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function newValueDuplexWirelessSwitch(message, data) {
const { sid } = message;
logger.debug(`Xiaomi : New value duplex wireless switch, sid = ${sid}`);
const EXTERNAL_ID_CHANNEL_0_BUTTON = `xiaomi:${sid}:duplex-wireless-switch:channel-0:button`;
const EXTERNAL_ID_CHANNEL_1_BUTTON = `xiaomi:${sid}:duplex-wireless-switch:channel-1:button`;
- 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 request
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function request(url, dataCallback, authErrorCallback, errorCallback) {
logger.debug(`Tasmota: HTTP looking for ${url}`);
const req = http.get(url, (res) => {
logger.debug(`Tasmota: HTTP response for ${url}: ${res.statusCode}`);
- 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 scan
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async function scan() {
if (!this.configured) {
throw new ServiceNotConfiguredError();
} else if (this.scanning) {
logger.warn(`LANManager already scanning for devices...`);
- 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 poll
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async function poll(device) {
if (!this.connected) {
await this.connect();
}
- 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 pollBinary
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
pollBinary: (eWeLinkDevice, feature) => {
const { deviceId, channel } = parseExternalId(feature.external_id);
let state = (eWeLinkDevice.params && eWeLinkDevice.params.switch) || false;
const switches = (eWeLinkDevice.params && eWeLinkDevice.params.switches) || false;
if (state || switches) {
- 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 handleMqttMessage
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async function handleMqttMessage(topic, message) {
// Limit events only on status changes
if (!this.zigbee2mqttConnected) {
this.zigbee2mqttConnected = true;
this.zigbee2mqttRunning = true;
- 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"