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

Do not scan uncommentable files #825

Merged
merged 5 commits into from
Oct 24, 2023
Merged

Do not scan uncommentable files #825

merged 5 commits into from
Oct 24, 2023

Conversation

hoijui
Copy link
Contributor

@hoijui hoijui commented Aug 27, 2023

This prevents incidents of falsely detected copyright info
in binary files (and other uncommentable file types),
if they contain the word "Copyright" as plain-text.
This happened to me in the case of some JPG files, for example.

This also saves us from reading binary file contents unnecessarily.

... or are there ever cases where we want to detect plain-text in binary or uncommentable files?

@carmenbianca
Copy link
Member

This PR seems good. I did some light tweaking. I especially liked renaming the function from _is_uncommentable to _is_commentable. What a readability improvement 😅

I'm not entirely certain this won't have undesired effects. I'm going to approve the PR, and I'll merge it after discussing with some other peeps.

Thanks a lot @hoijui !

@hoijui
Copy link
Contributor Author

hoijui commented Sep 24, 2023

thank you for these comments @carmenbianca, and the improvements!
... made my day! :-)

@carmenbianca
Copy link
Member

Did an in-person review together with @nicorikken. Let's merge this! (after fixing some merge conflicts)

hoijui and others added 5 commits October 24, 2023 11:39
Also renames `_is_uncommentable` to `_is_commentable`,
to prevent needless double (and triple) negations,
which makes code harder to understand.
This prevents incidents of e.g. falsely detected copyright info
in e.g. binary files, if they contain the word "Copyright" as plain-text.
This happened to me in the case of some JPG files, for example.

This also saves us from reading binary file contents unnecessarily.
@carmenbianca carmenbianca merged commit a8c56c4 into fsfe:main Oct 24, 2023
21 checks passed
@hoijui
Copy link
Contributor Author

hoijui commented Oct 24, 2023

Wooho, thanks! :-)

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.

2 participants