Showing 113 of 113 total issues

Consider simplifying this complex logical expression.
Open

        if self.subject or self.relation or self.object:
            if self.relation and not self.object:
                msg = "Missing Assertion Object"
                self.errors.append(ValidationError(type="Assertion", severity="Error", msg=msg))
            elif self.object and (not self.subject or not self.relation):
Severity: Major
Found in bel/lang/ast.py - About 40 mins to fix

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

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

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

      def find_functions(
      Severity: Minor
      Found in bel/lang/parse.py - About 35 mins to fix

        Function normalize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def normalize(
                self,
                canonical_targets: Mapping[str, List[str]] = settings.BEL_CANONICALIZE,
                decanonical_targets: Mapping[str, List[str]] = settings.BEL_DECANONICALIZE,
            ):
        Severity: Minor
        Found in bel/schemas/bel.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

        Function add_term has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def add_term(self):
                """Add term info"""
        
                if self.namespace_metadata and self.namespace_metadata.namespace_type == "complete":
                    self.term = bel.terms.terms.get_term(self.nsval.key)
        Severity: Minor
        Found in bel/schemas/bel.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

        Function update_index_state has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def update_index_state(collection, desired_indexes: List[IndexDefinition]):
            """Update index state
        
            desired_indexes keys = f"{index_type}_{'_'.join(sorted(fields))}", e.g. persistent_firstname_lastname
        
        
        Severity: Minor
        Found in bel/db/arangodb.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

        Function html_wrap_span has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def html_wrap_span(
            string: str, pairs: List[Tuple[int, int]], css_class: Optional[str] = "accentuate"
        ) -> str:
            """Wrap targeted area of Assertion with html highlighting
        
        
        Severity: Minor
        Found in bel/core/utils.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

        Function decanonicalize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def decanonicalize(
                self,
                canonical_targets: Mapping[str, List[str]] = settings.BEL_CANONICALIZE,
                decanonical_targets: Mapping[str, List[str]] = settings.BEL_DECANONICALIZE,
            ):
        Severity: Minor
        Found in bel/lang/ast.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

        Function preprocess_belscript has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def preprocess_belscript(lines):
            """ Convert any multi-line SET statements into single line SET statements"""
        
            set_flag = False
            for line in lines:
        Severity: Minor
        Found in bel/nanopub/belscripts.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

        Function migrate_ast has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def migrate_ast(ast: BELAst) -> BELAst:
        
            # Process Subject
            bo.ast.subject = convert(bo.ast.subject)
        
        
        Severity: Minor
        Found in bel/lang/migrate_1_2.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

        Function intersect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def intersect(pos: int, spans: List[Optional[Span]]) -> bool:
            """Check to see if pos intersects the provided spans - e.g. quotes"""
        
            if spans:
                for span in spans:
        Severity: Minor
        Found in bel/lang/parse.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

        Function get_orthologs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_orthologs(
                self,
                orthologs: List[dict] = None,
                orthologize_targets_keys: List[Key] = None,
            ):
        Severity: Minor
        Found in bel/lang/ast.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

        Function get_species_keys has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_species_keys(self, species_keys: List[str] = None):
                """Collect species associated with NSArgs
        
                Can have multiple species related to single Assertion
                """
        Severity: Minor
        Found in bel/lang/ast.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

        Function parse_book_record has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def parse_book_record(doc: dict, root) -> dict:
            """Parse Pubmed Book entry"""
        
            doc["title"] = next(iter(root.xpath("//BookTitle/text()")))
        
        
        Severity: Minor
        Found in bel/nanopub/pubmed.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

        Function get_cached_assertion_validations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_cached_assertion_validations(assertions, validation_level):
            """ Collect cached validations for assertions"""
        
            # Get hash keys for missing validations
            hashes = []
        Severity: Minor
        Found in bel/nanopub/validate.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

        Function decanonicalize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def decanonicalize(
                self,
                canonical_targets: Mapping[str, List[str]] = settings.BEL_CANONICALIZE,
                decanonical_targets: Mapping[str, List[str]] = settings.BEL_DECANONICALIZE,
            ):
        Severity: Minor
        Found in bel/lang/ast.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

        Function canonicalize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def canonicalize(
                self,
                canonical_targets: Mapping[str, List[str]] = settings.BEL_CANONICALIZE,
                decanonical_targets: Mapping[str, List[str]] = settings.BEL_DECANONICALIZE,
            ):
        Severity: Minor
        Found in bel/lang/ast.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

        Function get_cached_annotation_validations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_cached_annotation_validations(annotations):
            """ Collect cached validations for annotations"""
        
            # Get hash keys for missing validations
            hashes = []
        Severity: Minor
        Found in bel/nanopub/validate.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

        Function convert_fus has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def convert_fus(ast):
            """Convert BEL1 fus() to BEL2 fus()"""
        
            parent_fn_name = ast.name_short
            prefix_list = {"p": "p.", "r": "r.", "g": "c."}
        Severity: Minor
        Found in bel/lang/migrate_1_2.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

        Function canonicalize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def canonicalize(
                self,
                canonical_targets: Mapping[str, List[str]] = settings.BEL_CANONICALIZE,
                decanonical_targets: Mapping[str, List[str]] = settings.BEL_DECANONICALIZE,
            ):
        Severity: Minor
        Found in bel/lang/ast.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

        Severity
        Category
        Status
        Source
        Language