evalphobia/hierogolyph

View on GitHub

Showing 7 of 32 total issues

Function runDecrypt has 61 lines of code (exceeds 50 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

    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 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 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 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

            Severity
            Category
            Status
            Source
            Language