bjmorgan/lattice_mc

View on GitHub

Showing 11 of 24 total issues

File lattice.py has 401 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import numpy as np
import random
import itertools
import sys

Severity: Minor
Found in lattice_mc/lattice.py - About 5 hrs to fix

    File simulation.py has 270 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from lattice_mc import init_lattice, species, lookup_table
    
    class Simulation:
        """
        Simulation class
    Severity: Minor
    Found in lattice_mc/simulation.py - About 2 hrs to fix

      Function potential_jumps has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def potential_jumps( self ):
              """
              All nearest-neighbour jumps not blocked by volume exclusion 
              (i.e. from occupied to neighbouring unoccupied sites).
      
      
      Severity: Minor
      Found in lattice_mc/lattice.py - 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 connected_sites has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def connected_sites( self, site_labels=None ):
              """
              Searches the lattice to find sets of sites that are contiguously neighbouring.
              Mutually exclusive sets of contiguous sites are returned as Cluster objects.
      
      
      Severity: Minor
      Found in lattice_mc/lattice.py - 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 generate_nearest_neighbour_lookup_table has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def generate_nearest_neighbour_lookup_table( self ):
              """
              Construct a look-up table of relative jump probabilities for a nearest-neighbour interaction Hamiltonian.
      
              Args:
      Severity: Minor
      Found in lattice_mc/lookup_table.py - 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 run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def run( self, for_time=None ):
              """
              Run the simulation.
      
              Args:
      Severity: Minor
      Found in lattice_mc/simulation.py - 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 enforce_periodic_boundary_conditions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def enforce_periodic_boundary_conditions( self ):
              """
              Ensure that all lattice sites are within the central periodic image of the simulation cell.
              Sites that are outside the central simulation cell are mapped back into this cell.
              
      Severity: Minor
      Found in lattice_mc/lattice.py - 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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__( self, number, coordinates, neighbours, energy, label, cn_energies=None ):
      Severity: Minor
      Found in lattice_mc/lattice_site.py - About 45 mins to fix

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

            def connected_site_pairs( self ):
                """
                Returns a dictionary of all connections between pair of sites (by site label).
                e.g. for a linear lattice A-B-C will return::
                
        Severity: Minor
        Found in lattice_mc/lattice.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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__( self, initial_site, final_site, nearest_neighbour_energy=False, coordination_number_energy=False, jump_lookup_table=None ):
        Severity: Minor
        Found in lattice_mc/jump.py - About 35 mins to fix

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

              def set_site_energies( self, energies ):
                  """
                  Set the energies for every site in the lattice according to the site labels.
          
                  Args:
          Severity: Minor
          Found in lattice_mc/lattice.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