lainiwa/buglog

View on GitHub

Showing 5 of 5 total issues

Function cli has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

def cli() -> None:
    # Pick bugs via fzf
    picked_bugs = fuzzy_pick_bug()
    if not picked_bugs:
        return
Severity: Minor
Found in src/buglog/cli.py - About 3 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 rst_to_bugs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def rst_to_bugs(text: str) -> Iterator[Union[Bug, ValidationError]]:
    def _map_items_to_strings(
        bug_class: Type[Bug], line: str
    ) -> Tuple[str, str]:
        props = bug_class.schema()["properties"]
Severity: Minor
Found in src/buglog/parse_rst.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 bugs_save_dialog has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def bugs_save_dialog(bugs: Iterable[Bug]) -> None:
    # Let the user choose the appropriate dates
    char = user_read_character("[K]eep current date or [t]oggle: ")
    text = ""
    for bug in bugs:
Severity: Minor
Found in src/buglog/cli.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 user_read_character has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def user_read_character(*args: str) -> str:
    """Read single character.

    Prompt user with the lines passed as parameters,
    and then wait for a valid keypress. The possible
Severity: Minor
Found in src/buglog/prompt.py - About 35 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

Avoid too many return statements within this function.
Open

            return
Severity: Major
Found in src/buglog/cli.py - About 30 mins to fix
    Severity
    Category
    Status
    Source
    Language