sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ«› Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Find any methods that are never called?

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 3 Posters 157 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Chris FullmerC Offline
      Chris Fullmer
      last edited by

      Is there a way to find any methods that I have defined that never actually get called in my code? Not that I have any like that 😳

      I've found a few little methods that I started writing while testing something, then later found a completely different solution, but then never realized I needed to get rid of that old method. So is there such a code cleaning tool? Well, I don't want it to touch my code, I'll do that, I just want it to point me to methods that are not being called ever.

      Lately you've been tan, suspicious for the winter.
      All my Plugins I've written

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        I just use Notepad++ and ' find' each ' def' in turn; I use ' find' for the method's name ' xxxx' and do a count, if it ==1 I know I've never used it in the script; to be doubly sure I then add =begin...=end around the method and retest the script [NB: restart to clear unused methods]: if it works with no errors then I know it's safe to remove that unused method. It it looks like a useful method snippet I'll cut/paste it into a methods-scraps file for possible use on another project, otherwise I'll just delete it!

        TIG

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          @tig said:

          add =begin...=end around the method and retest the script:

          Make sure to restart SU before retesting. Because a load will not remove the old method. Easy trap to fall into, as you won't notice something failed until you start the next time.

          Thomas Thomassen β€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement