krassowski/declarative-parser

View on GitHub

Showing 7 of 7 total issues

File parser.py has 373 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import argparse
import textwrap
from collections import defaultdict
from copy import deepcopy
from traceback import print_exc
Severity: Minor
Found in declarative_parser/parser.py - About 4 hrs to fix

    Function analyze has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        def analyze(self, docstring: str):
            """Analyze docstring and collect arguments with descriptions.
    
            All arguments have to start with a lowercase letter, be followed
            with a colon (:) and then with the description of the argument.
    Severity: Minor
    Found in declarative_parser/constructor_parser.py - About 4 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 __init__ has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, constructor, docstring_type='google', **kwargs):
            """Initializes parser analyzing provided class constructor.
    
            Arguments:
                constructor:
    Severity: Minor
    Found in declarative_parser/constructor_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

    Avoid deeply nested control flow statements.
    Open

                            if value:
                                help_strings[argument].append(value)
    
    
    Severity: Major
    Found in declarative_parser/constructor_parser.py - About 45 mins to fix

      Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Minor
      Found in declarative_parser/parser.py - About 35 mins to fix

        Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, argument_definition, argument_sections, inline=False, indent_sensitive=False, skip=None):
        Severity: Minor
        Found in declarative_parser/constructor_parser.py - About 35 mins to fix

          Function __call__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  def __call__(self, parser, namespace, *args, **kwargs):
          Severity: Minor
          Found in declarative_parser/parser.py - About 35 mins to fix
            Severity
            Category
            Status
            Source
            Language