I was replacing some siding that is rotten and noticed two top plate ends were within six inches of each other. There was a stud right below the lower top plate splice. It is also between two rafters so there isn't a rafter right above it. Should I do anything about this? I checked my local codes and it requires 24 inches. What problems could this cause and is there a repair other than redoing the top plates?
Good eye! The top plates lend tensile strength to the wall and that helps it transfer loads downward as well as laterally (wind, shear). The whole idea of keeping the top plate end splices far apart is to ensure that the top plate can work effectively in tension.
Since you don't have a rafter or joist landing between the studs above the splices, this is easy to fix.
Install a 12-16" metal strap such as a Simpson MSTA16, centering it over one of the plates' splices. Nail it securely with several nails on each side of the splice. Not need to do both plates, as only one continuous plate is necessary.