Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spruce up docs for slice-to-remove-prefix-or-suffix (FURB188) #15328

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Jan 7, 2025

Summary

Spruce up the docs for this rule, in preparation for possible stabilisation

@AlexWaygood AlexWaygood added the documentation Improvements or additions to documentation label Jan 7, 2025
Copy link
Contributor

github-actions bot commented Jan 7, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+21 -21 violations, +0 -0 fixes in 6 projects; 49 projects unchanged)

apache/airflow (+9 -9 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL

- airflow/configuration.py:1313:17: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
+ airflow/configuration.py:1313:17: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.
- airflow/utils/log/action_logger.py:22:5: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
+ airflow/utils/log/action_logger.py:22:5: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.
- dev/breeze/src/airflow_breeze/utils/cdxgen.py:589:9: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
+ dev/breeze/src/airflow_breeze/utils/cdxgen.py:589:9: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.
- dev/breeze/src/airflow_breeze/utils/reproducible.py:142:25: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
+ dev/breeze/src/airflow_breeze/utils/reproducible.py:142:25: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.
- providers/src/airflow/providers/elasticsearch/log/es_response.py:101:14: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
+ providers/src/airflow/providers/elasticsearch/log/es_response.py:101:14: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.
- providers/src/airflow/providers/google/cloud/operators/dataproc_metastore.py:709:16: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
+ providers/src/airflow/providers/google/cloud/operators/dataproc_metastore.py:709:16: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.
- providers/src/airflow/providers/opensearch/log/os_response.py:101:14: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
+ providers/src/airflow/providers/opensearch/log/os_response.py:101:14: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.
- providers/tests/elasticsearch/log/test_es_response.py:186:13: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
+ providers/tests/elasticsearch/log/test_es_response.py:186:13: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.
- providers/tests/opensearch/log/test_os_response.py:107:13: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
+ providers/tests/opensearch/log/test_os_response.py:107:13: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.

bokeh/bokeh (+2 -2 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL

- src/bokeh/util/compiler.py:511:9: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
+ src/bokeh/util/compiler.py:511:9: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.
- tests/support/plugins/file_server.py:63:9: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
+ tests/support/plugins/file_server.py:63:9: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.

langchain-ai/langchain (+1 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview

- libs/core/langchain_core/language_models/llms.py:352:9: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
+ libs/core/langchain_core/language_models/llms.py:352:9: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.

latchbio/latch (+2 -2 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview

- src/latch_cli/snakemake/single_task_snakemake.py:365:12: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
+ src/latch_cli/snakemake/single_task_snakemake.py:365:12: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.
- src/latch_cli/utils/__init__.py:106:5: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
+ src/latch_cli/utils/__init__.py:106:5: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.

reflex-dev/reflex (+1 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview

- reflex/components/component.py:664:17: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
+ reflex/components/component.py:664:17: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.

astropy/astropy (+6 -6 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview

- astropy/io/fits/hdu/compressed/_tiled_compression.py:259:5: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
+ astropy/io/fits/hdu/compressed/_tiled_compression.py:259:5: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.
- astropy/io/fits/header.py:1646:9: FURB188 [*] Prefer `removeprefix` over conditionally replacing with slice.
+ astropy/io/fits/header.py:1646:9: FURB188 [*] Prefer `str.removeprefix()` over conditionally replacing with slice.
- astropy/io/votable/converters.py:1056:13: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
+ astropy/io/votable/converters.py:1056:13: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.
- astropy/io/votable/converters.py:1058:13: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
+ astropy/io/votable/converters.py:1058:13: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.
- astropy/io/votable/converters.py:326:13: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
+ astropy/io/votable/converters.py:326:13: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.
- astropy/table/meta.py:211:5: FURB188 [*] Prefer `removesuffix` over conditionally replacing with slice.
+ astropy/table/meta.py:211:5: FURB188 [*] Prefer `str.removesuffix()` over conditionally replacing with slice.

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
FURB188 42 21 21 0 0

Copy link
Collaborator

@dylwil3 dylwil3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much improved!

It looks like there is some inconsistency in the lint messages across Ruff around whether to refer to a method with or without parentheses - but that sounds like an issue for another day.

@AlexWaygood AlexWaygood merged commit ac72aca into main Jan 7, 2025
21 checks passed
@AlexWaygood AlexWaygood deleted the alex/furb188-docs branch January 7, 2025 19:58
dcreager added a commit that referenced this pull request Jan 8, 2025
* main:
  [`pylint`] Fix `unreachable` infinite loop (`PLW0101`) (#15278)
  fix invalid syntax in workflow file (#15357)
  [`pycodestyle`] Avoid false positives related to type aliases (`E252`) (#15356)
  [`flake8-builtins`] Disapply `A005` to stub files (#15350)
  Improve logging system using `logLevel`, avoid trace value (#15232)
  [`flake8-builtins`] Rename `A005` and improve its error message (#15348)
  Spruce up docs for pydoclint rules (#15325)
  [`flake8-type-checking`] Apply `TC008` more eagerly in `TYPE_CHECKING` blocks and disapply it in stubs (#15180)
  [red-knot] `knot_extensions` Python API (#15103)
  Display Union of Literals as a Literal (#14993)
  [red-knot] all types are assignable to object (#15332)
  [`ruff`] Parenthesize arguments to `int` when removing `int` would change semantics in `unnecessary-cast-to-int` (`RUF046`) (#15277)
  [`eradicate`] Correctly handle metadata blocks directly followed by normal blocks (`ERA001`) (#15330)
  Narrowing for class patterns in match statements (#15223)
  [red-knot] add call checking (#15200)
  Spruce up docs for `slice-to-remove-prefix-or-suffix` (`FURB188`) (#15328)
  [`internal`] Return statements in finally block point to end block for `unreachable` (`PLW0101`) (#15276)
  [`ruff`] Treat `)` as a regex metacharacter (`RUF043`, `RUF055`) (#15318)
  Use uv consistently throughout the documentation (#15302)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants