Method enum_session_file
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def enum_session_file(path, user_profiles)
xsh_xfp = []
tbl = []
print_status("Search session files on #{path}")
xsh_xfp += session.fs.file.search(path, '*.xsh')
- Read upRead up
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
Method run
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
print_status("Gather Xshell and Xftp Passwords on #{sysinfo['Computer']}")
profiles = grab_user_profiles
result = []
profiles.each do |user_profiles|
Method initialize
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Windows Gather Xshell and Xftp Passwords',
Method enum_session_file
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def enum_session_file(path, user_profiles)
xsh_xfp = []
tbl = []
print_status("Search session files on #{path}")
xsh_xfp += session.fs.file.search(path, '*.xsh')
Method run
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def run
print_status("Gather Xshell and Xftp Passwords on #{sysinfo['Computer']}")
profiles = grab_user_profiles
result = []
profiles.each do |user_profiles|
- Read upRead up
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
Method try_encode_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def try_encode_file(data)
# version 6.0 The character set of the session file will use Unicode
# version <= 5.3 The character set of the session file will use ANSI
if data[0].unpack('C') == [255] && data[1].unpack('C') == [254]
data[2..].force_encoding('UTF-16LE').encode('UTF-8')
- Read upRead up
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"