This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author plokmijnuhby
Recipients eric.smith, plokmijnuhby
Date 2019-09-28.09:19:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1569662366.56.0.173626325454.issue38297@roundup.psfhosted.org>
In-reply-to
Content
I've slightly adjusted the script to check for module-level imports not at the top of the file. If we permit things like this:

if condition:
    import module
else:
    do_something_sensible()

as long as they are at the top of the file, it seems that only one in ten modules have a problem. Which is better but not great.

A common pattern which breaks the rules is this:

# Large amounts of code here

if __name__ == '__main__':
    import unittest
    unittest.main('test/test_thisfile')

although that by no means accounts for all of the problems.
History
Date User Action Args
2019-09-28 09:19:26plokmijnuhbysetrecipients: + plokmijnuhby, eric.smith
2019-09-28 09:19:26plokmijnuhbysetmessageid: <1569662366.56.0.173626325454.issue38297@roundup.psfhosted.org>
2019-09-28 09:19:26plokmijnuhbylinkissue38297 messages
2019-09-28 09:19:26plokmijnuhbycreate