Showing 36 of 74 total issues
File cli.py
has 710 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Definitions for command-line (Click) commands for invoking Annif
operations and printing the results to console."""
import collections
import importlib
File mllm.py
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""MLLM (Maui-like Lexical Matchin) model for Annif"""
from __future__ import annotations
import collections
File hfh_util.py
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Utility functions for interactions with Hugging Face Hub."""
import binascii
import configparser
import importlib
File project.py
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Project management functionality for Annif"""
from __future__ import annotations
import enum
AnnifProject
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class AnnifProject(DatadirMixin):
"""Class representing the configuration of a single Annif project."""
# defaults for uninitialized instances
_transform = None
Function run_detect_language
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def run_detect_language(languages, paths):
"""
Detect the language of a single text document from standard input or for one or more
document file(s) given its/their path(s).
"""
- 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 run_eval
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def run_eval(
Function filter_suggestion
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def filter_suggestion(
preds: csr_array,
limit: int | None = None,
threshold: float = 0.0,
) -> csr_array:
- 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 run_optimize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def run_optimize(project_id, paths, jobs, docs_limit, backend_param):
"""
Suggest subjects for documents, testing multiple limits and thresholds.
\f
This command will use different limit (maximum number of subjects) and
- 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 __iter__
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def __iter__(self) -> Iterator[tuple[str, str] | tuple[str, None]]:
"""Iterate through the directory, yielding tuples of (docfile,
subjectfile) containing file paths. If require_subjects is False, the
subjectfile will be returned as None."""
- 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 run_index
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def run_index(
Function run_eval
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def run_eval(
project_id,
paths,
limit,
threshold,
- 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 run_suggest
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def run_suggest(
Function run_hyperopt
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def run_hyperopt(project_id, paths, docs_limit, trials, jobs, metric, results_file):
Function run_suggest
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run_suggest(
project_id, paths, limit, threshold, language, backend_param, docs_limit
):
"""
Suggest subjects for a single document from standard input or for one or more
- 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 run_train
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def run_train(project_id, paths, cached, docs_limit, jobs, backend_param):
Function _find_subj_tsets
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _find_subj_tsets(self, tset: TokenSet) -> dict[int | None, TokenSet]:
"""return a dict (subject_id : TokenSet) of matches contained in the
given TokenSet"""
subj_tsets = {}
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function hyperopt
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def hyperopt(
Function prepare_train
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def prepare_train(