mirror of https://github.com/astral-sh/ruff
improve docs
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
parent
75cfafd9a1
commit
021f0c01aa
|
|
@ -11,10 +11,13 @@ use crate::{Fix, FixAvailability, Violation};
|
||||||
/// not the last base class in the bases tuple.
|
/// not the last base class in the bases tuple.
|
||||||
///
|
///
|
||||||
/// ## Why is this bad?
|
/// ## Why is this bad?
|
||||||
|
///
|
||||||
/// If `Generic[]` is not the final class in the bases tuple, unexpected
|
/// If `Generic[]` is not the final class in the bases tuple, unexpected
|
||||||
/// behaviour can occur at runtime (See [this CPython issue][1] for an example).
|
/// behaviour can occur at runtime (See [this CPython issue][1] for an example).
|
||||||
/// The rule is also applied to stub files, where it won't cause issues at runtime,
|
/// The rule is also applied to stub files, where it won't cause issues at
|
||||||
/// because type checkers may also behave unpredictably in this case.
|
/// runtime, because type checkers may not be able to infer an accurate [MRO]
|
||||||
|
/// for the class, which could lead to unexpected or inaccurate results when
|
||||||
|
/// they analyze your code.
|
||||||
///
|
///
|
||||||
/// For example:
|
/// For example:
|
||||||
/// ```python
|
/// ```python
|
||||||
|
|
@ -47,6 +50,7 @@ use crate::{Fix, FixAvailability, Violation};
|
||||||
/// - [`typing.Generic` documentation](https://docs.python.org/3/library/typing.html#typing.Generic)
|
/// - [`typing.Generic` documentation](https://docs.python.org/3/library/typing.html#typing.Generic)
|
||||||
///
|
///
|
||||||
/// [1]: https://github.com/python/cpython/issues/106102
|
/// [1]: https://github.com/python/cpython/issues/106102
|
||||||
|
/// [MRO]: https://docs.python.org/3/glossary.html#term-method-resolution-order
|
||||||
#[derive(ViolationMetadata)]
|
#[derive(ViolationMetadata)]
|
||||||
pub(crate) struct GenericNotLastBaseClass;
|
pub(crate) struct GenericNotLastBaseClass;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue