rapid7 / ruby_smb

A native Ruby implementation of the SMB Protocol Family
Other
80 stars 80 forks source link

Remove use of double exclamation in code #225

Closed gwillcox-r7 closed 10 months ago

gwillcox-r7 commented 2 years ago

More of a question than anything but is there a reason that https://github.com/rapid7/ruby_smb/blob/bf14d0360527b9de64cff5d688dcbdbdd641e616/lib/ruby_smb/server/server_client/session_setup.rb#L83 uses the !! syntax? I can't find a legitimate reason for this apart from if the object returned was expected to be an empty string in which case this would convert it into its boolean expression (in which case a converter method like .to_s or similar might be more appropriate imho). Furthermore the function appears to be expected to return a boolean already 😕 Could someone explain if I'm missing something or if this is a case of poor programming practice?

smcintyre-r7 commented 10 months ago

!! will convert the value to a boolean.