Just one exception: Warriors:
Depends, if you get the chance to rapid-fire I personally think you should take it. You will have a better chance of hitting your opponent=more pain, the number of shots/attacks is equal to assaulting, so is strength, so you will cause more damage. If you are planning on charging in a squad of wyches into said csm squad the same turn assaulting to help out the wyches instead might be the better idea. Plus sniper squads tend to have DLs so shooting also nets you two really powerfull armour-ignoring hits on 3+ instead of four weak ones at 4+ with a measly str and which doesn't ignore armor. Standing still and shooting those terminators with your DLs will give you more damage out of your sniper-squad most of the time, even if it means he gets the charge.
It is also situational, what you want to do is of course to set up a situation were your unit will be slaughterd in your opponents assault phase, not your own, so you can then shoot him with nearby units before he assaults you again. If 16 berserkers are in front of your sniper squad moving up and rapid-firing is probably wiser than charging, since his return attacks have a very good chance of causing more damage than your attacks, and since he will probably outnumer you, you can count on breaking. This makes assaulting stupid, since you will just lose one squad in your own assault phase, giving him at least 3" consolidation before his next turn, when he can go on to assault another nearby squad. If you move as close as possible and rapid-fire in this case you force his squad to charge you and probably kill you in his turn, giving you the chance to move up and fire with another squad next turn, this means it will take longer for him to sweep through your fire-base and gives you more shots to try to finish of the squad before you are completly over-run.
Notice that this tactic is for bad cc units in your fire-base like sniper warrior squads, getting assaulted on your refused flank for example, were there is no dedicated cc units that can charge into the threat (in which case assaulting with the warriors as well is the wiser thing to do). Otherwise you should almost always assault as per precious posts.