This would be considered to be temporary construction power equipment. According to OSHA rules (1910.305, 1926.405) there are specific requirements and the assembly is not for permanent use (running your hand saw for various jobs on the property vs running your freezer long term). Link to OSHA as they're not going away anytime soon: Acceptable Job-Made Extension Cords
The major focus is on using boxes meant for this type of use (boxes with no coined knockouts or that use screw-in knockout plugs), making sure all grounds are intact (including the metal box), neutral and hots properly routed so plugging the assembly in or items into the assembly will not reverse polarity and proper strain relief is supplied (no romex squishers) for the cord.
NOTE: While OSHA rules don't apply to DIY, the spirit of the rules is to increase your safety so Joe Electron doesn't escape through you!