Nikolay-Lysenko/readingbricks

View on GitHub

Showing 5 of 5 total issues

File resources.py has 327 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
Make resources.

Here, a resource is anything that has below properties:
1) it is used by the Flask application;
Severity: Minor
Found in readingbricks/resources.py - About 3 hrs to fix

    File query_processing.py has 279 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    Parse tag-based user queries and select matching notes.
    
    Author: Nikolay Lysenko
    """
    Severity: Minor
    Found in readingbricks/query_processing.py - About 2 hrs to fix

      Function make_resources_for_single_field has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def make_resources_for_single_field(
      Severity: Minor
      Found in readingbricks/resources.py - About 45 mins to fix

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

        def validate_internal_urls(internal_urls: list[str], headers: list[str], tags: list[str]) -> None:
            """Validate URLs pointing to other pages of the app."""
            # See comment about `INTERNAL_URL_PATTERN` - this is why `rstrip(')')` is applied.
            headers = [x.lstrip('# ').rstrip(')') for x in headers]
            for internal_url in internal_urls:
        Severity: Minor
        Found in git_hooks/pre_commit_hook.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 extract_cells has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def extract_cells(path_to_dir: str) -> Generator[dict[str, Any], None, None]:
            """
            Walk through directory and yield cells of notebooks from there.
        
            :param path_to_dir:
        Severity: Minor
        Found in readingbricks/utils.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