bellybutton icon indicating copy to clipboard operation
bellybutton copied to clipboard

Introduce FileManager and open files as-needed

Open remcokranenburg opened this issue 3 years ago • 1 comments

In this PR, we introduce a simple FileManager class that allows you to open a file as-needed, and caches the contents for future use.

Reasoning: opening all Python files indiscriminately slows us down and is an unnecessary risk.

Longer explanation:

Big repositories have a lot of Python files, many of which might not be covered by the include patterns. It makes no sense to open all these files up front. In the company I work for, bellybutton would actually crash on some test files that contain invalid UTF-8 sequences (by design). These files are not covered by any bellybutton rule, but still crashed it. With this PR, we only open the files when the linter has decided to apply a rule to it.

remcokranenburg avatar Sep 16 '22 12:09 remcokranenburg

This might also fix #23

remcokranenburg avatar Sep 16 '22 12:09 remcokranenburg