bjmorgan/lattice_mc

View on GitHub
lattice_mc/lattice.py

Summary

Maintainability
C
1 day
Test Coverage

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

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

    There are no issues that match your filters.

    Category
    Status