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.
'The law' is open to judicial and legal interpretation. There isn't always a single 'the law' to interpret in complex cases. While there are many, many rules, they are not as simple as code and they rely on deep layers of precedent. Common law is made up of case history more than statute.
> One of the upsides of "code is law" in that respect is being able to provide a clear statement of what the law says
No, "code is law" in fact always ignored what any actual law said, in favour of framing everything as a sort of contract, regardless of whether said contract was actually fair or legal, and it removed the human factor from the whole equation. It was a basic failure to understand law.