pylhc/generic_parser

View on GitHub

Showing 9 of 9 total issues

File entrypoint_parser.py has 575 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
Entrypoint Parser
-----------------

This module contains high-level objects to manage the functionality of ``generic_parser``: entry
Severity: Major
Found in generic_parser/entrypoint_parser.py - About 1 day to fix

    File dict_parser.py has 376 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    Dictionary Parser
    -----------------
    
    This module holds classes to handle different `dictionaries` as argument containers.
    Severity: Minor
    Found in generic_parser/dict_parser.py - About 5 hrs to fix

      Function _handle_commandline has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def _handle_commandline(self, args=None):
              """No input to function."""
              try:
                  # check for config file first
                  with silence():
      Severity: Minor
      Found in generic_parser/entrypoint_parser.py - About 2 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 _handle_kwargs has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def _handle_kwargs(self, kwargs):
              """**kwargs been input."""
              if ID_CONFIG in kwargs:
                  if len(kwargs) > 2 or (len(kwargs) == 2 and ID_SECTION not in kwargs):
                      raise ArgumentError(
      Severity: Minor
      Found in generic_parser/entrypoint_parser.py - About 2 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 _validate_parameters has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def _validate_parameters(dictionary):
              """
              Validates an input dictionary that can be used as parameters.
      
              Args:
      Severity: Minor
      Found in generic_parser/dict_parser.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 print_dict_tree has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def print_dict_tree(dictionary, name='Dictionary', print_fun=LOG.info):
          """Prints a dictionary as a tree."""
          def print_tree(tree, level_char):
              for i, key in enumerate(sorted(tree.keys())):
                  if i == len(tree) - 1:
      Severity: Minor
      Found in generic_parser/tools.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 get_multi_class has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_multi_class(*classes):
          """
          Create a class 'behaving' like all classes in `classes`.
      
          In case a value needs to be converted to a class in this list, it is attempted to cast the
      Severity: Minor
      Found in generic_parser/entry_datatypes.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 _check_parameter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def _check_parameter(self):
              """EntryPoint specific checks for parameter."""
              for param in self.parameter:
                  arg_name = param.get("name", None)
                  if arg_name is None:
      Severity: Minor
      Found in generic_parser/entrypoint_parser.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 parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse(self, *args, **kwargs):
              """
              Parse whatever input parameter come. This is the heart of EntryPoint and will recognize
              the input and parse it accordingly. Allowed inputs are:
                  - Dictionary with arguments as key-values.
      Severity: Minor
      Found in generic_parser/entrypoint_parser.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