From 70a9270e9168856c5bf10c2e28bdad633b9170f9 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 18 Jun 2024 11:49:40 +1000 Subject: [PATCH] Update docs for `literal-comparisons` (#4560) - Link to the relevant GH issue instead of copying examples/alternatives from the GH issue. --- .../pycodestyle/rules/literal_comparisons.rs | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/crates/ruff_linter/src/rules/pycodestyle/rules/literal_comparisons.rs b/crates/ruff_linter/src/rules/pycodestyle/rules/literal_comparisons.rs index 24920276f35b05..c5117544f04277 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/rules/literal_comparisons.rs +++ b/crates/ruff_linter/src/rules/pycodestyle/rules/literal_comparisons.rs @@ -52,18 +52,11 @@ impl EqCmpOp { /// /// This rule's fix is marked as unsafe, as it may alter runtime behavior when /// used with libraries that override the `==`/`__eq__` or `!=`/`__ne__` operators. -/// In these cases, `is`/`is not` may not be equivalent to `==`/`!=`. -/// -/// Notable examples and alternatives include: -/// - `pandas.DataFrame`, often used with `DataFrame.mask`, `DataFrame.where` - see [pandas.DataFrame.eq]. -/// - `pandas.Series`, often used with `Series.mask`, `Series.where` - see [pandas.Series.eq]. -/// - `sqlalchemy.Column`, often used with `Query.having`, `Query.filter`, `Query.where` - see [sqlalchemy.sql.expression.ColumnOperators.is_]. -/// - `numpy.Array`, often used with `Array.where` - no alternative. +/// In these cases, `is`/`is not` may not be equivalent to `==`/`!=`. For more +/// information, see [this issue]. /// /// [PEP 8]: https://peps.python.org/pep-0008/#programming-recommendations -/// [pandas.Series.eq]: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.eq.html -/// [pandas.DataFrame.eq]: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.eq.html -/// [sqlalchemy.sql.expression.ColumnOperators.is_]: https://docs.sqlalchemy.org/en/20/core/sqlelement.html#sqlalchemy.sql.expression.ColumnOperators.is_ +/// [this issue]: https://github.com/astral-sh/ruff/issues/4560 #[violation] pub struct NoneComparison(EqCmpOp); @@ -120,18 +113,11 @@ impl AlwaysFixableViolation for NoneComparison { /// /// This rule's fix is marked as unsafe, as it may alter runtime behavior when /// used with libraries that override the `==`/`__eq__` or `!=`/`__ne__` operators. -/// In these cases, `is`/`is not` may not be equivalent to `==`/`!=`. -/// -/// Notable examples and alternatives include: -/// - `pandas.DataFrame`, often used with `DataFrame.mask`, `DataFrame.where` - see [pandas.DataFrame.eq]. -/// - `pandas.Series`, often used with `Series.mask`, `Series.where` - see [pandas.Series.eq]. -/// - `sqlalchemy.Column`, often used with `Query.having`, `Query.filter`, `Query.where` - see [sqlalchemy.sql.expression.ColumnOperators.is_]. -/// - `numpy.Array`, often used with `Array.where` - no alternative. +/// In these cases, `is`/`is not` may not be equivalent to `==`/`!=`. For more +/// information, see [this issue]. /// /// [PEP 8]: https://peps.python.org/pep-0008/#programming-recommendations -/// [pandas.Series.eq]: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.eq.html -/// [pandas.DataFrame.eq]: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.eq.html -/// [sqlalchemy.sql.expression.ColumnOperators.is_]: https://docs.sqlalchemy.org/en/20/core/sqlelement.html#sqlalchemy.sql.expression.ColumnOperators.is_ +/// [this issue]: https://github.com/astral-sh/ruff/issues/4560 #[violation] pub struct TrueFalseComparison { value: bool,