mylisabox/lisa-box

View on GitHub

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)
Severity: Minor
Found in api/services/DeviceService.js - About 1 hr to fix

    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) {
    Severity: Minor
    Found in api/services/NotificationService.js - About 1 hr to fix

      Function config has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        static config(app, Sequelize) {
          return {
            options: {
              classMethods: {
                associate: (models) => {
      Severity: Minor
      Found in api/models/User.js - About 1 hr to fix

        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) {
        Severity: Minor
        Found in api/services/DashboardService.js - About 1 hr to fix

        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)
        Severity: Minor
        Found in lisa.js - About 1 hr to fix

          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)
                }
          Severity: Minor
          Found in api/controllers/UserController.js - About 1 hr to fix

            Function schema has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              static schema(app, Sequelize) {
                return {
                  name: {
                    type: Sequelize.STRING,
                    allowNull: false,
            Severity: Minor
            Found in api/models/ChatBotParamList.js - About 1 hr to fix

              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) {
              Severity: Minor
              Found in api/services/NotificationService.js - About 55 mins to fix

              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 {
              Severity: Minor
              Found in api/services/PluginService.js - About 45 mins to fix

              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)
                    }
              Severity: Minor
              Found in api/controllers/UserController.js - About 45 mins to fix

              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 === '') {
              Severity: Minor
              Found in api/services/ChatBotService.js - About 35 mins to fix

              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)
              Severity: Minor
              Found in api/services/DeviceService.js - About 35 mins to fix

              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()) {
              Severity: Minor
              Found in web/flutter_service_worker.js - About 25 mins to fix

              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,
              Severity: Minor
              Found in api/models/Setting.js - About 25 mins to fix

              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,
              Severity: Minor
              Found in api/models/Preference.js - About 25 mins to fix

              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

              Severity
              Category
              Status
              Source
              Language