evalphobia/hierogolyph

View on GitHub

Showing 32 of 32 total issues

Function runDecrypt has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
Open

func runDecrypt(b *testing.B, conf Config) {
    h, err := CreateHierogolyph(testHierogolyph1.Password, conf)
    if err != nil {
        b.Error(err)
        return
Severity: Minor
Found in hierogolyph_benchmark_test.go - 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 runDecrypt has 9 return statements (exceeds 4 allowed).
Open

func runDecrypt(b *testing.B, conf Config) {
    h, err := CreateHierogolyph(testHierogolyph1.Password, conf)
    if err != nil {
        b.Error(err)
        return
Severity: Major
Found in hierogolyph_benchmark_test.go - About 55 mins to fix

    Method Hierogolyph.Decrypt has 8 return statements (exceeds 4 allowed).
    Open

    func (h Hierogolyph) Decrypt(cipherText string) (plainText string, err error) {
        encryptionKey, encryptedText, err := decodeCipherText(cipherText)
        if err != nil {
            return "", err
        }
    Severity: Major
    Found in hierogolyph.go - About 50 mins to fix

      Function runEncrypt has 5 return statements (exceeds 4 allowed).
      Open

      func runEncrypt(b *testing.B, conf Config) {
          h, err := CreateHierogolyph(testHierogolyph1.Password, conf)
          if err != nil {
              b.Error(err)
              return
      Severity: Major
      Found in hierogolyph_benchmark_test.go - About 35 mins to fix

        Function Decrypt has 5 return statements (exceeds 4 allowed).
        Open

        func Decrypt(cipherText, key []byte) (string, error) {
            // use first 32byte if the key length is longer than 32byte.
            if len(key) > 32 {
                key = key[0:32]
            }
        Severity: Major
        Found in crypto/aesgcm/crypto_aes_gcm.go - About 35 mins to fix

          Function runEncrypt has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
          Open

          func runEncrypt(b *testing.B, conf Config) {
              h, err := CreateHierogolyph(testHierogolyph1.Password, conf)
              if err != nil {
                  b.Error(err)
                  return
          Severity: Minor
          Found in hierogolyph_benchmark_test.go - 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

          exported type Cipher should have comment or be unexported
          Open

          type Cipher struct{}

          exported const KeySize should have comment (or a comment on this block) or be unexported
          Open

              KeySize    = chacha20poly1305.KeySize

          exported type Hasher should have comment or be unexported
          Open

          type Hasher interface {
          Severity: Minor
          Found in hasher/interface.go by golint

          exported type Config should have comment or be unexported
          Open

          type Config struct {
          Severity: Minor
          Found in config.go by golint

          exported type Cipher should have comment or be unexported
          Open

          type Cipher struct{}
          Severity: Minor
          Found in cipher/aesgcm/cipher_aes_gcm.go by golint

          2: cannot find package "github.com/evalphobia/hierogolyph/crypto/aesgcm" in any of:
          Open

              "github.com/evalphobia/hierogolyph/crypto/aesgcm"
          Severity: Minor
          Found in cipher/aesgcm/cipher_aes_gcm.go by govet
          Severity
          Category
          Status
          Source
          Language