sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Find any methods that are never called?

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 3 Posters 140 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