SkierPGP/Skier

View on GitHub
skier/pgpactions.py

Summary

Maintainability
C
1 day
Test Coverage

Function import_key has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

def import_key(keyserver: str, keyid: str):
    """
    Attempts to import a key from the keyserver.
    :param keyserver: The keyserver to import from.
    :param keyid: The Key ID to import.
Severity: Minor
Found in skier/pgpactions.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 synch_keys has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

def synch_keys():
    print("Synching keys...")
    # We only synch once per bootup, because when a new key is added to any server, it's automatically distributed.
    # This ensures servers don't lag behind the rest of the pool.
    # Get the latest sync time.
Severity: Minor
Found in skier/pgpactions.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 _broadcast_add has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def _broadcast_add(key: db.Key):
    # Load the keyservers from the config file.
    keyservers = cfg.cfg.config.keyservers_synch
    for server in keyservers:
        assert isinstance(server, str)
Severity: Minor
Found in skier/pgpactions.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

Avoid too many return statements within this function.
Open

                return -1
Severity: Major
Found in skier/pgpactions.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                    return -4
    Severity: Major
    Found in skier/pgpactions.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return -3
      Severity: Major
      Found in skier/pgpactions.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return 0
        Severity: Major
        Found in skier/pgpactions.py - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status