choderalab/protons

View on GitHub

Showing 347 of 347 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

def render_pep440(pieces):
    """Build up version string, with post-release "local version identifier".

    Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
    get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
Severity: Major
Found in versioneer.py and 1 other location - About 1 day to fix
protons/_version.py on lines 340..361

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 154.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

def render_pep440(pieces):
    """Build up version string, with post-release "local version identifier".

    Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
    get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
Severity: Major
Found in protons/_version.py and 1 other location - About 1 day to fix
versioneer.py on lines 1236..1258

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 154.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function _add_xml_titration_groups has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
Open

    def _add_xml_titration_groups(
        self,
        topology: app.Topology,
        system: mm.System,
        forcefield: app.ForceField,
Severity: Minor
Found in protons/app/driver.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 epik_results_to_mol2 has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
Open

def epik_results_to_mol2(
    epik_mae: str,
    output_mol2: str,
    patch_bonds: bool = True,
    keep_intermediate: bool = False,
Severity: Minor
Found in protons/app/ligands.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_hybrid_template has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
Open

    def _create_hybrid_template(self):
        """
        Interpolate differing atom types to create a single template state that has proper bonded terms for all atoms.
        """

Severity: Minor
Found in protons/app/ligands.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 process_dat_file has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

    def process_dat_file(self, inputfile):
        """Process an AMBER .dat file.

        Parameters
        ----------
Severity: Minor
Found in protons/app/amber_parser.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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        class cmd_build_exe(_build_exe):
            def run(self):
                root = get_root()
                cfg = get_config_from_root(root)
                versions = get_versions()
Severity: Major
Found in versioneer.py and 1 other location - About 1 day to fix
versioneer.py on lines 1600..1618

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 140.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        class cmd_py2exe(_py2exe):
            def run(self):
                root = get_root()
                cfg = get_config_from_root(root)
                versions = get_versions()
Severity: Major
Found in versioneer.py and 1 other location - About 1 day to fix
versioneer.py on lines 1571..1589

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 140.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File forcefield_generators.py has 513 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
"""
OpenMM ForceField residue template generators.

Adapted from openmoltools: https://github.com/choderalab/openmoltools.
Severity: Major
Found in protons/app/forcefield_generators.py - About 1 day to fix

    Function _cache_force has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
    Open

        def _cache_force(self, titration_group_index, titration_state_index):
            """
            Cache the force parameters for a single tautomer state.
    
            Parameters
    Severity: Minor
    Found in protons/app/driver.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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    def render_pep440_old(pieces):
        """TAG[.postDISTANCE[.dev0]] .
    
        The ".dev0" means dirty.
    
    
    Severity: Major
    Found in protons/_version.py and 1 other location - About 1 day to fix
    versioneer.py on lines 1304..1323

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 125.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    def render_pep440_old(pieces):
        """TAG[.postDISTANCE[.dev0]] .
    
        The ".dev0" means dirty.
    
    
    Severity: Major
    Found in versioneer.py and 1 other location - About 1 day to fix
    protons/_version.py on lines 407..426

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 125.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function generate_xml has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
    Open

        def generate_xml(self):
            """Return the processed forcefield files as an XML stream.
    
            Returns
            -------
    Severity: Minor
    Found in protons/app/amber_parser.py - About 7 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

    File openeye.py has 493 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """Adapted from openmoltools: https://github.com/choderalab/openmoltools.
    
    Original license and copyright:
    Copyright 2017 Kyle A. Beauchamp, John D. Chodera, David L. Mobley
    
    
    Severity: Minor
    Found in protons/app/openeye.py - About 7 hrs to fix

      Function patch_cooh has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
      Open

      def patch_cooh(source: str, residue_name: str, oh_type="oh", ho_type="ho") -> str:
          """Add COOH statements to protons ffxml templates and fix hydroxy atom types.
      
          Parameters
          ----------
      Severity: Minor
      Found in protons/app/template_patches.py - About 7 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

      File amber.py has 488 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """Adapted from openmoltools: https://github.com/choderalab/openmoltools.
      
      Original license and copyright:
      Copyright 2017 Kyle A. Beauchamp, John D. Chodera, David L. Mobley
      
      
      Severity: Minor
      Found in protons/app/amber.py - About 7 hrs to fix

        Function register_tautomers has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
        Open

            def register_tautomers(self, mol_graphs):
        
                # generate union mol graph
                # and register the atom_types, bonds, angles and torsions for the different mol_graphs (tautomers)
                superset_graph = nx.Graph()
        Severity: Minor
        Found in protons/app/ligands.py - About 7 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 generate_simulation_and_driver has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
        Open

        def generate_simulation_and_driver(settings):
        
            ofolder = settings['output']['dir']
            input_pdbx_file = settings['input']['dir'] + '/' + settings['name'] +  '.cif'
            custom_xml = settings['input']['dir'] + '/' + settings['name'] + '.ffxml'
        Severity: Minor
        Found in examples/tautomers/tautomer_utils.py - About 7 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 from_serialized_xml has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
        Open

            def from_serialized_xml(cls, state_element):
                """
                Deserialize a _TitrationState from a previously serialized xml tree
        
                Parameters
        Severity: Minor
        Found in protons/app/driver.py - About 6 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 _register_tautomers has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
        Open

        def _register_tautomers(isomers, isomer_index, oemolecule, pdb_file_path, residue_name):
            ffxml = isomers[isomer_index]["ffxml"]
        
            name_type_mapping = {}
            name_charge_mapping = {}
        Severity: Minor
        Found in protons/app/ligands.py - About 6 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

        Severity
        Category
        Status
        Source
        Language