detunized/lastpass-ruby

View on GitHub

Showing 8 of 8 total issues

Class Parser has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Parser
        # OpenSSL constant
        RSA_PKCS1_OAEP_PADDING = 4

        # Secure note types that contain account-like information
Severity: Minor
Found in lib/lastpass/parser.rb - About 2 hrs to fix

    Method parse_ACCT has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

            def self.parse_ACCT chunk, encryption_key
                StringIO.open chunk.payload do |io|
                    id = read_item io
                    name = decode_aes256_plain_auto read_item(io), encryption_key
                    group = decode_aes256_plain_auto read_item(io), encryption_key
    Severity: Minor
    Found in lib/lastpass/parser.rb - 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

    Method parse_private_key has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def self.parse_private_key encrypted_private_key, encryption_key
                decrypted = decode_aes256 "cbc",
                                          encryption_key[0, 16],
                                          decode_hex(encrypted_private_key),
                                          encryption_key
    Severity: Minor
    Found in lib/lastpass/parser.rb - About 1 hr to fix

      Method initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def initialize id, name, username, password, url, notes, group
      Severity: Major
      Found in lib/lastpass/account.rb - About 50 mins to fix

        Method request_login has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                def self.request_login username,
                                       password,
                                       key_iteration_count,
                                       multifactor_password = nil,
                                       client_id = nil,
        Severity: Minor
        Found in lib/lastpass/fetcher.rb - About 45 mins to fix

          Method parse_accounts_and_notes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  def parse_accounts_and_notes chunks, encryption_key, private_key
                      accounts = []
                      notes = []
                      key = encryption_key
          
          
          Severity: Minor
          Found in lib/lastpass/vault.rb - 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

          Method request_login has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                  def self.request_login username,
                                         password,
                                         key_iteration_count,
                                         multifactor_password = nil,
                                         client_id = nil,
          Severity: Minor
          Found in lib/lastpass/fetcher.rb - 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

          Method create_session has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                  def self.create_session parsed_response, key_iteration_count
                      ok = (parsed_response["response"] || {})["ok"]
                      if ok.is_a? Hash
                          session_id = ok["sessionid"]
                          if session_id.is_a? String
          Severity: Minor
          Found in lib/lastpass/fetcher.rb - 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

          Severity
          Category
          Status
          Source
          Language