Vipyr/vimcryption

View on GitHub

Showing 6 of 58 total issues

Function vimcryption_read has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def vimcryption_read(self):
        """ General `read` function for dealing with reads in Vim using
            the encryption engine to append the decrypted lines
        """
        file_name = vim.eval('expand("<amatch>")')
Severity: Minor
Found in plugin/vimcryption.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 generate_round_keys has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def generate_round_keys(cipher_key):
        """ Generates and returns 11 round keys according to AES rules.
        """
        key_matrix = bytes_to_matrix(cipher_key)

Severity: Minor
Found in encryptionengine/aes128engine.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 decrypt has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def decrypt(self, file_handle, data):
        # type: (io.BytesIO, Union[Iterable[str], str])
        """ Block ciphers always decrypt blocks of a predefined size.  By default `decrypt` will consume
            `self.decrypt_blocksize` bytes and call `self.decrypt_block` on that to determine what
            to append to `data`.
Severity: Minor
Found in encryptionengine/engine.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 decrypt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def decrypt(self, file_handle, data):
        # type: (io.BytesIO, Union[List[str], str]):
        line = ""
        for bchar in self.byte_iter(file_handle):
            char = ""
Severity: Minor
Found in encryptionengine/engine.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 vimcryption_write has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def vimcryption_write(self, vim_buffer, mode):
        """ General `write` function for dealing with writes in Vim using
            the encryption engine to write encrypted lines.
        """
        file_name = vim.eval('expand("<amatch>")')
Severity: Minor
Found in plugin/vimcryption.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 block_iter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def block_iter(generator, block_size, pad):
        # type: (Iterable, int, Union[str, bytes])
        """ Generative iterator that yields a [byte] string of length `block_size`
            by concatenating characters yielded by `generator.  The final block
            is padded using `pad`.
Severity: Minor
Found in encryptionengine/engine.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