Skip to content

Conversation

@hauntsaninja
Copy link
Contributor

This is a common footgun, see the example in #13014 (comment)

Fixes #13014 , fixes #13031

@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 14, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

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

PlasmaPy/PlasmaPy (+9 -0 violations, +0 -0 fixes)

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

+ tests/formulary/test_dielectric.py:191:13: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/formulary/test_dielectric.py:221:13: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/particles/test_particle_class.py:1165:9: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/utils/decorators/test_checks.py:199:17: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/utils/decorators/test_checks.py:221:17: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/utils/decorators/test_checks.py:375:17: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/utils/decorators/test_checks.py:400:17: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/utils/decorators/test_checks.py:413:17: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/utils/decorators/test_checks.py:427:17: ISC004 Unparenthesized implicit string concatenation in collection

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

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

+ airflow-core/src/airflow/cli/commands/connection_command.py:288:25: ISC004 Unparenthesized implicit string concatenation in collection
+ airflow-core/tests/unit/always/test_project_structure.py:413:9: ISC004 Unparenthesized implicit string concatenation in collection
+ airflow-core/tests/unit/always/test_project_structure.py:415:9: ISC004 Unparenthesized implicit string concatenation in collection
+ airflow-core/tests/unit/always/test_project_structure.py:518:9: ISC004 Unparenthesized implicit string concatenation in collection
+ airflow-core/tests/unit/always/test_project_structure.py:523:9: ISC004 Unparenthesized implicit string concatenation in collection
+ airflow-core/tests/unit/always/test_project_structure.py:525:9: ISC004 Unparenthesized implicit string concatenation in collection
+ airflow-core/tests/unit/always/test_project_structure.py:527:9: ISC004 Unparenthesized implicit string concatenation in collection
+ airflow-core/tests/unit/always/test_project_structure.py:529:9: ISC004 Unparenthesized implicit string concatenation in collection
+ airflow-core/tests/unit/always/test_project_structure.py:531:9: ISC004 Unparenthesized implicit string concatenation in collection
+ airflow-core/tests/unit/always/test_project_structure.py:577:9: ISC004 Unparenthesized implicit string concatenation in collection
+ airflow-core/tests/unit/always/test_project_structure.py:579:9: ISC004 Unparenthesized implicit string concatenation in collection
+ airflow-core/tests/unit/cli/commands/test_connection_command.py:245:21: ISC004 Unparenthesized implicit string concatenation in collection
+ airflow-core/tests/unit/cli/commands/test_connection_command.py:248:21: ISC004 Unparenthesized implicit string concatenation in collection
... 81 additional changes omitted for project

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

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

+ superset/db_engine_specs/denodo.py:103:13: ISC004 Unparenthesized implicit string concatenation in collection
+ superset/db_engine_specs/denodo.py:109:13: ISC004 Unparenthesized implicit string concatenation in collection
+ superset/db_engine_specs/denodo.py:125:13: ISC004 Unparenthesized implicit string concatenation in collection
+ superset/mcp_service/chart/tool/get_chart_data.py:312:17: ISC004 Unparenthesized implicit string concatenation in collection
+ superset/mcp_service/chart/validation/runtime/cardinality_validator.py:146:25: ISC004 Unparenthesized implicit string concatenation in collection
+ superset/mcp_service/chart/validation/runtime/cardinality_validator.py:154:25: ISC004 Unparenthesized implicit string concatenation in collection
+ superset/mcp_service/chart/validation/runtime/cardinality_validator.py:175:21: ISC004 Unparenthesized implicit string concatenation in collection
+ superset/mcp_service/chart/validation/runtime/chart_type_suggester.py:271:21: ISC004 Unparenthesized implicit string concatenation in collection
+ superset/mcp_service/chart/validation/schema_validator.py:182:21: ISC004 Unparenthesized implicit string concatenation in collection
+ superset/mcp_service/chart/validation/schema_validator.py:184:21: ISC004 Unparenthesized implicit string concatenation in collection
... 19 additional changes omitted for project

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

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

+ src/typings/bs4.pyi:15:67: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/unit/bokeh/io/test_export.py:232:9: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/unit/bokeh/io/test_export.py:299:9: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/unit/bokeh/io/test_export.py:303:9: ISC004 Unparenthesized implicit string concatenation in collection

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

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

