Fix lint handling inside toggle fences by Q1Xuan · Pull Request #2962 · diffplug/spotless (original) (raw)

Summary

Fix lint-only formatter steps being skipped when they are wrapped by toggleOffOn / FenceStep.preserveWithin.

FenceStep already applied formatting through its nested formatter, but it did not forward lint(...) calls to the nested steps. That meant steps such as forbidWildcardImports stopped reporting problems once toggleOffOn was configured.

This change forwards lint calls for preserved fences and filters out lints that fall inside the preserved off/on ranges.

Validation