Module: Shirobai::Cop::BundleEligible

Overview

Shared bundle_eligible? for wrapper cops.

The bundled (shared-walk) path scans raw_source; the standalone path scans the parser-normalized buffer.source. The two agree only when they are byte-identical (CRLF / BOM / __END__ truncation break that), so a cop may take the bundle path exactly then; otherwise it falls back so every offset lines up with parser-gem's index.

The verdict is memoized, but the memo is guarded on the processed_source identity. RuboCop's real CLI builds a fresh cop per file, yet a reused instance (vendor specs, and any future RuboCop change to instance reuse) investigates several sources in turn. A plain @bundle_eligible / .nil? / defined? memo would freeze the first file's verdict and leak it onto later files with a different eligibility; keying on the source identity recomputes it on each new investigation.