The students that mess about eould like to 'go home early' and the good students want to spend time with their family and do their homework. Effectively being removed from a detention would make a student think i did well today. However if a serious incident occured the student would be punished quickly so he or she would regret it and not get dt kept again
That is extremely unfair. It means that students that have done everything right, followed the rules, did their work, etc., will get punished for not going beyond what they are told to do. That's like if everyone in the world was arrested, but only the exceptionally good people would get to be free. Basically, this idea isn't detention, it's extending the school day, but excellent students get to go home early.
While it's great if a student is good, punishing students for being neutral or mediocre when that student is following the rules would just encourage rebellion. Some of those students might not have what it takes or they don't believe they have what it takes to be "good" and not merely "OK".
Even if a student is doing "bad" they should only get a detention if they are breaking the rules, not just "bad" in the sense of getting bad grades. A student could get bad grades because of a learning disability or because they have a bad teacher or because their home environment makes getting good grades difficult.
Pros: While a system like this would mean that bad students who disobey the rules would get consequences swiftly without much work from the teacher...
Cons: ...This could create an us vs. Them environment that would be detrimental to education. Also, in secondary schools where most students have multiple teachers, the issue of which teacher is responsible for what would complicate things.
Conclusion: The cons would outweigh the pros by a decent margin.