Function calculate
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Wontfix
def calculate(self):
if self._config.SLACK and (self._config.DSTS or self._config.PCAP):
debug.error('SLACK can\'t be used with PCAP or DSTS')
- Read upRead up
- Create a ticketCreate a ticket
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 ndispktscan.py
has 463 lines of code (exceeds 250 allowed). Consider refactoring. Wontfix
###https://github.com/bridgeythegeek/ndispktscan
##Bridgey the Geek
import os
import re
- Create a ticketCreate a ticket
Function render_text
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Wontfix
def render_text(self, outfd, data):
if self._config.SLACK:
# Output the table header
- Read upRead up
- Create a ticketCreate a ticket
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 macfind_ndsh
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Wontfix
def macfind_ndsh(addr_space, start):
macs = set()
scanner = NDshScanner()
for ss in NDISPktScan.gen_session_spaces(addr_space):
- Read upRead up
- Create a ticketCreate a ticket
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 get_flags
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Wontfix
def get_flags(self):
"""Get string representation of TCP flags"""
flags = []
if self.ns == 1: flags.append('NS')
- Read upRead up
- Create a ticketCreate a ticket
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
Avoid deeply nested control flow statements. Open
if eth.eth_type == 0x0800: # IPv4:
eth_payload = obj.Object('_IPv4', vm=session_space,
offset = eth.v() + 0x0E)
end = 14 + eth_payload.length
if self._config.SLACK:
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
for dst in dsts:
dsts_file.write(dst + '\n')
outfd.write('Written {:,} destination IPs to \'{}\'.\n'.format(
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if eth_payload.is_tcp():
payload = obj.Object('_TCP', vm=session_space,
offset=eth_payload.payload_offset())
elif eth_payload.is_udp():
payload = obj.Object('_UDP', vm=session_space,
- Create a ticketCreate a ticket
Function make_ip
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Wontfix
def make_ip(ip):
"""Get string representation of IPv6 address"""
# TODO: There's gotta be a cleaner way, right?
r = ''
- Read upRead up
- Create a ticketCreate a ticket
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 gen_session_spaces
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Wontfix
def gen_session_spaces(addr_space):
sessions = []
for proc in tasks.pslist(addr_space):
sid = proc.SessionId
- Read upRead up
- Create a ticketCreate a ticket
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"