choderalab/yank

View on GitHub
Yank/yank.py

Summary

Maintainability
F
5 days
Test Coverage

File yank.py has 1051 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/local/bin/env python

# ==============================================================================
# MODULE DOCSTRING
# ==============================================================================
Severity: Major
Found in Yank/yank.py - About 2 days to fix

    Function select has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
    Open

        def select(self, selection, as_set=False, sort_by='auto', subset=None) -> Union[List[int], Set[int]]:
            """
            Select atoms based on selection format which can be a number of formats:
    
            * Single integer (a bit redundant)
    Severity: Minor
    Found in Yank/yank.py - About 1 day 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 create has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        def create(self, thermodynamic_state, sampler_states, topography, protocol,
                   storage, restraint=None, anisotropic_dispersion_cutoff=None,
                   alchemical_regions=None, alchemical_factory=None, metadata=None):
            """Create a new AlchemicalPhase calculation for a specified protocol.
    
    
    Severity: Minor
    Found in Yank/yank.py - About 4 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 _expand_state_cutoff has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def _expand_state_cutoff(thermodynamic_state, expanded_cutoff_distance,
                                 replace_reaction_field=False, switch_width=None):
            """Expand the thermodynamic state cutoff to the given one.
    
            If replace_reaction_field is True, the system will be modified
    Severity: Minor
    Found in Yank/yank.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 create has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def create(self, thermodynamic_state, sampler_states, topography, protocol,
    Severity: Major
    Found in Yank/yank.py - About 1 hr to fix

      Function create has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def create(self, thermodynamic_state, sampler_states, topography, protocol,
                     storage, restraint=None, anisotropic_dispersion_cutoff=None,
                     alchemical_regions=None, alchemical_factory=None, metadata=None):
              """Create a new AlchemicalPhase calculation for a specified protocol.
      
      
      Severity: Minor
      Found in Yank/yank.py - About 1 hr to fix

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

            def _find_similar_sampler_states(sampler_states):
                """Groups SamplerStates that have the same positions.
        
                Returns
                -------
        Severity: Minor
        Found in Yank/yank.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 create has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def create(self, thermodynamic_state, sampler_states, storage,
        Severity: Minor
        Found in Yank/yank.py - About 45 mins to fix

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

              def _minimize_sampler_state(sampler_state_id, sampler_states, thermodynamic_state,
                                          tolerance, max_iterations):
                  """Minimize the specified sampler state at the given thermodynamic state.
                  """
                  sampler_state = sampler_states[sampler_state_id]
          Severity: Minor
          Found in Yank/yank.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 _build_default_alchemical_region has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def _build_default_alchemical_region(system, topography, protocol):
                  """Create a default AlchemicalRegion if the user hasn't provided one."""
                  # TODO: we should probably have a second region that annihilate sterics of counterions.
                  alchemical_region_kwargs = {}
          
          
          Severity: Minor
          Found in Yank/yank.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

          There are no issues that match your filters.

          Category
          Status