choderalab/protons

View on GitHub

Showing 347 of 347 total issues

Avoid too many return statements within this function.
Open

                        return False
Severity: Major
Found in protons/app/driver.py - About 30 mins to fix

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

    def plus_or_dot(pieces):
        """Return a + if we don't already have one, else return a ."""
        if "+" in pieces.get("closest-tag", ""):
            return "."
        return "+"
    Severity: Minor
    Found in versioneer.py and 1 other location - About 30 mins to fix
    protons/_version.py on lines 333..337

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

    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

    Avoid too many return statements within this function.
    Open

        return {"version": "0+unknown", "full-revisionid": None,
    Severity: Major
    Found in versioneer.py - About 30 mins to fix

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

      def plus_or_dot(pieces):
          """Return a + if we don't already have one, else return a ."""
          if "+" in pieces.get("closest-tag", ""):
              return "."
          return "+"
      Severity: Minor
      Found in protons/_version.py and 1 other location - About 30 mins to fix
      versioneer.py on lines 1229..1233

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

      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

      Avoid too many return statements within this function.
      Open

          return {
      Severity: Major
      Found in protons/_version.py - About 30 mins to fix

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

            def observed(self, titration_states: List[int]) -> np.float64:
                """Return the histogram count for the supplied state."""
                # In case of the one site sams approach, the sams weight is the total weight of every titration state
        
                counts = None
        Severity: Minor
        Found in protons/app/driver.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

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

            def free_energy(self, titration_states: List[int]) -> float:
                """Return the sams free energy value for the provided titration state.
        
                Parameters
                ----------
        Severity: Minor
        Found in protons/app/driver.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

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

        def run_proplister(input_file_path):
            """Run proplister utility on a file and return its properties.
        
            Parameters
            ----------
        Severity: Minor
        Found in protons/app/schrodinger.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

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

            def from_lists(
                cls,
                g_k,
                parameters,
                proton_count,
        Severity: Minor
        Found in protons/app/driver.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

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

            def _add_isomers(self):
                """
                Add all the isomer specific data to the xml template.
                """
        
        
        Severity: Minor
        Found in protons/app/ligands.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

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

            def _propose_random_change(
                self, proposal: _StateProposal, residue_pool: Optional[str] = None
            ) -> _TitrationAttemptData:
                """Use a given proposal mechanism to propose a titration state update for a given group of residues."""
                # Select which titratible residues to update.
        Severity: Minor
        Found in protons/app/driver.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

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

        def run_epik(
            input_file_path,
            output_file_path,
            max_structures=32,
            ph=7.4,
        Severity: Minor
        Found in protons/app/schrodinger.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

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

        def get_sd_bonds(sdfilename: str) -> List[Dict[Tuple[int, int], int]]:
            """Parse an SD file/MDL mol file and return a representation of the bonds.
        
            Parameters
            ----------
        Severity: Minor
        Found in protons/app/ligands.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

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

            def _complete_atom_registry(self):
                """
                Registers unique atom names. Store in self._atom_names from Residue
                """
                for state in self._input_state_data:
        Severity: Minor
        Found in protons/app/ligands.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

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

            def from_lists(
                cls,
                g_k: float,
                charges: List[float],
                proton_count: int,
        Severity: Minor
        Found in protons/app/driver.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

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

        def _find_hydrogen_types_for_tautomers(
            gafftree: lxml.etree.ElementTree, xmlfftree: lxml.etree.ElementTree
        ) -> set:
            """
            Find all atom types that describe hydrogen atoms.
        Severity: Minor
        Found in protons/app/ligands.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

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

        def cli() -> None:
            """Command line interface for protons run script."""
        
            args = sys.argv
        
        
        Severity: Minor
        Found in protons/scripts/cli.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

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

            def from_serialized_xml(cls, xmltree):
                """Create a titratable residue from a serialized titratable residue.
        
                Parameters
                ----------
        Severity: Minor
        Found in protons/app/driver.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

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

        def generate_protons_ffxml(
            inputmol2: str,
            isomer_dicts: list,
            outputffxml: str,
            pH: float,
        Severity: Minor
        Found in protons/app/ligands.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

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

            def target(self, titration_states: List[int]) -> np.float64:
                """Return the target weight for the supplied state."""
                # In case of the one site sams approach, the sams weight is the total weight of every titration state
        
                weight = None
        Severity: Minor
        Found in protons/app/driver.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