Showing 5 of 5 total issues
File resources.py
has 327 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"""
Make resources.
Here, a resource is anything that has below properties:
1) it is used by the Flask application;
File query_processing.py
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"""
Parse tag-based user queries and select matching notes.
Author: Nikolay Lysenko
"""
Function make_resources_for_single_field
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def make_resources_for_single_field(
Function validate_internal_urls
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
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:
- Read upRead up
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
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:
- Read upRead up
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"