bparzella/secsgem

View on GitHub
data/function.py

Summary

Maintainability
C
7 hrs
Test Coverage

Function has 27 functions (exceeds 20 allowed). Consider refactoring.
Open

class Function:  # pylint: disable=too-many-instance-attributes
    """Function configuration from yaml."""

    sf_regex = re.compile(r"[sS](\d+)[fF](\d+)")

Severity: Minor
Found in data/function.py - About 3 hrs to fix

    File function.py has 266 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """Function class definition."""
    import collections
    import re
    import typing
    
    
    Severity: Minor
    Found in data/function.py - About 2 hrs to fix

      Function _load_samples has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def _load_samples(self) -> typing.Tuple[typing.List[typing.Dict[str, typing.Any]], typing.Optional[typing.Type]]:
              if "sample_data" not in self._data:
                  sample_data = [{"data": ""}]
              else:
                  sample_data = self._data["sample_data"]
      Severity: Minor
      Found in data/function.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 _find_items has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def _find_items(self, structure, items):
              if not isinstance(structure, list):
                  if structure in self._data_items:
                      data_item = self._data_items[structure]
                      if data_item not in items:
      Severity: Minor
      Found in data/function.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

      There are no issues that match your filters.

      Category
      Status