Sustainability Led Code Quality Assessment

GreenCode analyses a codebase against quality, security and green software patterns in one pass, so inefficient structures are found as quality defects before any energy optimisation begins.

What this feature is

Most static analysis tells a team where its code is wrong. It does not tell a team where its code is wasteful. GreenCode assesses both in the same pass and treats them as one subject, because the structures that make software hard to maintain are very often the structures that make it expensive to run.

The assessment scores a codebase against three reference sets at once: the ISO/IEC 25010 SQuaRE quality models, OWASP security practice, and the Green Software Foundation's green software patterns, used here as quality metrics rather than advice. A missing test, an unchecked input and a needlessly repeated database call all come out of the same analysis, in the same list, ranked together.

Where it sits in the pipeline

This is stage two of five, and it runs before any energy work. It takes the searchable index, the software bill of materials and the interface inventory produced by the mapping stage. It returns two things: a machine-readable action list in JSON that the refactoring step can work through element by element, and a human-readable report for the team.

Once generative AI has worked through the action list, the assessment is re-run on the changed code to confirm the uplift. The cycle repeats within a bounded number of iterations, so the pipeline cannot spend unlimited energy chasing a diminishing score. Only when the baseline holds does the pipeline move on to infrastructure and benchmarking.

There is a second, later pass. Energy figures measured during benchmarking are fed back as a quality signal, so a construct that survives static analysis but burns disproportionate power is treated as a defect rather than a curiosity. These are the sustainability smells the project set out to detect.

How it is measured

A codebase assessed against three standards and returned as one ranked list of findingsView full size
Three standards, one ranked list, worst first.

The targets are numeric and checked on every run. A maintainability index above 85, computed from lines of code, cyclomatic complexity and Halstead volume. Cognitive complexity stable or reduced. And a combined count of quality assessment issues, security flaws and error rate that must not rise across an optimisation cycle. That last gate is what stops the pipeline trading correctness for speed, which is the failure mode of naive automated refactoring.

Generated code is held to the same standard as human code, and checked rather than trusted.

What it builds on

The published review of static code analysis found the field strong on correctness and weak on energy. Formal verification, model checking and abstract interpretation give precise answers, but scale poorly to the multi-million-line estates that need the help most, so the review favours combining them with lighter analyses that run on every commit. It also examined analysers for compiled software, which matters where source is unavailable or where the compiler, not the author, determines what actually executes.

The same review is candid about generated code. It reports only a weak correlation between functional correctness and code quality in AI-generated software: code can pass its tests and still carry smells, maintainability problems and defects. The wider state of the art review adds that common coding benchmarks ignore energy entirely, so a tool can look successful while producing inefficient code. Both findings point the same way, towards measurement at every step rather than a single confident pass.

What the team gets

A ranked, explained list of what is wrong and what is wasteful, a report that names the standard behind each finding, and a re-assessment showing what the fixes achieved. The defect side of that outcome is described under reduced software issues.

Organisations that want to trial the assessment on their own codebase can get in touch via the contact page.

  • Pipeline stage 2 of 5
  • Quality model ISO/IEC 25010 SQuaRE
  • Security basis OWASP practice
  • Sustainability basis GSF green software patterns
  • Maintainability index target Above 85
GreenCode

Want this benefit for your own systems? Talk to the GreenCode team about a trial.

Get in touch