jkawamoto/dsargparse

View on GitHub

Showing 4 of 71 total issues

Function add_parser has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def add_parser(self, func=None, name=None, **kwargs):
        """Add parser.

        This method makes a new sub command parser. It takes same arguments
        as add_parser() of the action class made by
Severity: Minor
Found in dsargparse.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 _parse_doc has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def _parse_doc(doc):
    """Parse a docstring.

    Parse a docstring and extract three components; headline, description,
    and map of arguments to help texts.
Severity: Minor
Found in dsargparse.py - About 45 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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, main=None, argmap=None, *args, **kwargs):
        if main:
            if _DESCRIPTION not in kwargs or not kwargs[_DESCRIPTION]:
                info = _parse_doc(inspect.getmodule(main).__doc__)
                kwargs[_DESCRIPTION] = info[_DESCRIPTION]
Severity: Minor
Found in dsargparse.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_argument has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def add_argument(self, *args, **kwargs):
        """Add an argument.

        This method adds a new argument to the current parser. The function is
        same as ``argparse.ArgumentParser.add_argument``. However, this method
Severity: Minor
Found in dsargparse.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