ietoolkit
ietoolkit copied to clipboard
iedorep command
iedorep
~initial~ version 0.2 for review. This version successfully scans a file in two runs and flags:
- Changes in data
- Data inconsistencies from Run 1 to Run 2 using
cf
- Use of RNG ("Seed Used")
- Seed inconsistencies from Run 1 to Run 2 (when RNG state changes but end point differs)
- Use of Sort RNG ("Sortseed Used")
- Order inconsistencies after sort (combining
xpose
andcf
whenever sort used)
Reporting is now as follows in the screenshot. Flags are displayed for all three types (whenever detected), as as errors (whenever inconsistencies are detected). ~Flags are not optional yet but can easily be done.~
Current syntax is: iedorep /path/to/dofile.do
(The debug
option in the screenshot creates a copy of the underlying tempfile for debugging.)
🍀 Additional functionality possible for release:
- [ ] Clear user-written functions and set PERSONAL directory
- [ ] Create temp locations for results and hash all outputted files against 1st version
✳️ Core functionality:
- [x] Implement improvements from Luiza below
- [x] Implement pseudo-recursion
- [x] Write minimal help file
- [x] Set defaults and options
- [x] Implement error check for altered RNG
- [x] Implement
cf
check for altered data - [x] Implement sort-check using data transpose
- [x] Note that non-flag does not totally rule out error
- [x] This checks for stability, but it's possible to get the same order by chance
- [x] It also does not use string variables to check (limitation of
xpose
)
‼️ Critical needs:
- [x] Help file, error messages, optional functionality, etc.
- [x] Check path implementation in
syntax
for quote breakage - [x] Implementation of recursive functionality so it can be run targeting a master do-file. I have some crude ideas but others will have better ideas.
- [x] Avoid using globals, or at least use better names for them (solved by using only one file)
- [x] Make sure that
clear
will never cause error if run before file? - [x] Make sure that doubling the dofile will not cause errors with locals?
- [x] Make sure that
☺️ Nice-to-haves:
- [ ] ~Suppress
display
commands in target file~ - [ ] ~Suppress graph outputs in target file~
- [ ] ~Suppress exporting commands in target file?~
📝 Notes:
- There are almost certainly configurations of comments
/* */
and{}
that will cause failures. This might be better addressed inlinter
than trying to catch all possible arrangements here. - The command now compiles both runs of the dofile into a single tempfile (
cf
would not work otherwise, nor would using locals). It usesclear
as well as advances the RNG state by one draw before each one, but this may be incorrect/insufficient. Especially counter locals may break. Thinking of ways to catch this. - ~I cannot figure out how to detect changes in the RNG state from one run to the next. Currently it flags whenever the RNG state is changed so those lines can be checked.~
- Loops aren't evaluated internally; it currently treats the highest level loop as a single line. This functionality needs to be checked.
- ~Data flagging is probably too verbose; it flags on every line after the first difference in many cases (since the differences persist). This could be changed easily to simply break on the first failure.~
- [x] Only skip lines with
{
if they also include the expressions "foreach", "while" or "forvalues" and its shortcuts. - [x] Allow for quotation marks in file paths
- [x] Drop all locals that were not defined by
iedorep
between two runs of the file
@luisesanmartin Great comments, all resolved except #304. Have a look at the proposed solution there and let me know if that's sufficient to go ahead!