Showing 742 of 2,674 total issues
Function connect
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function connect(configuration) {
const { username, password } = configuration;
if (!username || !password) {
this.status = STATUS.NOT_INITIALIZED;
Function up
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable('t_room', {
id: {
allowNull: false,
primaryKey: true,
Function discoverDevices
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function discoverDevices() {
logger.debug('Looking for MELCloud devices...');
if (this.status !== STATUS.CONNECTED) {
this.gladys.event.emit(EVENTS.WEBSOCKET.SEND_ALL, {
type: WEBSOCKET_MESSAGE_TYPES.MELCLOUD.STATUS,
Function setupRoutes
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setupRoutes(gladys) {
const router = express.Router();
const routes = getRoutes(gladys);
const authMiddleware = AuthMiddleware('dashboard:write', gladys);
const isInstanceConfiguredMiddleware = IsInstanceConfiguredMiddleware(gladys);
Function handleAlexaMessage
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function handleAlexaMessage(data, rawMessage, cb) {
try {
const service = this.serviceManager.getService('alexa');
const body = {
...data.data,
Function getHumidityInRoom
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function getHumidityInRoom(roomId, options) {
logger.debug(`Getting average humidity in room ${roomId}`);
const optionsWithDefault = { ...DEFAULT_PARAMETERS, ...options };
const oneHourAgo = new Date(new Date().getTime() - 1 * 60 * 60 * 1000);
Function getBySelector
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function getBySelector(selector, options) {
const optionsWithDefault = { ...DEFAULT_OPTIONS, ...options };
const include = [];
if (optionsWithDefault.expand.includes('devices')) {
include.push({
Function update
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function update(selector, scene) {
const existingScene = await db.Scene.findOne({
where: {
selector,
},
Function checkStatus
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
async checkStatus(state) {
let zigbee2mqttStatus = {
usbConfigured: false,
mqttExist: false,
mqttRunning: false,
Function connect
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
connect() {
const websocketUrl = config.webSocketUrl || window.location.origin.replace('http', 'ws');
if (this.ws && this.ws.close) {
this.ws.close();
}
Function saveHouse
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
async saveHouse(state) {
// validate new house
let errored = false;
const errors = {};
if (!state.signupNewHouseName || state.signupNewHouseName.length === 0) {
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(props, {}) {
return (
<div>
<p>
<Text id="editScene.actionsCard.delay.label" />
Function action.devices.commands.ColorAbsolute
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
'action.devices.commands.ColorAbsolute': (device, params) => {
const events = [];
const { color = {} } = params;
const { temperature, spectrumRGB } = color;
- 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 AuthMiddleware
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function AuthMiddleware(scope, gladys) {
return asyncMiddleware(async (req, res, next) => {
try {
const authHeader = req.headers.authorization;
let userId;
- 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 a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const createActions = store => {
const integrationActions = createActionsIntegration(store);
const actions = {
async checkStatus(state) {
let zigbee2mqttStatus = {
- 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 actions
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const actions = store => ({
async getBridges(state) {
store.setState({
philipsHueGetBridgesStatus: 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"
Further reading
Function CheckStatus
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const CheckStatus = ({
nodeRedEnabled,
nodeRedExist,
nodeRedRunning,
dockerBased,
- 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 up
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable('t_pod', {
id: {
allowNull: false,
primaryKey: true,
Function getGladysDeviceFeatures
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getGladysDeviceFeatures(externalId, melCloudDevice) {
return [
{
name: 'Power',
external_id: `${externalId}:power`,
Function up
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable('t_scene', {
id: {
allowNull: false,
primaryKey: true,