Futsch1/form-analyzer

View on GitHub
form_analyzer/selectors/select_base.py

Summary

Maintainability
A
1 hr
Test Coverage

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

    def __init__(self, selections: typing.List[str], filter_: Filter, alternative: typing.Union['TextField', 'TextFieldWithCheckbox'] = None,
Severity: Minor
Found in form_analyzer/selectors/select_base.py - About 35 mins to fix

    Function __check_exact_match has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def __check_exact_match(self, simple_selection: str, index: int, simple_fields: typing.List[SimpleField]) -> bool:
            for simple_field in simple_fields:
                if simple_field.key == simple_selection:
                    self.selection_matches[index] = Select.SelectionMatch(
                        Match.EXACT_SELECTED if simple_field.selected else Match.EXACT_NOT_SELECTED,
    Severity: Minor
    Found in form_analyzer/selectors/select_base.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 __check_similar_match has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def __check_similar_match(self, simple_selection: str, index: int, simple_fields: typing.List[SimpleField]) -> bool:
            match_found = False
            max_ratio = 0.9
            # Second pass: similar match
            for simple_field in simple_fields:
    Severity: Minor
    Found in form_analyzer/selectors/select_base.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 __check_part_match has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def __check_part_match(self, simple_selection: str, index: int, simple_fields: typing.List[SimpleField]):
            for simple_field in simple_fields:
                if simple_field.key in simple_selection:
                    self.selection_matches[index] = Select.SelectionMatch(
                        Match.SIMILAR_SELECTED if simple_field.selected else Match.SIMILAR_NOT_SELECTED,
    Severity: Minor
    Found in form_analyzer/selectors/select_base.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