+ libs/core/tests/unit_tests/_api/test_beta_decorator.py:19:13: ISC004 Unparenthesized implicit string concatenation in collection
+ libs/core/tests/unit_tests/_api/test_beta_decorator.py:38:13: ISC004 Unparenthesized implicit string concatenation in collection
+ libs/core/tests/unit_tests/_api/test_deprecation.py:26:13: ISC004 Unparenthesized implicit string concatenation in collection
+ libs/core/tests/unit_tests/_api/test_deprecation.py:53:13: ISC004 Unparenthesized implicit string concatenation in collection
+ libs/core/tests/unit_tests/language_models/chat_models/test_rate_limiting.py:217:13: ISC004 Unparenthesized implicit string concatenation in collection
+ libs/langchain/langchain_classic/evaluation/scoring/prompt.py:42:13: ISC004 Unparenthesized implicit string concatenation in collection
+ libs/langchain/tests/unit_tests/chains/test_qa_with_sources.py:31:13: ISC004 Unparenthesized implicit string concatenation in collection
+ libs/langchain/tests/unit_tests/chains/test_qa_with_sources.py:37:13: ISC004 Unparenthesized implicit string concatenation in collection
+ libs/langchain/tests/unit_tests/chains/test_qa_with_sources.py:47:13: ISC004 Unparenthesized implicit string concatenation in collection
+ libs/langchain/tests/unit_tests/chains/test_qa_with_sources.py:56:13: ISC004 Unparenthesized implicit string concatenation in collection
... 11 additional changes omitted for project

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

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

+ pandas/conftest.py:161:13: ISC004 Unparenthesized implicit string concatenation in collection
+ pandas/io/parsers/c_parser_wrapper.py:369:17: ISC004 Unparenthesized implicit string concatenation in collection
+ pandas/tests/arithmetic/test_period.py:1157:17: ISC004 Unparenthesized implicit string concatenation in collection
+ pandas/tests/arithmetic/test_period.py:1192:17: ISC004 Unparenthesized implicit string concatenation in collection
+ pandas/tests/arrays/datetimes/test_constructors.py:34:17: ISC004 Unparenthesized implicit string concatenation in collection
+ pandas/tests/arrays/floating/test_arithmetic.py:170:13: ISC004 Unparenthesized implicit string concatenation in collection
+ pandas/tests/computation/test_eval.py:179:17: ISC004 Unparenthesized implicit string concatenation in collection
+ pandas/tests/computation/test_eval.py:224:17: ISC004 Unparenthesized implicit string concatenation in collection
+ pandas/tests/groupby/test_raises.py:265:13: ISC004 Unparenthesized implicit string concatenation in collection
+ pandas/tests/groupby/test_raises.py:442:13: ISC004 Unparenthesized implicit string concatenation in collection
+ pandas/tests/groupby/test_raises.py:448:13: ISC004 Unparenthesized implicit string concatenation in collection
... 70 additional changes omitted for project

pypa/pip (+29 -0 violations, +0 -0 fixes)

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

+ src/pip/_internal/index/collector.py:480:17: ISC004 Unparenthesized implicit string concatenation in collection
+ src/pip/_internal/operations/freeze.py:201:17: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/functional/test_check.py:181:9: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/functional/test_install.py:2030:13: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/functional/test_install_check.py:112:13: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/functional/test_new_resolver_hashes.py:45:13: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/functional/test_new_resolver_hashes.py:54:13: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/unit/test_collector.py:130:9: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/unit/test_collector.py:778:13: ISC004 Unparenthesized implicit string concatenation in collection
+ tests/unit/test_collector.py:816:9: ISC004 Unparenthesized implicit string concatenation in collection
... 19 additional changes omitted for project

pypa/setuptools (+11 -0 violations, +0 -0 fixes)

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

