mirror of https://github.com/astral-sh/ruff
[B028-doc-update] Update documentation for B028 (#14338)
## Summary Resolves #14289 The documentation for B028 no_explicit_stacklevel is updated to be more clear. --------- Co-authored-by: dylwil3 <dylwil3@gmail.com>
This commit is contained in:
parent
e1838aac29
commit
07d13c6b4a
|
|
@ -11,10 +11,11 @@ use crate::checkers::ast::Checker;
|
|||
///
|
||||
/// ## Why is this bad?
|
||||
/// The `warnings.warn` method uses a `stacklevel` of 1 by default, which
|
||||
/// limits the rendered stack trace to that of the line on which the
|
||||
/// `warn` method is called.
|
||||
/// will output a stack frame of the line on which the "warn" method
|
||||
/// is called. Setting it to a higher number will output a stack frame
|
||||
/// from higher up the stack.
|
||||
///
|
||||
/// It's recommended to use a `stacklevel` of 2 or higher, give the caller
|
||||
/// It's recommended to use a `stacklevel` of 2 or higher, to give the caller
|
||||
/// more context about the warning.
|
||||
///
|
||||
/// ## Example
|
||||
|
|
|
|||
Loading…
Reference in New Issue