Do Not Move Tabbed 'Add' Entries in User Code to Global Declaration #244
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Misterhouse merges all of the User Code files into a single file at runtime. When merging the files, MisterHouse moves certain commands and declarations to the top of the merged file. The purpose is to allow these "global records" to be defined early on, to avoid errors. They include variable instantiaions and other routines.
In order to avoid moving lines which are meant to be part of a subroutine or logical statement, MisterHouse will only move theabove "global records" if they occur at the start of a line. The thought being that coders practicing even the most basic level of standard formatting will indent statements inside of logical routines or subroutines.
The one exception to this rule is the add statement. This is generally used to add an item to a group, but a few other items have add functions as well, notably the Process_Item.
For some reason, MisterHouse will allow anywhere from 0-3 whitespaces to proceed the add statement while still considering it to be a "global record"
This is somewhat logical in that tabs are usually at least 4 spaces. But it is unclear why this exception only applies to add functions, and not to the other functions as well.
Eitherway, a white space in perl is defined as [\ \t\r\n\f]. [\r\n\f] are unnecessary, since they would be interpreted as a newline. The problem arose by including [\t]. In so doing, MisterHouse was moving add functions which were tabbed in 3 times.
By changing this to simply [\ ] the code at least does what the author originally intended it to do. I think the odds that this change would cause an error for any currently existing user code files is small, but there is some remote possibility that it might.
Personally, I think the spacing should be removed entirely, but I am hesitant to change a function that is so fundamental to MisterHouse.