Package to find unused publications


#1

When working on applications with multiple developers, I find it hard to keep track of unused publications as your application grows and changes. E.g. a developer chooses to create a new publication, but doesn’t know if he can remove the old one, since another part of the application (created by another developer) might still use it. Eventually, you’ll end up with unused and unmaintained publications, potentially leaving you with security exploits.

So I was thinking about creating a debugOnly package for this, but before I do that:

  1. Is there already something like this (I couldn’t find anything)?
  2. The approach I’m thinking of is:
  • Hijack DDP, and track every subscribed publication
  • Implement a method that diffs the used publications so far with all registered publications, output the unused publications to the console

It doesn’t give you 100% certainty, but it might give you a good idea if you use your application for a while and some publications are never called…

Anyone knows a better approach?


#2

You should just be able to do static code analysis here.

Hijacking DDP shouldn’t be required.

  1. Collect a list of publications from the code.
  2. Collect a list of subscribe calls and their associated publication.
  3. Diff these two.