9 hours ago · 7 min read1481 words · Tech · hide · 0 comments

RuboCop 1.89 is out, and it comes with the usual assortment of new cops and bug fixes. But there’s one theme running through this release that I’m particularly excited about, and that’s what I want to talk about today: RuboCop is finally learning to look beyond a single file. The single-file curse (limitation) For its entire existence RuboCop has analyzed your code one file at a time. That’s not an accident - it’s a deliberate design choice that has served the project extremely well. A file-at-a-time analyzer is simple, it’s fast, and it parallelizes trivially across all your cores. It’s a big part of why RuboCop can lint a huge codebase in a few seconds. The catch is that a cop looking at a single file is essentially working with blinders on. It has no idea what’s defined in the rest of your project. And that turns out to be a real limitation for a whole class of checks: Is this method a duplicate of one defined in another file? No way to tell. Does this constant actually refer to…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.