We do not know what the report options are that you are using.
I suspect that the report is only set to a certain number of levels, whereas your script counts all definitions at all levels.
This is not actually true. The old “offline” report engine can be fired by a ruby call.
- EDIT: See explanation why the code cannot be posted.
What is the forum topic you are referring to?