HumanCellAtlas/ingest-archiver

View on GitHub
archiver/archiver.py

Summary

Maintainability
D
2 days
Test Coverage

File archiver.py has 605 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import json
import logging
import sys

import polling as polling
Severity: Major
Found in archiver/archiver.py - About 1 day to fix

    Function _convert has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def _convert(self, assay_bundle: AssayBundle):
            aggregator = ArchiveEntityAggregator(assay_bundle, alias_prefix=self.alias_prefix)
    
            entities = []
            for archive_entity_type in ["project", "study", "sample", "sequencingExperiment", "sequencingRun"]:
    Severity: Minor
    Found in archiver/archiver.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 get_conversion_summary has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_conversion_summary(self):
            summary = {}
            for entities_dict in self.entities_dict_type.values():
                for entity in entities_dict.values():
                    if entity.conversion and not entity.errors:
    Severity: Minor
    Found in archiver/archiver.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 notify_file_archiver has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def notify_file_archiver(self, archive_submission: ArchiveSubmission):
    
            messages = []
            # TODO a bit redundant with converter, refactor this
            for entity in archive_submission.converted_entities:
    Severity: Minor
    Found in archiver/archiver.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, ingest_api, usi_api, ontology_api, exclude_types=None, alias_prefix=None):
    Severity: Minor
    Found in archiver/archiver.py - About 45 mins to fix

      Function get_converted_entities has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_converted_entities(self):
              for entities_dict in self.entities_dict_type.values():
                  for entity in entities_dict.values():
                      if entity.conversion and not entity.errors:
                          yield entity
      Severity: Minor
      Found in archiver/archiver.py - About 35 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 get_all_validation_errors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_all_validation_errors(self):
              get_validation_results_url = self.usi_submission['_links']['validationResults']['href']
              validation_results = self.usi_api.get_validation_results(get_validation_results_url)
      
              errors = []
      Severity: Minor
      Found in archiver/archiver.py - About 25 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 validate_and_submit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate_and_submit(self):
              if not self.usi_submission:
                  return self
      
              print("Waiting for the submission to be validated in USI...")
      Severity: Minor
      Found in archiver/archiver.py - About 25 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

      There are no issues that match your filters.

      Category
      Status