+ pkg_resources/tests/test_resources.py:278:17: ISC004 Unparenthesized implicit string concatenation in collection
+ pkg_resources/tests/test_resources.py:296:17: ISC004 Unparenthesized implicit string concatenation in collection
+ pkg_resources/tests/test_resources.py:325:17: ISC004 Unparenthesized implicit string concatenation in collection
+ setuptools/command/bdist_egg.py:82:13: ISC004 Unparenthesized implicit string concatenation in collection
+ setuptools/command/bdist_egg.py:89:13: ISC004 Unparenthesized implicit string concatenation in collection
+ setuptools/command/bdist_wheel.py:148:13: ISC004 Unparenthesized implicit string concatenation in collection
+ setuptools/command/bdist_wheel.py:154:13: ISC004 Unparenthesized implicit string concatenation in collection
+ setuptools/command/bdist_wheel.py:188:13: ISC004 Unparenthesized implicit string concatenation in collection
+ setuptools/command/bdist_wheel.py:200:13: ISC004 Unparenthesized implicit string concatenation in collection
+ setuptools/command/dist_info.py:32:13: ISC004 Unparenthesized implicit string concatenation in collection
... 1 additional changes omitted for project

... Truncated remaining completed project reports due to GitHub comment length restrictions

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
ISC004 342 342 0 0 0

@hauntsaninja hauntsaninja marked this pull request as ready for review December 14, 2025 06:24
@zsol
Copy link
Member

zsol commented Dec 14, 2025

FWIW This was one of the more impactful lint rules in Fixit that prevented several serious outages at Instagram/Meta

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

Thank you. This rule makes sense to me

@MichaReiser MichaReiser requested a review from ntBre December 16, 2025 07:03
@ntBre ntBre added rule Implementing or modifying a lint rule preview Related to preview mode features labels Dec 16, 2025
Copy link
Contributor

@ntBre ntBre left a comment

Choose a reason for hiding this comment

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

Thank you, this looks great!

I only had one comment with a couple of small ideas, but I'm also happy with the current state of the diagnostic.

I do agree with Micha that we should make this an unsafe fix, if we keep the fix, though.

I think we should also touch base upstream. They expressed interest in adding this rule as well (flake8-implicit-str-concat/flake8-implicit-str-concat#55), so we should double check the error code to stay in sync, if we make it an ISC rule, which I think makes sense otherwise.

Have you had a chance to go through the ecosystem results? Cases like this feel a bit unfortunate to me:

        assert not np.isclose(val, expected, rtol=1e-16, atol=0.0), (
            f"Permittivity value test gives {val} and should not be "
            f"equal to {expected}.",
        )

Maybe we should exclude cases with a single element?

@MichaReiser
Copy link
Member

I think I'm fine with

        assert not np.isclose(val, expected, rtol=1e-16, atol=0.0), (
          f"Permittivity value test gives {val} and should not be "
          f"equal to {expected}.",
      )

because the trailing , is probably unintentional (it's now a tuple instead of string)

@hauntsaninja
Copy link
Contributor Author

Thank you both!

cases with single element

Like Micha says, this should be a string not a tuple. There were several accidental tuples in my work codebase, so this would be good to keep. (Most of these were asserts, we could consider a separate rule that complains about single element str tuples as assert message)

did you forget a comma

Moved it to a note, thanks!

I do agree with Micha that we should make this an unsafe fix

Made it an unsafe fix, thanks!

ambiguous vs unparenthesized

I prefer "unparenthesized" because it makes it clearer what the lint rule wants you to do

I think we should also touch base upstream

Commented upstream

ecosystem results

Yeah, I looked at them, felt mostly positive / expected hits to me. In a large internal codebase this has caught dozens and dozens and dozens of bugs, and is a readability improvement in most of the other cases.

Copy link
Contributor

@ntBre ntBre left a comment

Choose a reason for hiding this comment

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

Thank you!

@hauntsaninja
Copy link
Contributor Author

Fixed, and all is green!

@ntBre
Copy link
Contributor

ntBre commented Dec 16, 2025

Thanks again! I might give upstream at least until tomorrow to make sure there are no objections on the rule code (I take the 🚀 react on your comment as a positive sign), but this is otherwise good to go and should land before our release on Thursday.

@ntBre ntBre merged commit cf8d2e3 into astral-sh:main Dec 17, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Related to preview mode features rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detect and prevent implicit string concatenations e.g. lists Add a new rule to warn on implicitly-concatenated strings separated by a comment

4 participants