Showing 24 of 24 total issues
File client.py
has 537 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Anonymization web API client. Can interface with Anonymization server to retrieve,
create, modify anonymization jobs
"""
from typing import Dict
File parameters.py
has 526 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Parameters that are used to create jobs. Some are quite simple, like 'description'
which is just a input. Others are more complex, such as 'source' which has its own
type family and validation.
Put these in separate module because rows appear in several guises throughout
File mapper.py
has 515 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Makes it possible to map a structured file to batch of IDIS jobs.
The file should contain source files to anonymized id, name etc.
Pre-processing step for creating IDIS jobs
Notes
File create_commands.py
has 416 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Click group and commands for the 'create' subcommand"""
from typing import Dict, List, Optional
from pathlib import Path, PureWindowsPath
import click
File map_commands.py
has 388 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Click group and commands for the 'map' subcommand"""
import os
from pathlib import Path
from typing import List, Optional
File inputfile.py
has 376 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Classes and functions Reading job parameters from csv and excel files
These files contain tabular data with identifiers such as accession numbers
and optionally pseudonyms.
It is often easier to add such a file to a mapping programatically then to
Function __init__
has 25 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function as_kwargs
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def as_kwargs(self) -> Dict[str, Parameter]:
"""Parameters as keyword arguments
Raises
------
- 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_sections
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def parse_sections(cls, lines: Iterable[str]):
"""A mapping csv file consists of three sections divided by column_types.
Try to parse each one. Also cleans each line
Parameters
- 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 populate_nodes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def populate_nodes(self, root: click.core.Group):
"""Create a command and group overview recursively"""
# list all commands/ groups and help for them
node = ClickCommandOrGroupNode(
- 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 create_path_job
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_path_job(
Function create_pacs_job
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_pacs_job(
Function create_pacs_job
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_pacs_job(
Function create_path_job
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_path_job(
Function format
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def format(self, record: logging.LogRecord) -> str:
"""Print INFO level messages plainly, rest with level name prepended"""
if self.verbosity == Verbosities.TERSE:
if record.levelno == logging.INFO:
return self.format_record(record, "{msg}")
- 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 make_unc_paths
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def make_unc_paths(self, parameters: List[Parameter]):
"""A copy of this JobParameterSet where all paths are absolute UNC
paths. No relative paths, no mapped drive letters
Raises
- 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 skip
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def skip(app, what, name, obj, skip, options):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function iterate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def iterate(
self,
pattern="*",
recurse=True,
exclude_patterns=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 add
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add(