tlsfuzzer/tlslite-ng

View on GitHub

Showing 1,708 of 1,708 total issues

Similar blocks of code found in 14 locations. Consider refactoring.
Open

T2 = (0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b,
      0xdfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5,
      0x50603030, 0x3020101, 0xa9ce6767, 0x7d562b2b,
      0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676,
      0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d,
Severity: Major
Found in tlslite/utils/rijndael.py and 13 other locations - About 2 days to fix
tlslite/utils/rijndael.py on lines 51..82
tlslite/utils/rijndael.py on lines 85..116
tlslite/utils/rijndael.py on lines 118..181
tlslite/utils/rijndael.py on lines 248..311
tlslite/utils/rijndael.py on lines 313..376
tlslite/utils/rijndael.py on lines 378..441
tlslite/utils/rijndael.py on lines 443..506
tlslite/utils/rijndael.py on lines 508..571
tlslite/utils/rijndael.py on lines 573..636
tlslite/utils/rijndael.py on lines 638..701
tlslite/utils/rijndael.py on lines 703..766
tlslite/utils/rijndael.py on lines 768..831
tlslite/utils/rijndael.py on lines 833..896

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 262.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 14 locations. Consider refactoring.
Open

U2 = (0x0, 0xb0e090d, 0x161c121a, 0x1d121b17,
      0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23,
      0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f,
      0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b,
      0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7,
Severity: Major
Found in tlslite/utils/rijndael.py and 13 other locations - About 2 days to fix
tlslite/utils/rijndael.py on lines 51..82
tlslite/utils/rijndael.py on lines 85..116
tlslite/utils/rijndael.py on lines 118..181
tlslite/utils/rijndael.py on lines 183..246
tlslite/utils/rijndael.py on lines 248..311
tlslite/utils/rijndael.py on lines 313..376
tlslite/utils/rijndael.py on lines 378..441
tlslite/utils/rijndael.py on lines 443..506
tlslite/utils/rijndael.py on lines 508..571
tlslite/utils/rijndael.py on lines 573..636
tlslite/utils/rijndael.py on lines 638..701
tlslite/utils/rijndael.py on lines 768..831
tlslite/utils/rijndael.py on lines 833..896

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 262.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 14 locations. Consider refactoring.
Open

U3 = (0x0, 0xd0b0e09, 0x1a161c12, 0x171d121b,
      0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f,
      0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253,
      0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77,
      0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b,
Severity: Major
Found in tlslite/utils/rijndael.py and 13 other locations - About 2 days to fix
tlslite/utils/rijndael.py on lines 51..82
tlslite/utils/rijndael.py on lines 85..116
tlslite/utils/rijndael.py on lines 118..181
tlslite/utils/rijndael.py on lines 183..246
tlslite/utils/rijndael.py on lines 248..311
tlslite/utils/rijndael.py on lines 313..376
tlslite/utils/rijndael.py on lines 378..441
tlslite/utils/rijndael.py on lines 443..506
tlslite/utils/rijndael.py on lines 508..571
tlslite/utils/rijndael.py on lines 573..636
tlslite/utils/rijndael.py on lines 638..701
tlslite/utils/rijndael.py on lines 703..766
tlslite/utils/rijndael.py on lines 833..896

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 262.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 14 locations. Consider refactoring.
Open

U4 = (0x0, 0x90d0b0e, 0x121a161c, 0x1b171d12,
      0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a,
      0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562,
      0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a,
      0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2,
Severity: Major
Found in tlslite/utils/rijndael.py and 13 other locations - About 2 days to fix
tlslite/utils/rijndael.py on lines 51..82
tlslite/utils/rijndael.py on lines 85..116
tlslite/utils/rijndael.py on lines 118..181
tlslite/utils/rijndael.py on lines 183..246
tlslite/utils/rijndael.py on lines 248..311
tlslite/utils/rijndael.py on lines 313..376
tlslite/utils/rijndael.py on lines 378..441
tlslite/utils/rijndael.py on lines 443..506
tlslite/utils/rijndael.py on lines 508..571
tlslite/utils/rijndael.py on lines 573..636
tlslite/utils/rijndael.py on lines 638..701
tlslite/utils/rijndael.py on lines 703..766
tlslite/utils/rijndael.py on lines 768..831

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 262.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 14 locations. Consider refactoring.
Open

T7 = (0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27,
      0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x3934be3,
      0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502,
      0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562,
      0x5a49deb1, 0x1b6725ba, 0xe9845ea, 0xc0e15dfe,
Severity: Major
Found in tlslite/utils/rijndael.py and 13 other locations - About 2 days to fix
tlslite/utils/rijndael.py on lines 51..82
tlslite/utils/rijndael.py on lines 85..116
tlslite/utils/rijndael.py on lines 118..181
tlslite/utils/rijndael.py on lines 183..246
tlslite/utils/rijndael.py on lines 248..311
tlslite/utils/rijndael.py on lines 313..376
tlslite/utils/rijndael.py on lines 378..441
tlslite/utils/rijndael.py on lines 443..506
tlslite/utils/rijndael.py on lines 573..636
tlslite/utils/rijndael.py on lines 638..701
tlslite/utils/rijndael.py on lines 703..766
tlslite/utils/rijndael.py on lines 768..831
tlslite/utils/rijndael.py on lines 833..896

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 262.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 14 locations. Consider refactoring.
Open

T4 = (0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6,
      0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491,
      0x30305060, 0x1010302, 0x6767a9ce, 0x2b2b7d56,
      0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec,
      0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa,
Severity: Major
Found in tlslite/utils/rijndael.py and 13 other locations - About 2 days to fix
tlslite/utils/rijndael.py on lines 51..82
tlslite/utils/rijndael.py on lines 85..116
tlslite/utils/rijndael.py on lines 118..181
tlslite/utils/rijndael.py on lines 183..246
tlslite/utils/rijndael.py on lines 248..311
tlslite/utils/rijndael.py on lines 378..441
tlslite/utils/rijndael.py on lines 443..506
tlslite/utils/rijndael.py on lines 508..571
tlslite/utils/rijndael.py on lines 573..636
tlslite/utils/rijndael.py on lines 638..701
tlslite/utils/rijndael.py on lines 703..766
tlslite/utils/rijndael.py on lines 768..831
tlslite/utils/rijndael.py on lines 833..896

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 262.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 14 locations. Consider refactoring.
Open

U1 = (0x0, 0xe090d0b, 0x1c121a16, 0x121b171d,
      0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331,
      0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45,
      0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69,
      0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad,
Severity: Major
Found in tlslite/utils/rijndael.py and 13 other locations - About 2 days to fix
tlslite/utils/rijndael.py on lines 51..82
tlslite/utils/rijndael.py on lines 85..116
tlslite/utils/rijndael.py on lines 118..181
tlslite/utils/rijndael.py on lines 183..246
tlslite/utils/rijndael.py on lines 248..311
tlslite/utils/rijndael.py on lines 313..376
tlslite/utils/rijndael.py on lines 378..441
tlslite/utils/rijndael.py on lines 443..506
tlslite/utils/rijndael.py on lines 508..571
tlslite/utils/rijndael.py on lines 573..636
tlslite/utils/rijndael.py on lines 703..766
tlslite/utils/rijndael.py on lines 768..831
tlslite/utils/rijndael.py on lines 833..896

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 262.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 14 locations. Consider refactoring.
Open

S = (99, 124, 119, 123, 242, 107, 111, 197,
     48, 1, 103, 43, 254, 215, 171, 118,
     202, 130, 201, 125, 250, 89, 71, 240,
     173, 212, 162, 175, 156, 164, 114, 192,
     183, 253, 147, 38, 54, 63, 247, 204,
Severity: Major
Found in tlslite/utils/rijndael.py and 13 other locations - About 2 days to fix
tlslite/utils/rijndael.py on lines 85..116
tlslite/utils/rijndael.py on lines 118..181
tlslite/utils/rijndael.py on lines 183..246
tlslite/utils/rijndael.py on lines 248..311
tlslite/utils/rijndael.py on lines 313..376
tlslite/utils/rijndael.py on lines 378..441
tlslite/utils/rijndael.py on lines 443..506
tlslite/utils/rijndael.py on lines 508..571
tlslite/utils/rijndael.py on lines 573..636
tlslite/utils/rijndael.py on lines 638..701
tlslite/utils/rijndael.py on lines 703..766
tlslite/utils/rijndael.py on lines 768..831
tlslite/utils/rijndael.py on lines 833..896

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 262.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function _handshakeServerAsyncHelper has a Cognitive Complexity of 119 (exceeds 5 allowed). Consider refactoring.
Open

    def _handshakeServerAsyncHelper(self, verifierDB,
                                    cert_chain, privateKey, reqCert,
                                    sessionCache, settings, reqCAs, tacks,
                                    activationFlags, nextProtos, anon, alpn,
                                    sni):
Severity: Minor
Found in tlslite/tlsconnection.py - About 2 days 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        for i in range(BC):
            tt = Kd[ROUNDS][i]
            result.append((Si[(t[ i         ] >> 24) & 0xFF] ^ (tt>>24)) &0xFF)
            result.append((Si[(t[(i+s1) % BC] >> 16) & 0xFF] ^ (tt>>16)) &0xFF)
            result.append((Si[(t[(i+s2) % BC] >>  8) & 0xFF] ^ (tt>> 8)) &0xFF)
Severity: Major
Found in tlslite/utils/rijndael.py and 1 other location - About 2 days to fix
tlslite/utils/rijndael.py on lines 1032..1037

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 255.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        for i in range(BC):
            tt = Ke[ROUNDS][i]
            result.append((S[(t[ i         ] >> 24) & 0xFF] ^ (tt>>24)) & 0xFF)
            result.append((S[(t[(i+s1) % BC] >> 16) & 0xFF] ^ (tt>>16)) & 0xFF)
            result.append((S[(t[(i+s2) % BC] >>  8) & 0xFF] ^ (tt>> 8)) & 0xFF)
Severity: Major
Found in tlslite/utils/rijndael.py and 1 other location - About 2 days to fix
tlslite/utils/rijndael.py on lines 1077..1082

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 255.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function _serverCertKeyExchange has a Cognitive Complexity of 116 (exceeds 5 allowed). Consider refactoring.
Open

    def _serverCertKeyExchange(self, clientHello, serverHello, sigHashAlg,
                                serverCertChain, keyExchange,
                                reqCert, reqCAs, cipherSuite,
                                settings):
        #Send ServerHello, Certificate or Compressed Certificate
Severity: Minor
Found in tlslite/tlsconnection.py - About 2 days 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 _clientKeyExchange has a Cognitive Complexity of 107 (exceeds 5 allowed). Consider refactoring.
Open

    def _clientKeyExchange(self, settings, cipherSuite,
                           clientCertChain, privateKey,
                           certificateType,
                           tackExt, clientRandom, serverRandom,
                           keyExchange):
Severity: Minor
Found in tlslite/tlsconnection.py - About 2 days 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

Cyclomatic complexity is too high in method _handshakeServerAsyncHelper. (101)
Open

    def _handshakeServerAsyncHelper(self, verifierDB,
                                    cert_chain, privateKey, reqCert,
                                    sessionCache, settings, reqCAs, tacks,
                                    activationFlags, nextProtos, anon, alpn,
                                    sni):
Severity: Minor
Found in tlslite/tlsconnection.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in method _serverTLS13Handshake. (101)
Open

    def _serverTLS13Handshake(self, settings, clientHello, cipherSuite,
                              privateKey, serverCertChain, version, scheme,
                              srv_alpns, reqCert):
        """Perform a TLS 1.3 handshake"""
        prf_name, prf_size = self._getPRFParams(cipherSuite)
Severity: Minor
Found in tlslite/tlsconnection.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Function brotli_decompress_buffer has a Cognitive Complexity of 100 (exceeds 5 allowed). Consider refactoring.
Open

def brotli_decompress_buffer(input_buffer, buffer_limit=None):
    br = BrotliBitReader(input_buffer)
    output_buffer = bytearray([])
    pos = 0
    input_end = 0
Severity: Minor
Found in tlslite/utils/brotlidecpy/decode.py - About 2 days 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

File mathtls.py has 834 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Authors: 
#   Trevor Perrin
#   Dave Baggett (Arcode Corporation) - MD5 support for MAC_SSL
#   Yngve Pettersen (ported by Paul Sokolovsky) - TLS 1.2
#   Hubert Kario - SHA384 PRF
Severity: Major
Found in tlslite/mathtls.py - About 2 days to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            for r in range(1, ROUNDS):
                for i in range(BC):
                    a[i] = (T5[(t[ i           ] >> 24) & 0xFF] ^
                            T6[(t[(i + s1) % BC] >> 16) & 0xFF] ^
                            T7[(t[(i + s2) % BC] >>  8) & 0xFF] ^
    Severity: Major
    Found in tlslite/utils/rijndael.py and 1 other location - About 1 day to fix
    tlslite/utils/rijndael.py on lines 1023..1029

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 203.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            for r in range(1, ROUNDS):
                for i in range(BC):
                    a[i] = (T1[(t[ i           ] >> 24) & 0xFF] ^
                            T2[(t[(i + s1) % BC] >> 16) & 0xFF] ^
                            T3[(t[(i + s2) % BC] >>  8) & 0xFF] ^
    Severity: Major
    Found in tlslite/utils/rijndael.py and 1 other location - About 1 day to fix
    tlslite/utils/rijndael.py on lines 1068..1074

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 203.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function _handshakeClientAsyncHelper has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
    Open

        def _handshakeClientAsyncHelper(self, srpParams, certParams, anonParams,
                                   session, settings, serverName, nextProtos,
                                   reqTack, alpn):
    
            self._handshakeStart(client=True)
    Severity: Minor
    Found in tlslite/tlsconnection.py - About 1 day 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