skywarth/Fenrir-wolfpack-simulator

View on GitHub
modules/eventModule.js

Summary

Maintainability
B
4 hrs
Test Coverage

Function hunt has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    static hunt(){
        if(currentPreyScoutStatus)
        {simulationLogs.push(new simulationLog(currentDate,"Hunt", "Wolf pack is on the prowl according to their scout activity findings."));
            if(currentPreyCount>=1){
                simulationLogs.push(new simulationLog(currentDate,"Hunt", "Wolf pack has found the prey/prey group. Engaging now."));
Severity: Minor
Found in modules/eventModule.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 hunt has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    static hunt(){
        if(currentPreyScoutStatus)
        {simulationLogs.push(new simulationLog(currentDate,"Hunt", "Wolf pack is on the prowl according to their scout activity findings."));
            if(currentPreyCount>=1){
                simulationLogs.push(new simulationLog(currentDate,"Hunt", "Wolf pack has found the prey/prey group. Engaging now."));
Severity: Minor
Found in modules/eventModule.js - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

                            if(environment.preyType===keys[i]){
                                return values[i];
                            }
    Severity: Major
    Found in modules/eventModule.js - About 45 mins to fix

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

          static scouting(){
              let roll=chance.integer({min:0,max:100});//0 and 100 included in range
              //%25 chance to encounter wildcard wolves.
              //%75 chance to track and find preys
              //%20 chance to encounter predators
      Severity: Minor
      Found in modules/eventModule.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

      There are no issues that match your filters.

      Category
      Status