eight0153/CartPole-NEAT

View on GitHub

Showing 13 of 82 total issues

Function train has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Confirmed

    def train(self, n_episodes=100, n_steps=200, n_pso_episodes=5,
              debug_mode=False):
        """Train species of individuals.

        Arguments:
Severity: Minor
Found in neat/main.py - About 3 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 registerValidSW has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function registerValidSW(swUrl, config) {
    navigator.serviceWorker
        .register(swUrl)
        .then(registration => {
            registration.onupdatefound = () => {
Severity: Minor
Found in web/frontend/src/serviceWorker.js - About 1 hr to fix

    Function from_json has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def from_json(config):
            """Load a node object from JSON.
    
            Arguments:
                config: the JSON dictionary loaded from file.
    Severity: Minor
    Found in neat/node.py - 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

    Function speciate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def speciate(self):
            """Place creatures in the creatures into a species, or create a new
            species if no suitable species exists.
            """
            print('Segregating Communities...', end='')
    Severity: Minor
    Found in neat/population.py - 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

    Function compute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def compute(self, x):
            """Compute the output of the neural network graph.
    
            Arguments:
                x: the input vector (one dimensional).
    Severity: Minor
    Found in neat/graph.py - About 35 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 _perturb has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _perturb(self):
            """Add a small positive or negative number to the weights and biases
            in the connection and node genes.
            """
            for node_gene in self.node_genes:
    Severity: Minor
    Found in neat/genome.py - About 35 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 next_generation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def next_generation(self, generation_champ, population):
            """Get the species' next generation of creatures.
    
            Arguments:
                generation_champ: the best creature for the whole generation, who's
    Severity: Minor
    Found in neat/species.py - About 35 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 makes_the_grade has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def makes_the_grade(self, creature, n_steps):
            """Check if the creature 'passes' the environment.
    
            Returns: True if the creature passes, False otherwise.
            """
    Severity: Minor
    Found in neat/main.py - 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 record_video has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def record_video(self, creature, n_episodes=20, n_steps=200):
            """Record a video of the creature trying to solve the problem.
    
            Arguments:
                creature: the creature to record.
    Severity: Minor
    Found in neat/main.py - 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 train has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def train(self, n_episodes=10, n_steps=200):
            """Perform particle optimisation.
    
            Note: Modifies creature genotype and phenotype directly.
    
    
    Severity: Minor
    Found in neat/pso.py - 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 make_dict has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def make_dict(file):
            """Read a data file and generate a dictionary from it.
    
            Arguments:
                file: the opened file that contains the data.
    Severity: Minor
    Found in neat/name_generation.py - 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 to_ordinal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def to_ordinal(n):
        """Get the suffixed number.
    
        Returns: a string with then number  and the appropriate suffix.
    
    
    Severity: Minor
    Found in neat/name_generation.py - 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 print has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def print(self, msg, format_args=None, verbosity=Verbosity.MINIMAL):
            """Print a message whose visibility is controlled by the verbosity of
            the message and the graphs verbosity setting.
    
            Arguments:
    Severity: Minor
    Found in neat/graph.py - 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