GladysProject/Gladys

View on GitHub
server/lib/scene/scene.actions.js

Summary

Maintainability
F
1 wk
Test Coverage

File scene.actions.js has 513 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const Promise = require('bluebird');
const Handlebars = require('handlebars');
const cloneDeep = require('lodash.clonedeep');
const {
  create,
Severity: Major
Found in server/lib/scene/scene.actions.js - About 1 day to fix

    actionsFunc has 28 functions (exceeds 20 allowed). Consider refactoring.
    Open

    const actionsFunc = {
      [ACTIONS.DEVICE.SET_VALUE]: async (self, action, scope, columnIndex, rowIndex) => {
        let device;
        let deviceFeature;
        if (action.device_feature) {
    Severity: Minor
    Found in server/lib/scene/scene.actions.js - About 3 hrs to fix

      Function ACTIONS.CONDITION.CHECK_TIME has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

        [ACTIONS.CONDITION.CHECK_TIME]: async (self, action, scope) => {
          const now = dayjs.tz(dayjs(), self.timezone);
          let beforeDate;
          let afterDate;
          let isBeforeCondition = true;
      Severity: Minor
      Found in server/lib/scene/scene.actions.js - About 2 hrs 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 ACTIONS.CONDITION.CHECK_TIME has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        [ACTIONS.CONDITION.CHECK_TIME]: async (self, action, scope) => {
          const now = dayjs.tz(dayjs(), self.timezone);
          let beforeDate;
          let afterDate;
          let isBeforeCondition = true;
      Severity: Major
      Found in server/lib/scene/scene.actions.js - About 2 hrs to fix

        Function ACTIONS.CALENDAR.IS_EVENT_RUNNING has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          [ACTIONS.CALENDAR.IS_EVENT_RUNNING]: async (self, action, scope, columnIndex, rowIndex) => {
            // find if one event match the condition
            const events = await self.calendar.findCurrentlyRunningEvent(
              action.calendars,
              action.calendar_event_name_comparator,
        Severity: Minor
        Found in server/lib/scene/scene.actions.js - About 1 hr to fix

          Function ACTIONS.LIGHT.BLINK has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            [ACTIONS.LIGHT.BLINK]: async (self, action, scope) => {
              const blinkingSpeed = action.blinking_speed;
              const blinkingTime = action.blinking_time * 1000 + 1;
              let blinkingInterval;
              switch (blinkingSpeed) {
          Severity: Minor
          Found in server/lib/scene/scene.actions.js - About 1 hr to fix

            Function ACTIONS.ECOWATT.CONDITION has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              [ACTIONS.ECOWATT.CONDITION]: async (self, action) => {
                try {
                  const data = await self.gateway.getEcowattSignals();
                  const todayDate = dayjs.tz(dayjs(), self.timezone).format('YYYY-MM-DD');
                  const todayHour = dayjs.tz(dayjs(), self.timezone).hour();
            Severity: Minor
            Found in server/lib/scene/scene.actions.js - About 1 hr to fix

              Function ACTIONS.EDF_TEMPO.CONDITION has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                [ACTIONS.EDF_TEMPO.CONDITION]: async (self, action) => {
                  try {
                    const edfTempoService = self.service.getService('edf-tempo');
                    const data = await edfTempoService.getEdfTempoStates();
                    let peakDayTypeValid;
              Severity: Minor
              Found in server/lib/scene/scene.actions.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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  if (action.before) {
                    beforeDate = dayjs.tz(`${now.format('YYYY-MM-DD')} ${action.before}`, self.timezone);
                    isBeforeCondition = now.isBefore(beforeDate);
                    if (!isBeforeCondition) {
                      logger.debug(
              Severity: Major
              Found in server/lib/scene/scene.actions.js and 1 other location - About 6 hrs to fix
              server/lib/scene/scene.actions.js on lines 297..307

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 157.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  if (action.after) {
                    afterDate = dayjs.tz(`${now.format('YYYY-MM-DD')} ${action.after}`, self.timezone);
                    isAfterCondition = now.isAfter(afterDate);
                    if (!isAfterCondition) {
                      logger.debug(
              Severity: Major
              Found in server/lib/scene/scene.actions.js and 1 other location - About 6 hrs to fix
              server/lib/scene/scene.actions.js on lines 286..296

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 157.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                [ACTIONS.SWITCH.TOGGLE]: async (self, action, scope) => {
                  await Promise.map(action.devices, async (deviceSelector) => {
                    try {
                      const device = self.stateManager.get('device', deviceSelector);
                      const deviceFeature = getDeviceFeature(
              Severity: Major
              Found in server/lib/scene/scene.actions.js and 1 other location - About 5 hrs to fix
              server/lib/scene/scene.actions.js on lines 98..112

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 148.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                [ACTIONS.LIGHT.TOGGLE]: async (self, action, scope) => {
                  await Promise.map(action.devices, async (deviceSelector) => {
                    try {
                      const device = self.stateManager.get('device', deviceSelector);
                      const deviceFeature = getDeviceFeature(
              Severity: Major
              Found in server/lib/scene/scene.actions.js and 1 other location - About 5 hrs to fix
              server/lib/scene/scene.actions.js on lines 185..199

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 148.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

                [ACTIONS.LIGHT.TURN_ON]: async (self, action, scope) => {
                  await Promise.map(action.devices, async (deviceSelector) => {
                    try {
                      const device = self.stateManager.get('device', deviceSelector);
                      const deviceFeature = getDeviceFeature(
              Severity: Major
              Found in server/lib/scene/scene.actions.js and 3 other locations - About 4 hrs to fix
              server/lib/scene/scene.actions.js on lines 83..97
              server/lib/scene/scene.actions.js on lines 155..169
              server/lib/scene/scene.actions.js on lines 170..184

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 134.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

                [ACTIONS.SWITCH.TURN_ON]: async (self, action, scope) => {
                  await Promise.map(action.devices, async (deviceSelector) => {
                    try {
                      const device = self.stateManager.get('device', deviceSelector);
                      const deviceFeature = getDeviceFeature(
              Severity: Major
              Found in server/lib/scene/scene.actions.js and 3 other locations - About 4 hrs to fix
              server/lib/scene/scene.actions.js on lines 68..82
              server/lib/scene/scene.actions.js on lines 83..97
              server/lib/scene/scene.actions.js on lines 170..184

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 134.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

                [ACTIONS.SWITCH.TURN_OFF]: async (self, action, scope) => {
                  await Promise.map(action.devices, async (deviceSelector) => {
                    try {
                      const device = self.stateManager.get('device', deviceSelector);
                      const deviceFeature = getDeviceFeature(
              Severity: Major
              Found in server/lib/scene/scene.actions.js and 3 other locations - About 4 hrs to fix
              server/lib/scene/scene.actions.js on lines 68..82
              server/lib/scene/scene.actions.js on lines 83..97
              server/lib/scene/scene.actions.js on lines 155..169

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 134.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

                [ACTIONS.LIGHT.TURN_OFF]: async (self, action, scope) => {
                  await Promise.map(action.devices, async (deviceSelector) => {
                    try {
                      const device = self.stateManager.get('device', deviceSelector);
                      const deviceFeature = getDeviceFeature(
              Severity: Major
              Found in server/lib/scene/scene.actions.js and 3 other locations - About 4 hrs to fix
              server/lib/scene/scene.actions.js on lines 68..82
              server/lib/scene/scene.actions.js on lines 155..169
              server/lib/scene/scene.actions.js on lines 170..184

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 134.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                      start: dayjs(eventRaw.start)
                        .tz(self.timezone)
                        .locale(eventRaw.calendar.creator.language)
                        .format('LLL'),
              Severity: Minor
              Found in server/lib/scene/scene.actions.js and 1 other location - About 55 mins to fix
              server/lib/scene/scene.actions.js on lines 439..442

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 53.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                      end: dayjs(eventRaw.end)
                        .tz(self.timezone)
                        .locale(eventRaw.calendar.creator.language)
                        .format('LLL'),
              Severity: Minor
              Found in server/lib/scene/scene.actions.js and 1 other location - About 55 mins to fix
              server/lib/scene/scene.actions.js on lines 435..438

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 53.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  if (action.before && action.after && !afterDate.isBefore(beforeDate)) {
                    // So the condition is a OR in this case
                    const conditionVerified = isBeforeCondition || isAfterCondition;
                    if (!conditionVerified) {
                      throw new AbortScene('CONDITION_BEFORE_OR_AFTER_NOT_VERIFIED');
              Severity: Minor
              Found in server/lib/scene/scene.actions.js and 1 other location - About 50 mins to fix
              server/lib/scene/scene.actions.js on lines 323..331

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 52.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  } else {
                    // Otherwise, the condition is a AND
                    const conditionVerified = isBeforeCondition && isAfterCondition;
                    if (!conditionVerified) {
                      throw new AbortScene('CONDITION_BEFORE_AND_AFTER_NOT_VERIFIED');
              Severity: Minor
              Found in server/lib/scene/scene.actions.js and 1 other location - About 50 mins to fix
              server/lib/scene/scene.actions.js on lines 315..323

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 52.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                    if (condition.evaluate_value !== undefined) {
                      value = evaluate(Handlebars.compile(condition.evaluate_value)(scope).replace(/\s/g, ''));
                    }
              Severity: Minor
              Found in server/lib/scene/scene.actions.js and 1 other location - About 50 mins to fix
              server/lib/scene/scene.actions.js on lines 56..58

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 51.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  if (action.evaluate_value !== undefined) {
                    value = evaluate(Handlebars.compile(action.evaluate_value)(scope).replace(/\s/g, ''));
                  }
              Severity: Minor
              Found in server/lib/scene/scene.actions.js and 1 other location - About 50 mins to fix
              server/lib/scene/scene.actions.js on lines 256..258

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 51.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                [ACTIONS.USER.SET_SEEN_AT_HOME]: async (self, action) => {
                  await self.house.userSeen(action.house, action.user);
                },
              Severity: Minor
              Found in server/lib/scene/scene.actions.js and 1 other location - About 35 mins to fix
              server/lib/scene/scene.actions.js on lines 360..362

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 46.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                [ACTIONS.USER.SET_OUT_OF_HOME]: async (self, action) => {
                  await self.house.userLeft(action.house, action.user);
                },
              Severity: Minor
              Found in server/lib/scene/scene.actions.js and 1 other location - About 35 mins to fix
              server/lib/scene/scene.actions.js on lines 357..359

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 46.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              There are no issues that match your filters.

              Category
              Status