Mirroar/hivemind

View on GitHub
src/role/power-creep/operator.ts

Summary

Maintainability
F
4 days
Test Coverage

File operator.ts has 421 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global RoomPosition OK POWER_INFO PWR_GENERATE_OPS PWR_REGEN_SOURCE
PWR_OPERATE_STORAGE PWR_OPERATE_SPAWN RESOURCE_OPS STORAGE_CAPACITY
STRUCTURE_SPAWN PWR_OPERATE_EXTENSION RESOURCE_ENERGY
PWR_REGEN_MINERAL POWER_CREEP_LIFE_TIME PWR_OPERATE_TOWER */

Severity: Minor
Found in src/role/power-creep/operator.ts - About 6 hrs to fix

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

    export default class OperatorRole extends Role {
        creep: PowerCreep;
    
        /**
         * Makes a power creep behave like an operator.
    Severity: Minor
    Found in src/role/power-creep/operator.ts - About 3 hrs to fix

      Function addOperateSpawnOptions has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          addOperateSpawnOptions(options: OperatorOrder[]) {
              if (!this.creep.powers[PWR_OPERATE_SPAWN]) return;
              if (this.creep.powers[PWR_OPERATE_SPAWN].level < 1) return;
              if (this.creep.powers[PWR_OPERATE_SPAWN].cooldown > 0) return;
              if ((this.creep.store[RESOURCE_OPS] || 0) < POWER_INFO[PWR_OPERATE_SPAWN].ops) return;
      Severity: Minor
      Found in src/role/power-creep/operator.ts - 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 addRegenMineralOptions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          addRegenMineralOptions(options: OperatorOrder[]) {
              if (!this.creep.powers[PWR_REGEN_MINERAL]) return;
              if (this.creep.powers[PWR_REGEN_MINERAL].level < 1) return;
      
              for (const mineral of this.creep.room.minerals) {
      Severity: Minor
      Found in src/role/power-creep/operator.ts - 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 addOperateTowerOptions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          addOperateTowerOptions(options: OperatorOrder[]) {
              if (!this.creep.powers[PWR_OPERATE_TOWER]) return;
              if (this.creep.powers[PWR_OPERATE_TOWER].level < 1) return;
              if (this.creep.powers[PWR_OPERATE_TOWER].cooldown > 0) return;
              if ((this.creep.store[RESOURCE_OPS] || 0) < POWER_INFO[PWR_OPERATE_TOWER].ops) return;
      Severity: Minor
      Found in src/role/power-creep/operator.ts - 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 addOperateExtensionOptions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          addOperateExtensionOptions(options: OperatorOrder[]) {
              if (!this.creep.powers[PWR_OPERATE_EXTENSION]) return;
              if (this.creep.powers[PWR_OPERATE_EXTENSION].level < 1) return;
              if (this.creep.powers[PWR_OPERATE_EXTENSION].cooldown > 0) return;
              if ((this.creep.store[RESOURCE_OPS] || 0) < POWER_INFO[PWR_OPERATE_EXTENSION].ops) return;
      Severity: Minor
      Found in src/role/power-creep/operator.ts - 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 addOperateFactoryOptions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          addOperateFactoryOptions(options: OperatorOrder[]) {
              if (!this.creep.powers[PWR_OPERATE_FACTORY]) return;
              const powerLevel = this.creep.powers[PWR_OPERATE_FACTORY].level;
              if (powerLevel < 1) return;
              if (this.creep.powers[PWR_OPERATE_FACTORY].cooldown > 0) return;
      Severity: Minor
      Found in src/role/power-creep/operator.ts - 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 addOperateStorageOptions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          addOperateStorageOptions(options: OperatorOrder[]) {
              if (!this.creep.powers[PWR_OPERATE_STORAGE]) return;
              if (this.creep.powers[PWR_OPERATE_STORAGE].level < 1) return;
              if (this.creep.powers[PWR_OPERATE_STORAGE].cooldown > 0) return;
              if ((this.creep.store[RESOURCE_OPS] || 0) < POWER_INFO[PWR_OPERATE_STORAGE].ops) return;
      Severity: Minor
      Found in src/role/power-creep/operator.ts - 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 generateOps has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          generateOps() {
              if (this.creep.room.controller && !this.creep.room.controller.isPowerEnabled) return;
              if (this.creep._powerUsed) return;
              if (this.creep.store.getFreeCapacity() === 0) return;
              if (!this.creep.powers[PWR_GENERATE_OPS]) return;
      Severity: Minor
      Found in src/role/power-creep/operator.ts - 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

      Avoid too many return statements within this function.
      Open

              if (!factory) return;
      Severity: Major
      Found in src/role/power-creep/operator.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                if (this.creep.powers[PWR_GENERATE_OPS].level < 1) return;
        Severity: Major
        Found in src/role/power-creep/operator.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return true;
          Severity: Major
          Found in src/role/power-creep/operator.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    if (storage.store.getUsedCapacity() < STORAGE_CAPACITY * 0.9) return;
            Severity: Major
            Found in src/role/power-creep/operator.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      if (this.creep.room.defense.getEnemyStrength() === ENEMY_STRENGTH_NONE) return;
              Severity: Major
              Found in src/role/power-creep/operator.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        if (!spawn) return;
                Severity: Major
                Found in src/role/power-creep/operator.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          if (this.creep.room.isMine() && this.creep.room.getCurrentResourceAmount(RESOURCE_OPS) > 15_000) return;
                  Severity: Major
                  Found in src/role/power-creep/operator.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            if (!storage) return;
                    Severity: Major
                    Found in src/role/power-creep/operator.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              if (ticksRemaining > POWER_INFO[PWR_OPERATE_FACTORY].duration / 5) return;
                      Severity: Major
                      Found in src/role/power-creep/operator.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                if (!storage) return;
                        Severity: Major
                        Found in src/role/power-creep/operator.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  if (!this.creep.room.factoryManager) return;
                          Severity: Major
                          Found in src/role/power-creep/operator.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    if (this.creep.powers[PWR_GENERATE_OPS].cooldown > 0) return;
                            Severity: Major
                            Found in src/role/power-creep/operator.ts - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      if (!spawn) return;
                              Severity: Major
                              Found in src/role/power-creep/operator.ts - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        if (_.filter(tasks, t => t.level === powerLevel).length === 0) return;
                                Severity: Major
                                Found in src/role/power-creep/operator.ts - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                          if (!towers || towers.length === 0) return;
                                  Severity: Major
                                  Found in src/role/power-creep/operator.ts - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                if (ticksRemaining > maxCooldown + POWER_INFO[PWR_REGEN_MINERAL].duration / 5) return;
                                    Severity: Major
                                    Found in src/role/power-creep/operator.ts - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                              if (this.creep.room.energyAvailable > this.creep.room.energyCapacityAvailable * 0.8) return;
                                      Severity: Major
                                      Found in src/role/power-creep/operator.ts - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                if (ticksRemaining > POWER_INFO[PWR_OPERATE_STORAGE].duration / 5) return;
                                        Severity: Major
                                        Found in src/role/power-creep/operator.ts - About 30 mins to fix

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

                                              usePower() {
                                                  const order = this.creep.memory.order as OperatorUsePowerOrder;
                                                  const power = order.power;
                                                  const powerInfo = POWER_INFO[power];
                                                  const range = 'range' in powerInfo ? powerInfo.range : 1;
                                          Severity: Minor
                                          Found in src/role/power-creep/operator.ts - 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 mayCurrentOrderBeInterrupted has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              mayCurrentOrderBeInterrupted(): boolean {
                                                  const order = this.creep.memory.order;
                                                  if (!order) return true;
                                                  if (order.type === 'performRenew') return false;
                                                  if (!('target' in order)) return true;
                                          Severity: Minor
                                          Found in src/role/power-creep/operator.ts - 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 5 locations. Consider refactoring.
                                          Open

                                                  options.push({
                                                      type: 'usePower',
                                                      power: PWR_OPERATE_FACTORY,
                                                      target: factory.id,
                                                      priority: 4,
                                          Severity: Major
                                          Found in src/role/power-creep/operator.ts and 4 other locations - About 1 hr to fix
                                          src/role/power-creep/operator.ts on lines 252..258
                                          src/role/power-creep/operator.ts on lines 314..320
                                          src/role/power-creep/operator.ts on lines 356..362
                                          src/role/power-creep/operator.ts on lines 457..463

                                          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 61.

                                          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 5 locations. Consider refactoring.
                                          Open

                                                      options.push({
                                                          type: 'usePower',
                                                          power: PWR_REGEN_SOURCE,
                                                          target: source.id,
                                                          priority: 3,
                                          Severity: Major
                                          Found in src/role/power-creep/operator.ts and 4 other locations - About 1 hr to fix
                                          src/role/power-creep/operator.ts on lines 314..320
                                          src/role/power-creep/operator.ts on lines 356..362
                                          src/role/power-creep/operator.ts on lines 389..395
                                          src/role/power-creep/operator.ts on lines 457..463

                                          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 61.

                                          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 5 locations. Consider refactoring.
                                          Open

                                                  options.push({
                                                      type: 'usePower',
                                                      power: PWR_OPERATE_SPAWN,
                                                      target: spawn.id,
                                                      priority: 4,
                                          Severity: Major
                                          Found in src/role/power-creep/operator.ts and 4 other locations - About 1 hr to fix
                                          src/role/power-creep/operator.ts on lines 252..258
                                          src/role/power-creep/operator.ts on lines 314..320
                                          src/role/power-creep/operator.ts on lines 389..395
                                          src/role/power-creep/operator.ts on lines 457..463

                                          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 61.

                                          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 5 locations. Consider refactoring.
                                          Open

                                                  options.push({
                                                      type: 'usePower',
                                                      power: PWR_OPERATE_STORAGE,
                                                      target: storage.id,
                                                      priority: 4,
                                          Severity: Major
                                          Found in src/role/power-creep/operator.ts and 4 other locations - About 1 hr to fix
                                          src/role/power-creep/operator.ts on lines 252..258
                                          src/role/power-creep/operator.ts on lines 356..362
                                          src/role/power-creep/operator.ts on lines 389..395
                                          src/role/power-creep/operator.ts on lines 457..463

                                          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 61.

                                          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 5 locations. Consider refactoring.
                                          Open

                                                      options.push({
                                                          type: 'usePower',
                                                          power: PWR_OPERATE_TOWER,
                                                          target: tower.id,
                                                          priority: 5,
                                          Severity: Major
                                          Found in src/role/power-creep/operator.ts and 4 other locations - About 1 hr to fix
                                          src/role/power-creep/operator.ts on lines 252..258
                                          src/role/power-creep/operator.ts on lines 314..320
                                          src/role/power-creep/operator.ts on lines 356..362
                                          src/role/power-creep/operator.ts on lines 389..395

                                          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 61.

                                          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

                                                  this.creep.whenInRange(1, storage, () => {
                                                      if (this.creep.transfer(storage, RESOURCE_OPS, amount) === OK) this.orderFinished();
                                                  });
                                          Severity: Minor
                                          Found in src/role/power-creep/operator.ts and 1 other location - About 55 mins to fix
                                          src/role/power-creep/operator.ts on lines 634..636

                                          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 54.

                                          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

                                                  this.creep.whenInRange(1, storage, () => {
                                                      if (this.creep.withdraw(storage, RESOURCE_OPS, amount) === OK) this.orderFinished();
                                                  });
                                          Severity: Minor
                                          Found in src/role/power-creep/operator.ts and 1 other location - About 55 mins to fix
                                          src/role/power-creep/operator.ts on lines 612..614

                                          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 54.

                                          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