The following links will assist you with your electrical question.
Attic wiring tips.
The attic wiring should be protected and secured to ceiling joists or other wood structural supports.
Electrical wire for the home.
For the horizontal portion of the cable run this can involve drilling holes in the joists where the cable will pass.
Strip away about 6 inches of outer insulation and 1 2 inch of individual insulation from the end of each wire.
The process of wiring an attic fan involves the power source and switch location wiring connections to the switch and wiring connections to the fan.
Insert the end of the 12 2 wire into the fans junction box.
Yes this should be corrected and it would be good to have the wiring and all the circuit connections inspected as well.
Junction box mounting locations there are two options for mounting boxes that are wholly contained within the attic.
Use wire nuts to connect.
Step 8 locate the wires at the sites where you fed them to from the attic and complete your connections first then secure or conceal the rest of the wire.
There should be no excess wire or ends left in the attic.
When adding or replacing wiring in finished walls most electricians will attempt to make the horizontal portion of the cable run in the unfinished attic or basement crawlspace areas looping the cable down or up through the wall cavity across the floor or ceiling joists then vertically through another stud cavity to the next wall box opening.
You can attach them to the joist s side surface called the face or to the joist s top surface called the edge.
Since insulation is combustible you must install face plates on all attic junction boxes to prevent contact between bare wires and insulation materials.
Here are 3 tips to help.
Once you are running the wire feed both ends of the wire through their corresponding holes and climb down from the attic.
Location of power supply and switch find a live receptacle for the power source.