Really, there are three parts to a judgement: facts, the law, and the application of them. There should be no leeway in determining what the law
says about a given situation. If that is not decidable, it is a bug. However, what a fair judgement is given the facts and the law, is really a separate issue. You can introduce measures to give clear guidance what the law says, and still give judges flexibility. One of the upsides of "code is law" in that respect is being able to provide a clear statement of
what the law says and require the judge to then explain in their judgement why that justifies or does not justify a given judgement.
A lot of bad judgement might be a lot more blatant (or not happen) if the judge had to justify outright ignoring the law.