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

to remove the for loop in two functions in lint_er.py #17

Open
hshiue opened this issue Aug 21, 2023 · 1 comment
Open

to remove the for loop in two functions in lint_er.py #17

hshiue opened this issue Aug 21, 2023 · 1 comment

Comments

@hshiue
Copy link
Contributor

hshiue commented Aug 21, 2023

  1. metadata_file_is_expected_types
  2. metadata_FTK_file_has_valid_filename
    Prod VM lint_er.py should be good.
@nkrabben
Copy link
Collaborator

The issue here isn't the for-loop but the conditional inside of it.

for file in md_file_ls:

This function exits on the first item in the loop. If the if is true, the function returns True. If not, it returns False.
Instead you want to evaluate every item and then return. One way to do this would be to have a marker variable like the following.

valid = True
for file in md_file_ls:
        if not file.suffix.lower() in expected_types:
                LOGGER.error(f"{package.name} has unexpected file {file.name}")
                valid = False

return valid

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