Add documentation for eradicate, flake8-import-conventions, and flake8-no-pep420 (#2652)

This commit is contained in:
Charlie Marsh 2023-02-07 22:19:21 -05:00 committed by GitHub
parent 8261d0656e
commit 4c35feaa18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 195 additions and 84 deletions

View file

@ -0,0 +1,16 @@
# commented-out-code (ERA001)
Derived from the **eradicate** linter.
Autofix is always available.
### What it does
Checks for commented-out Python code.
### Why is this bad?
Commented-out code is dead code, and is often included inadvertently.
It should be removed.
### Example
```python
```

View file

@ -0,0 +1,21 @@
# implicit-namespace-package (INP001)
Derived from the **flake8-no-pep420** linter.
### What it does
Checks for packages that are missing an `__init__.py` file.
### Why is this bad?
Python packages are directories that contain a file named `__init__.py`.
The existence of this file indicates that the directory is a Python
package, and so it can be imported the same way a module can be
imported.
Directories that lack an `__init__.py` file can still be imported, but
they're indicative of a special kind of package, known as a namespace
package (see: [PEP 420](https://www.python.org/dev/peps/pep-0420/)).
Namespace packages are a relatively new feature of Python, and they're
not widely used. So a package that lacks an `__init__.py` file is
typically meant to be a regular package, and the absence of the
`__init__.py` file is probably an oversight.

View file

@ -0,0 +1,25 @@
# unconventional-import-alias (ICN001)
Derived from the **flake8-import-conventions** linter.
### What it does
Checks for imports that are typically imported using a common convention,
like `import pandas as pd`, and enforces that convention.
### Why is this bad?
Consistency is good. Use a common convention for imports to make your code
more readable and idiomatic.
For example, `import pandas as pd` is a common
convention for importing the `pandas` library, and users typically expect
Pandas to be aliased as `pd`.
### Example
```python
import pandas
```
Use instead:
```python
import pandas as pd
```