slimtoolkit / slim

Slim(toolkit): Don't change anything in your container image and minify it by up to 30x (and for compiled languages even more) making it secure too! (free and open source)
Apache License 2.0
19.21k stars 716 forks source link

refactor(reverse): dockerfilefromhistory default processor #472

Open ess opened 1 year ago

ess commented 1 year ago

Per the desire expressed in the TODO in the default raw instruction processing case in DockerfileFromHistory, this adds tests for that processor and refactors it.

The end result increases cumulative cyclomatic complexity a few points, but generally drops the complexity of the individual pieces through conditional flattening and code deduplication, provides a clear path towards extension, and generally makes the default processor a good deal easier to reason about.