Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce FileManager and open files as-needed #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

remcokranenburg
Copy link

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
Copy link
Author

This might also fix #23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant