choderalab/yank

View on GitHub
Yank/schema/validator.py

Summary

Maintainability
D
1 day
Test Coverage

File validator.py has 440 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import os
import collections
import copy
import inspect
import logging
Severity: Minor
Found in Yank/schema/validator.py - About 6 hrs to fix

    YANKCerberusValidator has 28 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class YANKCerberusValidator(cerberus.Validator):
        """
        Custom cerberus.Validator class for YANK extending the Validator to include all the methods needed
        by YANK
        """
    Severity: Minor
    Found in Yank/schema/validator.py - About 3 hrs to fix

      Function call_constructor has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      def call_constructor(parent_cls, constructor_description, special_conversions=None,
                           convert_quantity_strings=False, **default_kwargs):
          """Convert the constructor representation into an object.
      
          Parameters
      Severity: Minor
      Found in Yank/schema/validator.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 _check_with_math_expressions_variables_are_given has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def _check_with_math_expressions_variables_are_given(self, field, value):
              """Check that in the alchemical path math expressions and function variables are correctly configured."""
              if not ( (isinstance(value, dict) or isinstance(value, collections.OrderedDict)) ):
                  return
              # Check that there is at least one non-string value in the
      Severity: Minor
      Found in Yank/schema/validator.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 generate_signature_schema has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def generate_signature_schema(func, update_keys=None, exclude_keys=frozenset()):
          """Generate a dictionary to test function signatures with Cerberus' Schema.
      
          Parameters
          ----------
      Severity: Minor
      Found in Yank/schema/validator.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 call_constructor has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def call_constructor(parent_cls, constructor_description, special_conversions=None,
      Severity: Minor
      Found in Yank/schema/validator.py - About 35 mins to fix

        Function _check_with_lambda_between_0_and_1 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def _check_with_lambda_between_0_and_1(self, field, value):
                """Ensure keys which are lambda values are in fact between 0 and 1"""
                if "lambda_" not in field or not isinstance(value, list):
                    return
        
        
        Severity: Minor
        Found in Yank/schema/validator.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