SkierPGP/Skier

View on GitHub

Showing 37 of 42 total issues

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 -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 wrap("sig")
      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 -3
          Severity: Major
          Found in skier/pgpactions.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 ""
              Severity: Major
              Found in skier/pgpapi.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-2")
                  Severity: Major
                  Found in skier/keyinfo.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 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 wrap("sig??")
                        Severity: Major
                        Found in skier/keyinfo.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 json.dumps({"code": 0, "err": ""}), 200, {"Content-Type": "application/json"}
                            Severity: Major
                            Found in skier/pgpapi.py - About 30 mins to fix

                              Function search_through_keys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                              def search_through_keys(search_str: str, page: int=1, count: int=10) -> Pagination:
                                  """
                                  Searches through the keys via ID or UID name.
                                  :param search_str: The string to search for.
                                  Examples: '0xBF864998CDEEC2D390162087EB4084E3BF0192D9' for a fingerprint search
                              Severity: Minor
                              Found in skier/pgp.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 handle_key_broadcast has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def handle_key_broadcast():
                                      # Recieve a new key broadcast.
                                      if 'key' in request.form:
                                          key = request.form["key"]
                                      else:
                              Severity: Minor
                              Found in skier/pgpapi.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

                              Severity
                              Category
                              Status
                              Source
                              Language