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

HamlPyExtension filename extension check invalid #114

Closed
aydinyanik opened this issue Dec 21, 2012 · 1 comment
Closed

HamlPyExtension filename extension check invalid #114

aydinyanik opened this issue Dec 21, 2012 · 1 comment

Comments

@aydinyanik
Copy link

I noticed the "has_any_extension" function always returns true no matter what extension the files have.

def has_any_extension(file_path, extensions):
    file_ext = get_file_extension(file_path)
    return file_ext and extensions and [clean_extension(e) for e in extensions]

I think it's looking if the extensions in the HAML_FILE_NAME_EXTENSIONS list are in the same list, which always returns true.

Replacing it with this fixes it.

def has_any_extension(file_path, extensions):
    file_ext = get_file_extension(file_path)
    return file_ext and file_ext and file_ext in extensions
@a-krebs
Copy link
Contributor

a-krebs commented Dec 26, 2012

Semantically, the function should return true if file_path is in extensions, as I understand.

Then shouldn't it be:

def has_any_extension(file_path, extensions):
    file_ext = get_file_extension(file_path)
    return file_ext and extensions and file_ext in [clean_extension(e) for e in extensions]

I'm thinking you intended the second file_ext in the return statement to be extensions, but we also still want to pass extensions through clean_extension().

a-krebs added a commit to a-krebs/HamlPy that referenced this issue Dec 26, 2012
jessemiller added a commit that referenced this issue Jan 1, 2013
Fix #114 HamlPyExtension filename extension check invalid
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

No branches or pull requests

2 participants