Whenever it is in the purview of law. So it requires that limitations are put on a prorogation by law, which clearly exist and were used by the Scotish court in the form of "no relevant explination was given to explain the unprecedented long nature of the prorogation, which is otherwise required by law."
Aka limits exist on prorogation for what regards the concerns raised by Gaudion M. , and imho they should be used just like the Scotisch court seemed to have applied them correctly. But, disclaimer: I cannot guarantee that the most logical or reasonable outcome is the one you are going to get. ;)