You are absolutely correct, the sentencing guidelines, which I believed to be law, in Scotland, are the issue.
No, they're not the law but they are approved by the High Court of the Judiciary and judges are required to follow them. The guidelies are developed and issued by the Scottish Sentencing Council, an independent NDGB (I am aware that could be called an oxymoron).
The guidelines for young people clearly state the overarching purposes of sentencing to be (para. 13):
... in no order of priority: protection of the public; punishment; rehabilitation of offenders; giving the offender the opportunity to make amends; and expressing disapproval of offending behaviour.
I assume that none of us would disagree with that.
They also state (para. 14):
Rehabilitation is a primary consideration when sentencing a young person. When selecting a sentence the court should, where appropriate, seek to rehabilitate the young person and to reduce the risk of reoffending. The character of a young person is not as fixed as the character of an older person, and a young person who has committed a crime may have greater potential to change.
Again, unless you're a "hang-em high" Daily Mail reader (bullying excepted, it appears) then that seems a reasonable proposition.
Turning to determining a period of incarceration (paras. 20-21):
The full range of sentencing options remains open to the court. However, the nature and duration of a sentence imposed on a young person should be different from that which might be imposed on an older person being sentenced for the same, or a similar, offence.
A custodial sentence should only be imposed on a young person when the court is satisfied that no other sentence is appropriate. If a custodial sentence is imposed on a young person, it should be shorter than that which would have been imposed on an older person for the same, or a similar, offence.
Taking us back, this time to para. 6:
the court should assess the seriousness of the offence by evaluating the level of culpability (or blame) and harm. Guidance on assessing culpability when sentencing a young person is set out at paragraphs 10-12 below. The court’s consideration of the level of harm, which includes the impact on any victim or victims, is not affected by the provisions of this guideline.
Hogg was 17 when raped his victim. Now 21, as we know he was sentenced to a community payback order of 270 hours of unpaid work. The Crown is considering appealing the sentence on the basis that it is unduly lenient, which I think we would all agree. The law in Scotland requires, however, that it falls outside the normal range of sentences the judge could have considered. Which takes us back to the Sentencing Guidelines.
So, in summary, the law is not the problem but the guidelines and if the judge has erred (which I think he has) then there is a formal route by which it can be appealed. In the meantime the most appropriate way to prevent a recurrence is not to change the law, but rather the entirely seperate sentencing guidelines.