Skip to content

Conversation

@bcaller
Copy link
Collaborator

@bcaller bcaller commented Aug 14, 2018

os.walk is not deterministic (though often on the same computer it will
walk in the same order).

This means that the vulnerabilities can appear in different orders, making it hard to compare output.

Process files in alphabetical order.

I do need to look more deeply into how the import system works because I think there are some other non-determinism problems which can result in vulnerabilities not being found but I haven't figured it out yet.

os.walk is not deterministic (though often on the same computer it will
walk in the same order).

This means that the vulnerabilities appear in different orders on
different machines, making it hard to compare output.

Process files in alphabetical order.
The project_modules only need loading once if -pr is set, not once for
every file.
@KevinHock KevinHock self-requested a review August 14, 2018 18:09
Copy link
Collaborator

@KevinHock KevinHock left a comment

Choose a reason for hiding this comment

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

Looks great to me!

directory = os.path.normpath(args.project_root)
project_modules = get_modules(directory, prepend_module_root=args.prepend_module_root)

for path in sorted(files):
Copy link
Collaborator

@KevinHock KevinHock Aug 14, 2018

Choose a reason for hiding this comment

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

Such a great idea I don't think I would have ever thought of 😁

@KevinHock KevinHock merged commit c0e6ace into python-security:master Aug 14, 2018
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