pylhc/generic_parser

View on GitHub
generic_parser/entrypoint_parser.py

Summary

Maintainability
D
1 day
Test Coverage
C
78%

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

    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 _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

    There are no issues that match your filters.

    Category
    Status