Hint: Flying splices
The installer of this fan took a shortcut by hard-wiring a lamp cord having a built-in rotary switch into the round weatherproof box and directly to the lamp cord to the leads of this small fan. Section 400.12(1) prohibits using flexible cords, flexible cables, cord sets, and power supply cords as a substitute for the fixed wiring of a structure. Section 400.12(4) prohibits attaching these cords and cables to building surfaces. Section 400.13 requires flexible cords to be used only in continuous lengths without splices where initially installed. Repairs of hard-service cords and junior hard-service cords are permitted if conductors are spliced per Sec. 110.14(B). This was not a repair. This was the initial installation. It also appears that the cover for the weatherproof box is not securely fastened to the box leaving it not-so-weatherproof and creating a violation of Sec. 314.15.