Home › Learn › Shift left › How software solved it

Shift left · page 2 of 13

How the software world already solved this

How software engineering already solved fail-fast checks: functional core, test pyramid, coverage on new code, mutation testing, complexity budgets, low-noise review, ratchets.

↑ All of shift leftShift left, explainedHow software solved itSyntax treesPure functionsTests, coverage, complexityTesting data logic offlineClean codeSecurity and costWhat is missingThe bundleHow it is builtAll the checksOpen source and ours

In plain words

Nothing here is new

Application developers have solved most of this over the last twenty years. Data code is usually behind because notebooks made it easy to skip the habits. The practices below are standard, and each one already has mature open-source tools.

PracticeThe idea in one lineOpen source that does it
Functional core, imperative shellKeep the logic in pure functions (data in, data out) and push reads and writes to the edges. Pure functions are easy to unit test.A design rule; import-linter enforces that the core never imports the IO code
Test pyramidMany fast unit tests, fewer slow integration tests, very few end-to-end runs.pytest, Spark's built-in assertDataFrameEqual
Coverage on new codeDon't fail on old debt; require coverage only on the lines a change touches.coverage.py and diff-cover
Mutation testingCoverage shows a line ran, not that a test would catch a bug. Change the code on purpose and check that a test fails.mutmut
Property-based testsCheck rules such as 'never more rows out than in' on many generated inputs.Hypothesis
Complexity budgetFlag functions too tangled to read or test.Ruff C901 (cyclomatic), complexipy (cognitive)
Static analysis in review, low noiseShow findings on the pull request, on the changed line, and drop any rule developers mostly mark as wrong.SARIF format, shown by GitHub code scanning or the Azure DevOps SARIF tab
Same checks everywhereThe laptop and CI run the same configuration.pre-commit
RatchetRecord today's findings; block only new ones; tighten over time.a baseline file
Supply-chain hygienePinned libraries, known-vulnerability scans, no secrets, a scored checklist of repo practices.osv-scanner, gitleaks, OpenSSF Scorecard

The lesson that matters most

Developers ignore noisy tools

Large companies that run static analysis at scale learned the same thing: a check is only useful if developers act on it. Findings must appear in the code review, on the line that changed, with a clear fix, and the rate of wrong findings must stay low. A tool with a thousand findings on day one gets switched off.

That is why this guide starts every rule as a warning, baselines old code, and blocks only a short list. See the bundle for the gate policy.

FAQ

Questions people ask

What is the functional core, imperative shell pattern?

Put the logic in pure functions that take data and return data, and keep reading, writing and other side effects in a thin outer layer. The core is unit tested in seconds; the shell gets a few integration tests.

Is code coverage enough?

No. Coverage shows that a line ran during a test, not that a test would notice if the line were wrong. Mutation testing checks that; run it on the pure functions, where it is fast.

How do I add checks to an old codebase without blocking everyone?

Record today's findings in a baseline, block only new findings, and require coverage only on changed lines. Tighten the rules as the old findings get fixed.

Next

Where to go next

Next page: Every language already has a syntax tree

↑ All of shift left · The repo on GitHub · Data project review