Mirroar/hivemind

View on GitHub
src/role/transporter.ts

Summary

Maintainability
F
6 days
Test Coverage

File transporter.ts has 541 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global PathFinder Room RoomPosition FIND_DROPPED_RESOURCES
STRUCTURE_CONTAINER RESOURCE_POWER RESOURCE_GHODIUM STRUCTURE_LAB REACTIONS
STRUCTURE_EXTENSION STRUCTURE_SPAWN STRUCTURE_TOWER STRUCTURE_NUKER ERR_NO_PATH
STRUCTURE_POWER_SPAWN TERRAIN_MASK_WALL LOOK_STRUCTURES RESOURCE_ENERGY
LOOK_CONSTRUCTION_SITES OK ORDER_SELL FIND_TOMBSTONES FIND_RUINS */
Severity: Major
Found in src/role/transporter.ts - About 1 day to fix

    Function addObjectEnergySourceOptions has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

        addObjectEnergySourceOptions(options: TransporterSourceOrderOption[], findConstant: FIND_RUINS | FIND_TOMBSTONES | FIND_DROPPED_RESOURCES, optionType: 'resource' | 'tombstone', storagePriority: number) {
            const creep = this.creep;
    
            // Get storage location, since that is a low priority source for transporters.
            const storagePosition = creep.room.getStorageLocation();
    Severity: Minor
    Found in src/role/transporter.ts - About 5 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 addObjectResourceOptions has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        addObjectResourceOptions(options: TransporterSourceOrderOption[], findConstant: FIND_RUINS | FIND_TOMBSTONES | FIND_DROPPED_RESOURCES, optionType: 'resource' | 'tombstone') {
            const creep = this.creep;
    
            // Look for resources on the ground.
            const targets = creep.room.find(findConstant, {
    Severity: Minor
    Found in src/role/transporter.ts - About 4 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 addContainerResourceOptions has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        addContainerResourceOptions(options: TransporterSourceOrderOption[]) {
            const room = this.creep.room;
            // We need a decent place to store these resources.
            if (!room.terminal && !room.storage) return;
    
    
    Severity: Minor
    Found in src/role/transporter.ts - 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 performGetResources has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        performGetResources(sourceCallback?: () => void) {
            const creep = this.creep;
            if (!sourceCallback) {
                sourceCallback = () => {
                    this.calculateSource();
    Severity: Major
    Found in src/role/transporter.ts - About 2 hrs to fix

      Function run has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          run(creep: TransporterCreep) {
              this.creep = creep;
      
              if (creep.memory.singleRoom && creep.memory.order && 'target' in creep.memory.order) {
                  const target = Game.getObjectById<RoomObject & _HasId>(creep.memory.order.target);
      Severity: Minor
      Found in src/role/transporter.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 addObjectResourceOptions has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          addObjectResourceOptions(options: TransporterSourceOrderOption[], findConstant: FIND_RUINS | FIND_TOMBSTONES | FIND_DROPPED_RESOURCES, optionType: 'resource' | 'tombstone') {
              const creep = this.creep;
      
              // Look for resources on the ground.
              const targets = creep.room.find(findConstant, {
      Severity: Minor
      Found in src/role/transporter.ts - About 1 hr to fix

        Function addObjectEnergySourceOptions has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            addObjectEnergySourceOptions(options: TransporterSourceOrderOption[], findConstant: FIND_RUINS | FIND_TOMBSTONES | FIND_DROPPED_RESOURCES, optionType: 'resource' | 'tombstone', storagePriority: number) {
                const creep = this.creep;
        
                // Get storage location, since that is a low priority source for transporters.
                const storagePosition = creep.room.getStorageLocation();
        Severity: Minor
        Found in src/role/transporter.ts - About 1 hr to fix

          Function run has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              run(creep: TransporterCreep) {
                  this.creep = creep;
          
                  if (creep.memory.singleRoom && creep.memory.order && 'target' in creep.memory.order) {
                      const target = Game.getObjectById<RoomObject & _HasId>(creep.memory.order.target);
          Severity: Minor
          Found in src/role/transporter.ts - About 1 hr to fix

            Function addContainerResourceOptions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                addContainerResourceOptions(options: TransporterSourceOrderOption[]) {
                    const room = this.creep.room;
                    // We need a decent place to store these resources.
                    if (!room.terminal && !room.storage) return;
            
            
            Severity: Minor
            Found in src/role/transporter.ts - About 1 hr to fix

              Function performGetResources has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  performGetResources(sourceCallback?: () => void) {
                      const creep = this.creep;
                      if (!sourceCallback) {
                          sourceCallback = () => {
                              this.calculateSource();
              Severity: Minor
              Found in src/role/transporter.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 addHighLevelResourceOptions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  addHighLevelResourceOptions(options: TransporterSourceOrderOption[]) {
                      const room = this.creep.room;
                      if (room.isEvacuating()) return;
              
                      // Take ghodium if nuker needs it.
              Severity: Minor
              Found in src/role/transporter.ts - About 1 hr to fix

                Function bayUnstuck has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    bayUnstuck(): boolean {
                        const creep = this.creep;
                        // If the creep is in a bay, but not delivering to that bay (any more), make it move out of the bay forcibly.
                        for (const bay of creep.room.bays) {
                            if (creep.pos.x !== bay.pos.x || creep.pos.y !== bay.pos.y) continue;
                Severity: Minor
                Found in src/role/transporter.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 addHighLevelResourceOptions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    addHighLevelResourceOptions(options: TransporterSourceOrderOption[]) {
                        const room = this.creep.room;
                        if (room.isEvacuating()) return;
                
                        // Take ghodium if nuker needs it.
                Severity: Minor
                Found in src/role/transporter.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

                Consider simplifying this complex logical expression.
                Open

                        else if (
                            creep.store.getUsedCapacity() <= creep.store.getCapacity() * 0.1
                            && !_.some(getResourcesIn(creep.store), resourceType => resourceType !== RESOURCE_ENERGY && creep.store.getUsedCapacity(resourceType) > 0)
                            && creep.memory.delivering // Don't switch state if we're currently filling a bay.
                            && (!creep.memory.order || !isResourceDestinationOrder(creep.room, creep.memory.order) || !isBayDestinationOrder(creep.memory.order))
                Severity: Major
                Found in src/role/transporter.ts - About 1 hr to fix

                  Function addEvacuatingRoomResourceOptions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      addEvacuatingRoomResourceOptions(options: TransporterSourceOrderOption[]) {
                          const room = this.creep.room;
                          if (!room.isEvacuating()) return;
                  
                          // Take everything out of labs.
                  Severity: Minor
                  Found in src/role/transporter.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 ensureValidResourceSource has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      ensureValidResourceSource(order: TransporterOrder, calculateSourceCallback: () => void): order is TransporterGetEnergyOrder | ResourceSourceTask {
                          const creep = this.creep;
                  
                          if (!order) {
                              calculateSourceCallback();
                  Severity: Minor
                  Found in src/role/transporter.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

                  Consider simplifying this complex logical expression.
                  Open

                          if (!creep.room.storage && storagePosition && creep.pos.x === storagePosition.x && creep.pos.y === storagePosition.y && (!creep.memory.order || !('target' in creep.memory.order))) {
                              creep.move(_.random(1, 8) as DirectionConstant);
                              return;
                          }
                  Severity: Major
                  Found in src/role/transporter.ts - About 40 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            if (target instanceof Resource && target.amount > 0) return true;
                    Severity: Major
                    Found in src/role/transporter.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              if ('store' in target && ((target as AnyStoreStructure).store.getUsedCapacity(resourceType)) > 0) return true;
                      Severity: Major
                      Found in src/role/transporter.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                if (creep.memory.singleRoom && target.pos.roomName !== creep.memory.singleRoom) return false;
                        Severity: Major
                        Found in src/role/transporter.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return false;
                          Severity: Major
                          Found in src/role/transporter.ts - About 30 mins to fix

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

                                        if (store[RESOURCE_ENERGY] < creep.store.getCapacity() * 2) {
                                            option.priority -= creep.room.getCreepsWithOrder('getEnergy', target.id).length * 3;
                                            option.priority -= creep.room.getCreepsWithOrder('getResource', target.id).length * 3;
                                        }
                            Severity: Major
                            Found in src/role/transporter.ts and 1 other location - About 3 hrs to fix
                            src/role/transporter.ts on lines 636..639

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

                            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 (store[resourceType] < creep.store.getCapacity() * 2) {
                                                option.priority -= creep.room.getCreepsWithOrder('getEnergy', target.id).length * 2;
                                                option.priority -= creep.room.getCreepsWithOrder('getResource', target.id).length * 2;
                                            }
                            Severity: Major
                            Found in src/role/transporter.ts and 1 other location - About 3 hrs to fix
                            src/role/transporter.ts on lines 571..574

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

                            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

                            function isResourceDestinationOrder(room: Room, order: TransporterOrder): order is ResourceDestinationTask {
                                if ('type' in order && room.destinationDispatcher.hasProvider(order.type)) {
                                    return true;
                                }
                            
                            
                            Severity: Major
                            Found in src/role/transporter.ts and 1 other location - About 1 hr to fix
                            src/role/transporter.ts on lines 98..104

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

                            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

                            function isResourceSourceOrder(room: Room, order: TransporterOrder): order is ResourceSourceTask {
                                if ('type' in order && room.sourceDispatcher.hasProvider(order.type)) {
                                    return true;
                                }
                            
                            
                            Severity: Major
                            Found in src/role/transporter.ts and 1 other location - About 1 hr to fix
                            src/role/transporter.ts on lines 82..88

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

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

                            type TransporterPositionOrderOption = {
                                priority: number;
                                weight: number;
                                type: 'position';
                                object: RoomPosition;
                            Severity: Minor
                            Found in src/role/transporter.ts and 2 other locations - About 35 mins to fix
                            src/role/transporter.ts on lines 21..27
                            src/role/transporter.ts on lines 37..43

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

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

                            type TransporterStructureOrderOption = {
                                priority: number;
                                weight: number;
                                type: 'structure';
                                object: AnyStoreStructure;
                            Severity: Minor
                            Found in src/role/transporter.ts and 2 other locations - About 35 mins to fix
                            src/role/transporter.ts on lines 37..43
                            src/role/transporter.ts on lines 45..51

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

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

                            type TransporterPickupOrderOption = {
                                priority: number;
                                weight: number;
                                type: 'resource';
                                object: Resource;
                            Severity: Minor
                            Found in src/role/transporter.ts and 2 other locations - About 35 mins to fix
                            src/role/transporter.ts on lines 21..27
                            src/role/transporter.ts on lines 45..51

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

                            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

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

                                        if (creep.pos.x !== bay.pos.x || creep.pos.y !== bay.pos.y) continue;
                            Severity: Minor
                            Found in src/role/transporter.ts and 1 other location - About 35 mins to fix
                            src/role/harvester.ts on lines 203..203

                            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