-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat: check for both path/foo.py and path/foo/__init__.py being present #39
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -299,6 +299,29 @@ def check_W010(self, contents: WheelContents) -> list[FailedCheck]: | |||||||||
else: | ||||||||||
return [] | ||||||||||
|
||||||||||
def check_W011(self, contents: WheelContents) -> list[FailedCheck]: | ||||||||||
""" | ||||||||||
W011 — Wheel contains module and submodule with the same name | ||||||||||
|
||||||||||
E.g: checks for both `path/foo.py` and `path/foo/__init__.py` being present | ||||||||||
""" | ||||||||||
conflicts: list[str] = [] | ||||||||||
|
||||||||||
def check_dir(tree: Directory) -> None: | ||||||||||
for name, entry in tree.entries.items(): | ||||||||||
if isinstance(entry, Directory): | ||||||||||
if tree.files.get(name + ".py") is not None: | ||||||||||
conflicts.append(entry.path or name) | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of returning a single failed check that just contains the conflicting directory paths, I feel you should instead return one Cf. the following paragraph from "Adding a New Check" in
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
check_dir(entry) | ||||||||||
|
||||||||||
for tree in (contents.purelib_tree, contents.platlib_tree): | ||||||||||
if isinstance(tree, Directory): | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is redundant; |
||||||||||
check_dir(tree) | ||||||||||
|
||||||||||
if conflicts: | ||||||||||
return [FailedCheck(Check.W011, conflicts)] | ||||||||||
return [] | ||||||||||
|
||||||||||
def check_W101(self, contents: WheelContents) -> list[FailedCheck]: | ||||||||||
""" | ||||||||||
W101 — Wheel library is missing files in package tree | ||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -23,6 +23,7 @@ class Check(Enum): | |||||
W008 = "Wheel is empty" | ||||||
W009 = "Wheel contains multiple toplevel library entries" | ||||||
W010 = "Toplevel library directory contains no Python modules" | ||||||
W011 = "Wheel contains module and submodule with the same name" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
W101 = "Wheel library is missing files in package tree" | ||||||
W102 = "Wheel library contains files not in package tree" | ||||||
W201 = "Wheel library is missing specified toplevel entry" | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"stdout": "module_file_folder_shadow-0.1.0-py3-none-any.whl: W011: Wheel library has multiple declared toplevel entries:\n module_file_folder_shadow/foo/\n module_file_folder_shadow/foo/bar/", | ||
"stderr": "", | ||
"rc": 1 | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Testing with actual wheels is only for special cases, and there generally isn't a need to add more test wheels at this time. Instead, the new check should be tested with a test function in Please remove this wheel from your PR's history before requesting a re-review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.