mirror of https://github.com/astral-sh/ruff
[`flake8-tidy-imports`] add documentation for `banned-api` (#2819)
This commit is contained in:
parent
fc465cc2af
commit
02897a141b
|
|
@ -1280,7 +1280,7 @@ For more, see [flake8-tidy-imports](https://pypi.org/project/flake8-tidy-imports
|
|||
|
||||
| Code | Name | Message | Fix |
|
||||
| ---- | ---- | ------- | --- |
|
||||
| TID251 | banned-api | `{name}` is banned: {message} | |
|
||||
| TID251 | [banned-api](https://github.com/charliermarsh/ruff/blob/main/docs/rules/banned-api.md) | `{name}` is banned: {message} | |
|
||||
| TID252 | [relative-imports](https://github.com/charliermarsh/ruff/blob/main/docs/rules/relative-imports.md) | Relative imports from parent modules are banned | 🛠 |
|
||||
|
||||
### flake8-type-checking (TCH)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,23 @@ pub struct ApiBan {
|
|||
}
|
||||
|
||||
define_violation!(
|
||||
/// ## What it does
|
||||
/// Checks for banned imports.
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
/// Projects may want to ensure that specific modules or module members are
|
||||
/// not be imported or accessed.
|
||||
///
|
||||
/// Security or other company policies may be a reason to impose
|
||||
/// restrictions on importing external Python libraries. In some cases,
|
||||
/// projects may adopt conventions around the use of certain modules or
|
||||
/// module members that are not enforceable by the language itself.
|
||||
///
|
||||
/// This rule enforces certain import conventions project-wide in an
|
||||
/// automatic way.
|
||||
///
|
||||
/// ## Options
|
||||
/// * `flake8-tidy-imports.banned-api`
|
||||
pub struct BannedApi {
|
||||
pub name: String,
|
||||
pub message: String,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
# banned-api (TID251)
|
||||
|
||||
Derived from the **flake8-tidy-imports** linter.
|
||||
|
||||
## What it does
|
||||
Checks for banned imports.
|
||||
|
||||
## Why is this bad?
|
||||
Projects may want to ensure that specific modules or module members are
|
||||
not be imported or accessed.
|
||||
|
||||
Security or other company policies may be a reason to impose
|
||||
restrictions on importing external Python libraries. In some cases,
|
||||
projects may adopt conventions around the use of certain modules or
|
||||
module members that are not enforceable by the language itself.
|
||||
|
||||
This rule enforces certain import conventions project-wide in an
|
||||
automatic way.
|
||||
|
||||
## Options
|
||||
* `flake8-tidy-imports.banned-api`
|
||||
Loading…
Reference in New Issue