Not always
Spark plug wire may have problem, ignition coil may also have problem. Those problem will not always generate code. Catalytical converter block will mostly give you no code, but by checking vaccum you can tell if there is a problem or not. Thermostat stuck open will never generate code, however, your engine will be running at open loop (limp in mode) for long time, which will kill the fuel efficiency. Half stuck EGR will cause engine vibrate at idling speed but will not generate code. cylinder compression will almost sure generate code as that will cause misfire. In short, warning light and code is a reference, but not 100% correlate to parts problem.