debatelab/deepa2

View on GitHub

Showing 44 of 44 total issues

Avoid too many return statements within this function.
Open

        return "not-formatted"
Severity: Major
Found in deepa2/parsers.py - About 30 mins to fix

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

        def configure_product(self) -> None:
            # populate product with configs
            i = 0
            for label in ["entailment", "contradiction"]:
                # argument_mask specifies which part of argument will be dropped in source text:
    Severity: Minor
    Found in deepa2/builder/nli_builder.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 produce_da2item has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def produce_da2item(self) -> None:
            # we produce a single da2item per input only
            record = self._product[0]
            record.source_text = str(self.input.text)
            if self.input.reasons:
    Severity: Minor
    Found in deepa2/builder/aifdb_builder.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 test_processor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def test_processor(self, processed_examples):
            """compares given and constructed da2items feature-wise"""
    
            for i, processed_example in enumerate(processed_examples):
                da2item_gen = DeepA2Item.from_batch(
    Severity: Minor
    Found in deepa2/testing/buildertester.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