Showing 35 of 77 total issues
Function aggregateDevicesData
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
aggregateDevicesData(devices) {
const pluginService = this.app.services.PluginService
const fullData = []
const devicesByPlugin = this._sortDevicesByPlugin(devices)
Function dispatchNotification
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
dispatchNotification(notification) {
return this.app.orm.Notification.create(notification).then(notification => {
this.sendWebNotification(notification)
if (notification.userId) {
Function config
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
static config(app, Sequelize) {
return {
options: {
classMethods: {
associate: (models) => {
Function getAdditionalGroupDevice
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
getAdditionalGroupDevice(roomId, devices, wantedType) {
const groupDevices = []
if (!wantedType || wantedType === this.app.lisa.DEVICE_TYPE.LIGHT) {
const lights = devices.filter(devices => devices.type === this.app.lisa.DEVICE_TYPE.LIGHT)
if (roomId && lights.length > 1) {
- 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 log
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
get log() {
const getArguments = (args) => {
const plugin = getCurrentPlugin()
const mainArguments = Array.prototype.slice.call(args)
return [plugin + ':'].concat(mainArguments)
Function updateProfile
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateProfile(req, res) {
req.app.multerAvatar.single('avatar')(req, res, err => {
if (err) {
res.serverError(err)
}
Function schema
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
static schema(app, Sequelize) {
return {
name: {
type: Sequelize.STRING,
allowNull: false,
Function dispatchNotification
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
dispatchNotification(notification) {
return this.app.orm.Notification.create(notification).then(notification => {
this.sendWebNotification(notification)
if (notification.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 interact
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
interact(infos) {
if (infos.action === 'UNKNOWN') {
return Promise.resolve(infos)
}
else {
- 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 updateProfile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
updateProfile(req, res) {
req.app.multerAvatar.single('avatar')(req, res, err => {
if (err) {
res.serverError(err)
}
- 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 _buildContext
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
_buildContext(bot, data) {
const context = bot && bot.context || []
const dataIndex = this._findExistingDataIndex(context, data)
if (dataIndex === -1) {
if (!data.name || data.name === '') {
- 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 aggregateDevicesData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
aggregateDevicesData(devices) {
const pluginService = this.app.services.PluginService
const fullData = []
const devicesByPlugin = this._sortDevicesByPlugin(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 downloadOffline
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async function downloadOffline() {
var resources = [];
var contentCache = await caches.open(CACHE_NAME);
var currentContent = {};
for (var request of await contentCache.keys()) {
- 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 schema
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static schema(app, Sequelize) {
const schema = {
key: {
primaryKey: true,
type: Sequelize.STRING,
- 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 schema
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static schema(app, Sequelize) {
const schema = {
key: {
primaryKey: true,
type: Sequelize.STRING,
- 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"