rubberduck-vba / Rubberduck

Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
https://rubberduckvba.com
GNU General Public License v3.0
1.92k stars 302 forks source link

The "Return value of function is not used" inspection ignores TLB functions #3202

Open ThunderFrame opened 7 years ago

ThunderFrame commented 7 years ago

All of these statements ignore the return value, and are meaningless operations...

  VBA.Conversion.CLng 1
  VBA.Conversion.CBool 1
  VBA.Conversion.CByte 1
  VBA.Conversion.CCur 1
  VBA.Conversion.CDate 1
  VBA.Conversion.CDbl 1
  VBA.Conversion.CDec 1
  VBA.Conversion.CInt 1
  VBA.Conversion.CLng 1
  VBA.Conversion.CLngPtr 1
  VBA.Conversion.CSng 1
  VBA.Conversion.CStr 1
  VBA.Conversion.CVar 1
  VBA.Conversion.Error 1
  VBA.Conversion.Error$ 1
  VBA.Conversion.Fix 1
  VBA.Conversion.Hex 1
  VBA.Conversion.Hex$ 1
  VBA.Conversion.Int 1
  VBA.Conversion.MacID 1
  VBA.Conversion.Oct 1
  VBA.Conversion.Oct$ 1
  VBA.Conversion.Str 1
  VBA.Conversion.Str$ 1
  VBA.Conversion.Val 1

  'Of all of the Conversion functions, only these maybe called unqualified
  CDec 1
  Error$ 91
  Hex 1
  Hex$ 1
  MacID 1
  Oct 1
  Oct$ 1
  Str 1
  Str$ 1
  Val 1
retailcoder commented 7 years ago

That's pretty much by design: the inspection currently only looks at user code, for its target is the Declaration of the function/getter. I feel this should be a separate inspection, with call sites as the target, only looking at non-user members.