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

Relax regex re. recognizing requirements.txt #372

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

jherland
Copy link
Member

Zhihan found that the plotly project has some requirements files that
are not recognized by FawltyDeps, with names like requirements_abc.txt.

Using the underscore as a separator in the filename does not match our
regex, which requires a word boundary ("\b") around the "requirements"
string in the filename.

Fix our regex: There is no reason why the underscore separator should
disqualify this as a requirements file, and simplifying the regex to
".*requirements.*\.(txt|in)" is unlikely to introduce false positives
(files that should not be recognized as requirements.txt files, but
now are).

Also add unit tests precisely for parsing filenames of dependency files
as I could not find another test case that tested exactly this.

@jherland jherland force-pushed the jherland/relax-requirements-regex branch from a59a61b to f0e3e76 Compare September 26, 2023 17:25
Zhihan found that the plotly project has some requirements files that
are not recognized by FawltyDeps, with names like requirements_abc.txt.

Using the underscore as a separator in the filename does not match our
regex, which requires a word boundary ("\b") around the "requirements"
string in the filename.

Fix our regex: There is no reason why the underscore separator should
disqualify this as a requirements file, and simplifying the regex to
".*requirements.*\.(txt|in)" is unlikely to introduce false positives
(files that should _not_ be recognized as requirements.txt files, but
now are).

Also add unit tests precisely for parsing filenames of dependency files
as I could not find another test case that tested exactly this.
@jherland jherland force-pushed the jherland/relax-requirements-regex branch from f0e3e76 to 107a9f1 Compare September 27, 2023 07:20
Copy link
Collaborator

@Nour-Mws Nour-Mws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Hopefully we won't have any false positives popping up in the future :)

@jherland jherland merged commit 69a8b61 into main Sep 27, 2023
@jherland jherland deleted the jherland/relax-requirements-regex branch September 27, 2023 11:24
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