Showing 25 of 25 total issues
Function get_messages
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def get_messages(
files: Iterable[Path],
progress_callback: Callable,
with_content=True,
with_headers=False,
- 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_entities
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def extract_entities(
files: Iterable[Path],
session: Session,
spacy_model: Language,
include_message_contents: bool = False,
- 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 cli.py
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
# pylint: disable=unused-argument
"""
Command-line interface for libratom
"""
File pff.py
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
# pylint: disable=consider-using-ternary,attribute-defined-outside-init
"""
PFF parsing utilities. Requires libpff.
"""
Function get_spacy_models
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_spacy_models() -> Dict[str, List[str]]:
releases = {}
paginated_url = "https://api.github.com/repos/explosion/spacy-models/releases?page=1&per_page=100"
- 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_mime_type
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _get_mime_type(self, attachment: pypff.attachment) -> Optional[str]:
entries = attachment.record_sets[0].entries
# Try known positions first
- 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_message
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def process_message(
Function _decode_mime_type
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _decode_mime_type(self, data: bytes) -> Optional[str]:
for encoding in self._encodings:
try:
mime_type = data.decode(encoding).rstrip("\0")
- 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_entities
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def extract_entities(
Function get_attachment_metadata
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_attachment_metadata(
self, message: pypff.message
) -> List[AttachmentMetadata]:
"""
Returns the metadata of all attachments in a given message
- 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 load_spacy_model
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def load_spacy_model(spacy_model_name: str) -> Tuple[Optional[Language], Optional[str]]:
"""
Loads and returns a given spaCy model
If the model is not present, an attempt will be made to download and install it
- 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
Avoid deeply nested control flow statements. Open
if name != "Name":
media_types.append(f"{file.stem}/{name.split(maxsplit=1)[0]}")
Function entities
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def entities(
Function entities
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def entities(out, spacy_model, include_message_contents, jobs, src, progress):
Function generate_report
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def generate_report(
files: Iterable[Path],
session: Session,
include_message_contents: bool = False,
progress_callback: Optional[Callable] = 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 entities
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def entities(
out: Path,
spacy_model_name: str,
jobs: Optional[int],
src: 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 report
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def report(out, include_message_contents, jobs, src, progress):
Function store_configuration_in_db
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def store_configuration_in_db(
Function report
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def report(
Function get_messages
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_messages(