HumanCellAtlas/metadata-schema-publisher

View on GitHub

Showing 10 of 37 total issues

Function _process_directory has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

def _process_directory(repo, branch_name, base_server_path, server_path, version_numbers, context, dryrun=False):
    print("Processing " + server_path + " in " + branch_name + " branch of " + repo.name)
    created_list = []
    contents = repo.get_dir_contents(server_path, branch_name)
    for content in contents:
Severity: Minor
Found in handler.py - About 4 hrs 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 _find_value has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def _find_value(self, key, dictionary):
        for k, v in dictionary.items():
            if k == key:
                yield v
            elif isinstance(v, dict):
Severity: Minor
Found in release_prep.py - About 2 hrs 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 expand_urls has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def expand_urls(self, relative_path, file_data):
        version = self._find_schema_version(relative_path)

        el = relative_path.split("/")
        el.insert(len(el) - 1, version)
Severity: Minor
Found in release_prep.py - About 2 hrs 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 _replace_value has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def _replace_value(self, key, dictionary, old, new):
        for k in dictionary.keys():
            if k == key and dictionary[k] == old:
                dictionary[k] = new
            elif isinstance(dictionary[k], dict):
Severity: Minor
Found in release_prep.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 _upload has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def _upload(key, branch_name, file_data, context, dryrun=False):
    if dryrun:
        output_dir = 'dryrun'
        output_path = output_dir + '/' + key
        pos = output_path.rfind('/')
Severity: Minor
Found in handler.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 _process_directory has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def _process_directory(repo, branch_name, base_server_path, server_path, version_numbers, context, dryrun=False):
Severity: Major
Found in handler.py - About 50 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if created:
                                created_list.append(key)
                    else:
    Severity: Major
    Found in handler.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if "#" in el[i]:
                                  el.insert(i, v)
                                  break
                      else:
      Severity: Major
      Found in release_prep.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                for result in self._find_value(key, d):
                                    yield result
        
        
        Severity: Major
        Found in release_prep.py - About 45 mins to fix

          Function _upload has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def _upload(key, branch_name, file_data, context, dryrun=False):
          Severity: Minor
          Found in handler.py - About 35 mins to fix
            Severity
            Category
            Status
            Source
            Language