From 097db2fcce235ced7d5e08134d840c40ed11318d Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Tue, 15 Aug 2023 15:29:29 -0500 Subject: [PATCH] Fix docs for `PLW1508` (#6602) --- .../rules/pylint/rules/invalid_envvar_default.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/crates/ruff/src/rules/pylint/rules/invalid_envvar_default.rs b/crates/ruff/src/rules/pylint/rules/invalid_envvar_default.rs index 549311f8ab..a6972b1d26 100644 --- a/crates/ruff/src/rules/pylint/rules/invalid_envvar_default.rs +++ b/crates/ruff/src/rules/pylint/rules/invalid_envvar_default.rs @@ -5,25 +5,29 @@ use ruff_python_ast::{self as ast, Constant, Expr, Operator, Ranged}; use crate::checkers::ast::Checker; /// ## What it does -/// Checks for `env.getenv` calls with invalid default values. +/// Checks for `os.getenv` calls with invalid default values. /// /// ## Why is this bad? -/// If an environment variable is set, `env.getenv` will return its value as -/// a string. If the environment variable is _not_ set, `env.getenv` will +/// If an environment variable is set, `os.getenv` will return its value as +/// a string. If the environment variable is _not_ set, `os.getenv` will /// return `None`, or the default value if one is provided. /// /// If the default value is not a string or `None`, then it will be -/// inconsistent with the return type of `env.getenv`, which can lead to +/// inconsistent with the return type of `os.getenv`, which can lead to /// confusing behavior. /// /// ## Example /// ```python -/// int(env.getenv("FOO", 1)) +/// import os +/// +/// int(os.getenv("FOO", 1)) /// ``` /// /// Use instead: /// ```python -/// int(env.getenv("FOO", "1")) +/// import os +/// +/// int(os.getenv("FOO", "1")) /// ``` #[violation] pub struct InvalidEnvvarDefault;