mirror of
https://github.com/astral-sh/ruff.git
synced 2026-10-28 10:45:37 +08:00
[flake8-no-pep420] Document preview behavior (INP001) (#29764)
## Summary INP001's preview-mode check for missing `__init__.py` files in namespace-package directories with nested packages is now documented. Empty directories and directory trees with no Python files are not flagged. ## Test Plan git diff --check passing. Documentation generation stalled while syncing the Rust 1.99 toolchain; no tests run. --------- Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
This commit is contained in:
1 parent
731a26b88f
commit
22c07fed17
1 file changed
+13
@@ -30,6 +30,19 @@ use crate::package::PackageRoot;
|
||||
/// `__init__.py` file is typically meant to be a regular package, and
|
||||
/// the absence of the `__init__.py` file is probably an oversight.
|
||||
///
|
||||
/// ## Preview
|
||||
///
|
||||
/// In preview, the rule also checks for packages without `__init__.py` files between two regular
|
||||
/// packages, such as `bar` in the project structure below.
|
||||
///
|
||||
/// ```text
|
||||
/// foo/
|
||||
/// ├── __init__.py
|
||||
/// └── bar/
|
||||
/// └── baz/
|
||||
/// └── __init__.py
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `namespace-packages`
|
||||
#[derive(ViolationMetadata)]
|
||||
|
||||
Reference in new issue
Block a user