Showing 66 of 71 total issues
Function skos
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def skos(self) -> SubjectFileSKOS:
"""return the subject vocabulary from SKOS file"""
if self._skos_vocab is not None:
return self._skos_vocab
- 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run_index(
project_id, directory, suffix, force, limit, threshold, language, backend_param
):
"""
Index a directory with documents, suggesting subjects for each document.
- 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 _parse_line
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _parse_line(
line: str,
) -> tuple[str | None, str | None]:
uri = label = None
vals = line.split("\t")
- 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 parse_config
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_config(
projects_config_path: str,
) -> AnnifConfigDirectory | AnnifConfigCFG | AnnifConfigTOML | None:
if projects_config_path:
projects_config_path = check_config(projects_config_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 _write_train_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _write_train_file(self, corpus: DocumentCorpus, filename: str) -> None:
with open(filename, "w", encoding="utf-8") as trainfile:
for doc in corpus.documents:
text = self._normalize_text(doc.text)
if 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 _suggest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _suggest(self, text: str, params: dict[str, Any]) -> list[SubjectSuggestion]:
data = {"text": text}
if "project" in params:
data["project"] = params["project"]
- 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"