Skip to content

Conversation

MichaReiser
Copy link
Member

Summary

This PR stabilizes the new behavior introduced in #14512 to also detect defalut value arguemnts to os.environ.get that have an invalid type (not str).
There's an upstream issue for this behavior change pylint-dev/pylint#10092 that was accepted and a PR, but it hasn't been merged yet.

This behavior change was first shipped with Ruff 0.8.1 (Nov 22).

There has only be one PR since the new behavior was introduced but it was unrelated to the scope increase (#14841).

@MichaReiser MichaReiser added the rule Implementing or modifying a lint rule label Mar 12, 2025
Copy link

codspeed-hq bot commented Mar 12, 2025

CodSpeed Performance Report

Merging #16674 will degrade performances by 10.5%

Comparing micha/pylint-envvar-default-os-environ-get (d561912) with micha/ruff-0.10 (e9bfdfd)

Summary

❌ 1 regressions
✅ 31 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
red_knot_check_file[incremental] 4.9 ms 5.5 ms -10.5%

Copy link
Contributor

ruff-ecosystem results

Linter (stable)

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

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

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

+ airflow/api_fastapi/auth/managers/simple/simple_auth_manager.py:245:47: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ airflow/api_fastapi/core_api/app.py:59:43: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ providers/amazon/tests/system/amazon/aws/example_bedrock.py:57:70: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ providers/amazon/tests/system/amazon/aws/example_bedrock.py:62:86: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ providers/google/tests/system/google/cloud/storage_transfer/example_cloud_storage_transfer_service_aws.py:76:91: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ providers/google/tests/system/google/marketing_platform/example_display_video.py:53:53: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ providers/google/tests/system/google/marketing_platform/example_display_video.py:60:51: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ scripts/in_container/update_quarantined_test_status.py:216:47: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ scripts/in_container/update_quarantined_test_status.py:217:47: PLW1508 Invalid type for environment variable default; expected `str` or `None`

apache/superset (+4 -0 violations, +0 -0 fixes)

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

+ superset/config.py:1612:77: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ superset/migrations/shared/utils.py:44:55: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ superset/migrations/versions/2020-09-28_17-57_b56500de1855_add_uuid_column_to_import_mixin.py:76:55: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ superset/migrations/versions/2020-10-21_21-09_96e99fb176a0_add_import_mixing_to_saved_query.py:54:55: PLW1508 Invalid type for environment variable default; expected `str` or `None`

aws/aws-sam-cli (+12 -0 violations, +0 -0 fixes)

+ samcli/local/docker/container.py:42:93: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ samcli/local/lambdafn/remote_files.py:33:93: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ tests/integration/buildcmd/test_build_terraform_applications.py:177:69: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ tests/integration/package/package_integ_base.py:51:77: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ tests/integration/package/package_integ_base.py:55:78: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ tests/integration/publish/publish_app_integ_base.py:22:75: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ tests/regression/package/regression_package_base.py:24:75: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ tests/testing_utils.py:24:50: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ tests/testing_utils.py:26:50: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ tests/testing_utils.py:31:54: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ tests/testing_utils.py:31:94: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ tests/testing_utils.py:32:45: PLW1508 Invalid type for environment variable default; expected `str` or `None`

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

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

+ src/bokeh/settings.py:338:53: PLW1508 Invalid type for environment variable default; expected `str` or `None`

fronzbot/blinkpy (+1 -0 violations, +0 -0 fixes)

+ blinkapp/blinkapp.py:12:48: PLW1508 Invalid type for environment variable default; expected `str` or `None`

ibis-project/ibis (+11 -0 violations, +0 -0 fixes)

+ ibis/backends/clickhouse/tests/conftest.py:22:67: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ ibis/backends/clickhouse/tests/test_client.py:221:62: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ ibis/backends/clickhouse/tests/test_client.py:376:60: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ ibis/backends/exasol/tests/conftest.py:22:59: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ ibis/backends/mssql/tests/conftest.py:18:57: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ ibis/backends/mysql/tests/conftest.py:19:57: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ ibis/backends/oracle/tests/conftest.py:23:59: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ ibis/backends/postgres/tests/conftest.py:37:78: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ ibis/backends/risingwave/tests/conftest.py:22:80: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ ibis/backends/trino/tests/conftest.py:31:73: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ ibis/expr/tests/test_visualize.py:19:39: PLW1508 Invalid type for environment variable default; expected `str` or `None`

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

+ src/latch_cli/snakemake/single_task_snakemake.py:38:63: PLW1508 Invalid type for environment variable default; expected `str` or `None`

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

+ setup.py:367:54: PLW1508 Invalid type for environment variable default; expected `str` or `None`

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

+ astropy/utils/xml/setup_package.py:19:55: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ astropy/utils/xml/setup_package.py:20:50: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ astropy/wcs/setup_package.py:198:57: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ astropy/wcs/setup_package.py:199:57: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ astropy/wcs/setup_package.py:341:57: PLW1508 Invalid type for environment variable default; expected `str` or `None`
+ astropy/wcs/setup_package.py:342:57: PLW1508 Invalid type for environment variable default; expected `str` or `None`

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PLW1508 46 46 0 0 0

Linter (preview)

✅ ecosystem check detected no linter changes.

@MichaReiser
Copy link
Member Author

The ecosystem changes all look correct to me

@MichaReiser MichaReiser requested a review from ntBre March 12, 2025 16:58
@MichaReiser MichaReiser merged commit b4809b7 into micha/ruff-0.10 Mar 13, 2025
20 of 21 checks passed
@MichaReiser MichaReiser deleted the micha/pylint-envvar-default-os-environ-get branch March 13, 2025 07:43
@MichaReiser MichaReiser mentioned this pull request Mar 13, 2025
2 tasks
MichaReiser added a commit that referenced this pull request Mar 13, 2025
…LW1508`) (#16674)

## Summary
This PR stabilizes the new behavior introduced in
#14512 to also detect defalut
value arguemnts to `os.environ.get` that have an invalid type (not
`str`).
There's an upstream issue for this behavior change
pylint-dev/pylint#10092 that was accepted and
a PR, but it hasn't been merged yet.

This behavior change was first shipped with Ruff 0.8.1 (Nov 22). 

There has only be one PR since the new behavior was introduced but it
was unrelated to the scope increase
(#14841).
MichaReiser added a commit that referenced this pull request Mar 13, 2025
…LW1508`) (#16674)

## Summary
This PR stabilizes the new behavior introduced in
#14512 to also detect defalut
value arguemnts to `os.environ.get` that have an invalid type (not
`str`).
There's an upstream issue for this behavior change
pylint-dev/pylint#10092 that was accepted and
a PR, but it hasn't been merged yet.

This behavior change was first shipped with Ruff 0.8.1 (Nov 22). 

There has only be one PR since the new behavior was introduced but it
was unrelated to the scope increase
(#14841).
dcreager added a commit that referenced this pull request Mar 14, 2025
* main: (53 commits)
  [syntax-errors] Tuple unpacking in `for` statement iterator clause before Python 3.9 (#16558)
  Ruff v0.10 Release (#16708)
  Add new `noqa` specification to the docs (#16703)
  describe requires-python fallback in docs (#16704)
  [red-knot] handle cycles in MRO/bases resolution (#16693)
  [red-knot] Auto generate statement nodes (#16645)
  [`pylint`] Better inference for `str.strip` (`PLE310`) (#16671)
  [`pylint`] Improve `repeated-equality-comparison` fix to use a `set` when all elements are hashable (`PLR1714`) (#16685)
  [`pylint`/`pep8-naming`] Check `__new__` argument name in `bad-staticmethod-argument` and not `invalid-first-argument-name-for-class-method` (`PLW0211`/`N804`) (#16676)
  [`flake8-pyi`] Stabilize fix for `unused-private-type-var` (`PYI018`) (#16682)
  [`flake8-bandit`] Deprecate `suspicious-xmle-tree-usage` (`S320`) (#16680)
  [`flake8-simplify`] Avoid double negation in fixes (`SIM103`) (#16684)
  [`pyupgrade`]: Improve diagnostic range for `redundant-open-mode` (`UP015`) (#16672)
  Consider all `TYPE_CHECKING` symbols for type-checking blocks (#16669)
  [`pep8-naming`]: Ignore methods decorated with `@typing.override` (`invalid-argument-name`) (#16667)
  Stabilize FURB169 preview behavior (#16666)
  [`pylint`] Detect invalid default value type for `os.environ.get` (`PLW1508`) (#16674)
  [`flake8-pytest-style`] Allow for loops with empty bodies (`PT012`, `PT031`) (#16678)
  [`pyupgrade`]: Deprecate `non-pep604-isinstance` (`UP038`) (#16681)
  [`flake8-type-checking`] Stabilize `runtime-cast-value` (`TC006`) (#16637)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants