sjoerdk/anonapi

View on GitHub

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

Severity: Major
Found in anonapi/client.py - About 1 day to fix

    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
    Severity: Major
    Found in anonapi/parameters.py - About 1 day to fix

      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
      Severity: Major
      Found in anonapi/mapper.py - About 1 day to fix

        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
        Severity: Minor
        Found in anonapi/cli/create_commands.py - About 6 hrs to fix

          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
          
          
          Severity: Minor
          Found in anonapi/cli/map_commands.py - About 5 hrs to fix

            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
            Severity: Minor
            Found in anonapi/inputfile.py - About 5 hrs to fix

              Function __init__ has 25 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(
              Severity: Major
              Found in anonapi/responses.py - About 3 hrs to fix

                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
                        ------
                Severity: Minor
                Found in anonapi/cli/create_commands.py - About 1 hr to fix

                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
                Severity: Minor
                Found in anonapi/mapper.py - About 1 hr to fix

                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(
                Severity: Minor
                Found in docs/generator/generate_command_reference.rst.py - About 1 hr to fix

                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(
                Severity: Major
                Found in anonapi/client.py - About 1 hr to fix

                  Function create_pacs_job has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def create_pacs_job(
                  Severity: Major
                  Found in anonapi/client.py - About 1 hr to fix

                    Function create_pacs_job has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def create_pacs_job(
                    Severity: Major
                    Found in anonapi/testresources.py - About 1 hr to fix

                      Function create_path_job has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def create_path_job(
                      Severity: Major
                      Found in anonapi/testresources.py - About 1 hr to fix

                        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
                        Severity: Minor
                        Found in anonapi/cli/create_commands.py - About 55 mins to fix

                        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 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}")
                        Severity: Minor
                        Found in anonapi/logging.py - About 55 mins to fix

                        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):
                        Severity: Minor
                        Found in docs/sphinx/conf.py - About 45 mins to fix

                          Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def __init__(
                          Severity: Minor
                          Found in anonapi/settings.py - About 45 mins to fix

                            Function iterate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def iterate(
                                    self,
                                    pattern="*",
                                    recurse=True,
                                    exclude_patterns=None,
                            Severity: Minor
                            Found in anonapi/selection.py - About 45 mins to fix

                            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(
                            Severity: Minor
                            Found in anonapi/cli/select_commands.py - About 35 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language