Showing 37 of 37 total issues
File routes.py
has 373 lines of code (exceeds 250 allowed). Consider refactoring. Open
from pathlib import Path
from os.path import sep
from pkg_resources import require
from shutil import which
from datetime import datetime
File data.py
has 356 lines of code (exceeds 250 allowed). Consider refactoring. Open
import platform
import subprocess
import os
import shutil
from pathlib import Path
File cmd_exec.py
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
import shutil
import subprocess
import sys
import tempfile
Function command_args
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def command_args(self, command_index) -> List[str]:
"""
Convert the post request into a list of command line arguments
:param command_index: (int) the index for the command to get arguments for.
- 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_content
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def extract_content(self, beautsoup, selector=None):
"""converts html bookmark url to optimized markdown and saves images"""
url = self.url.rstrip("/")
- 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 override
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def override(self, user_conf: dict, nested_dict=None):
"""
This function enables an override of the default configuration with user values.
Acts smartly so as to only set options already set in the default config.
- 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
File input_fields.py
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
import click
from archivy.click_web.web_click_types import EmailParamType, PasswordParamType
Function config
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def config():
"""
Web View to edit and update configuration.
"""
- 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 _process_option
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _process_option(self, field_info):
vals = request.form.getlist(field_info.key)
if field_info.is_file:
if field_info.link_name:
# it's a file, append the file path
- 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 get_items
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_items(
collections=[], path="", structured=True, json_format=False, load_content=False
):
"""
Gets all dataobjs.
- 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 build_dir_tree
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def build_dir_tree(path, query_dir, load_content=False):
"""
Builds a structured tree of directories and data objects.
- **path**: name of the directory relative to the root directory.
- 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 process_bookmark_url
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def process_bookmark_url(self, raw_html=None):
"""Process url to get content for bookmark"""
if self.type not in ("bookmark", "pocket_bookmark") or not validators.url(
self.url
):
- 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 query_ripgrep
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def query_ripgrep(query):
"""
Uses ripgrep to search data with a simpler setup than ES.
Returns a list of dicts with detailed matches.
"""
- 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 type_attrs
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def type_attrs(self):
type_attrs = {}
if isinstance(self.param.type, click.File):
mode = self.param.type.mode
elif isinstance(self.param.type, click.Path):
- 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 config_form
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def config_form(current_conf, sub=0, allowed=vars(Config())):
"""
This function defines a Config form that loads default configuration values and creates inputs for each field option
- current_conf: object of current configuration that we will use to set the defaults
- 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 __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function factory
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def factory(key):
field_id = FieldId.from_string(key)
is_file = field_id.click_type.startswith("file")
is_path = field_id.click_type.startswith("path")
is_uploaded = key in request.files
- 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 unformat_file
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def unformat_file(path: str, out_dir: str):
"""
Converts normal md of file at `path` to formatted archivy markdown file, with yaml front matter
and a filename of format "{id}-{old_filename}.md"
"""
- 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 _process_help
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _process_help(help_text):
"""
Convert click command help into html to be presented to browser.
Respects the '\b' char used by click to mark pre-formatted blocks.
Also escapes html reserved characters in the help text.
- 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 search_frontmatter_tags
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def search_frontmatter_tags(tag=None):
"""
Returns a list of dataobj ids that have the given tag.
"""
from archivy.data import get_data_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"