Showing 120 of 121 total issues
Avoid deeply nested control flow statements. Open
if previous_thermo_state is not None:
computed_thermo_states.append(previous_thermo_state)
else:
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
-------
- Read upRead up
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
Avoid deeply nested control flow statements. Open
if char_per_str != 0:
idx = sorted_vals[i][0]
filtered_vals[idx] = filtered_vals[idx][:-char_per_str]
length_diff -= char_per_str
Avoid deeply nested control flow statements. Open
if is_processed and not resume_setup:
err_msg = 'molecule {} file'.format(molecule_id)
break
Function create
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def create(self, thermodynamic_state, sampler_states, storage,
Avoid deeply nested control flow statements. Open
if len(line_fields) > 1:
smiles_str = line_fields[1].strip()
else:
smiles_str = line_fields[0].strip()
Function find_alchemical_counterions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_alchemical_counterions(system, topography, region_name):
"""Return the atom indices of the ligand or solute counter ions.
In periodic systems, the solvation box needs to be neutral, and
if the decoupled molecule is charged, it will cause trouble. This
- Read upRead up
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 process_tool_directive
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process_tool_directive(directives, option, dispatch, allowed_values, yields_value=False):
"""Process a directive.
Parameters
----------
- Read upRead up
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
Avoid deeply nested control flow statements. Open
if v in combinatorial_id_nodes:
i = expanded_tree[update_node_key].index(v)
expanded_tree[update_node_key][i:i+1] = combinatorial_id_nodes[v]
elif update_node_val in combinatorial_id_nodes:
Function _cache_trailblaze_data
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _cache_trailblaze_data(checkpoint_dir_path, optimal_protocol, states_stds,
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, restrained_receptor_atoms=None, restrained_ligand_atoms=None,
Function process_tool_directive
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def process_tool_directive(directives, option, dispatch, allowed_values, yields_value=False):
Function _numerical_distance_integrand
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _numerical_distance_integrand(self, r, r0, spring_constant, kt):
Function _numerical_angle_integrand
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _numerical_angle_integrand(self, theta, theta0, spring_constant, kt):
Function call_constructor
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def call_constructor(parent_cls, constructor_description, special_conversions=None,
Function _numerical_torsion_integrand
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _numerical_torsion_integrand(self, phi, phi0, spring_constant, kt):
Function read_system_files
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def read_system_files(positions_file_path, parameters_file_path, system_options,
Function extract_analyzer_kwargs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def extract_analyzer_kwargs(args, quantities_as_strings=False):
import simtk.unit as unit
"""Return a dictionary with the keyword arguments to pass to the analyzer."""
- Read upRead up
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_alchemical_phase
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_alchemical_phase(self):
"""
Create the alchemical phase based on all the options
This only creates it, but does nothing else to prepare for simulations. The ``initialize_alchemical_phase``
- Read upRead up
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 pack_transformation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def pack_transformation(mol1_pos, mol2_pos, min_distance, max_distance):
"""Compute an affine transformation that solve clashes and fit mol2 in the box.
The method randomly shifts and rotates mol2 until all its atoms are within
min_distance and max_distance from mol1. The position of mol1 is kept fixed.
- Read upRead up
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"