skywarth/Fenrir-wolfpack-simulator

View on GitHub

Showing 11 of 72 total issues

Function calculateAlphaPoints has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

function calculateAlphaPoints(){
    for(let i=1;i<wolves.length;i++)
    {
        //age, diseases, anatomic sizes, marks, characteristics,
        let alphaP=100;
Severity: Minor
Found in modules/modifiers.js - About 6 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 calculateAlphaPoints has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function calculateAlphaPoints(){
    for(let i=1;i<wolves.length;i++)
    {
        //age, diseases, anatomic sizes, marks, characteristics,
        let alphaP=100;
Severity: Major
Found in modules/modifiers.js - About 2 hrs to fix

    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 calculateBiomeBasedHuntSuccesChance has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    function calculateBiomeBasedHuntSuccesChance(){
    
    
        for(let i=1;i<wolves.length;i++)
        {
    Severity: Minor
    Found in modules/modifiers.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 regularTrigger has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    function regularTrigger(){
        simulationLogs.push(new simulationLog(new simulationLog(currentDate,"Simulation","Simulation has started")));
        let bookmarkStart=0;
    
        for(let i=1;i<10;i++){
    Severity: Minor
    Found in modules/simulationModule.js - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function 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

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

      function calculateBiomeBasedHuntSuccesChance(){
      
      
          for(let i=1;i<wolves.length;i++)
          {
      Severity: Minor
      Found in modules/modifiers.js - About 1 hr to fix

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

        function regularTrigger(){
            simulationLogs.push(new simulationLog(new simulationLog(currentDate,"Simulation","Simulation has started")));
            let bookmarkStart=0;
        
            for(let i=1;i<10;i++){
        Severity: Minor
        Found in modules/simulationModule.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

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

            function calculateActiveClimateBasedBiasHuntChance(){
            
                if(currentWeatherEvent==="tornado"){
                activeClimateBasedBiasHuntChance=0;
                }
            Severity: Minor
            Found in modules/modifiers.js - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Severity
            Category
            Status
            Source
            Language