SkierPGP/Skier

View on GitHub

Showing 42 of 42 total issues

Function translate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def translate(self, sig):
        if sig[2] == 32:
            return wrap("revoke")
        elif sig[2] == 24:
            return wrap("subsig")
Severity: Minor
Found in skier/keyinfo.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 _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

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

def import_from_dump(file):
    """Import from an SKS dump."""
    # First, load a new GPG instance.
    gpg = GPG(gnupghome="/tmp/skier-import")

Severity: Minor
Found in manager.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 from_keyinfo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def from_keyinfo(cls, obj):
        k = Key()
        for uid in obj.uid:
            k.uid.append(uid)

Severity: Minor
Found in db.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 search has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def search():
    if 'keyid' in request.args:
        page = request.args.get("page", 1)
        try:
            page = int(page)
Severity: Minor
Found in skier/frontend.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 _discovery has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _discovery(search_str: str) -> None:
    """
    Begin a discovery for new keys in a search.
    :param search_str: The string to search for.
    :return: None.
Severity: Minor
Found in skier/old/pgp.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

Avoid too many return statements within this function.
Open

            return wrap("sig-2")
Severity: Major
Found in skier/keyinfo.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return KeyInfo(uid=uid, keyid=keyid, fingerprint=fingerprint, length=length, algo=algo,
    Severity: Major
    Found in skier/keyinfo.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 "Invalid request", 400
        Severity: Major
        Found in skier/pks.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

              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 json.dumps({"code": 5, "err": "Key exists and unchanged"}), 400, {"Content-Type": "application/json"}
                Severity: Major
                Found in skier/pgpapi.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return wrap("sig-1")
                  Severity: Major
                  Found in skier/keyinfo.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return redirect(url_for("frontend.getkeyinfo", key=keyinfo.shortid, added=True)), 302
                    Severity: Major
                    Found in skier/frontend.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

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

                        Avoid too many return statements within this function.
                        Open

                                    return wrap("sig")
                        Severity: Major
                        Found in skier/keyinfo.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return json.dumps({"code": 0, "err": ""}), 200, {"Content-Type": "application/json"}
                          Severity: Major
                          Found in skier/pgpapi.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return wrap("sig??")
                            Severity: Major
                            Found in skier/keyinfo.py - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language