-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Avoid inserting trailing commas within f-strings #8574
Conversation
@@ -42,7 +42,7 @@ | |||
4, | |||
) | |||
|
|||
foo = 3, | |||
foo = 3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My editor is stripping this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Although this does mean that we wouldn't support similar expressions inside the f-string. This could be a candidate to move the rule to AST checker. We can then use the lexer to check for missing commas for each possible expression.
👍 Yeah, I'm not sure we can feasibly support linting within f-strings for this rule as long as it's tokenized. |
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
COM812 | 1156 | 140 | 1016 | 0 | 0 |
COM819 | 315 | 314 | 1 | 0 | 0 |
COM818 | 195 | 195 | 0 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+629 -955 violations, +0 -0 fixes in 41 projects)
apache/airflow (+336 -786 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --select ALL --preview
- airflow/api/common/trigger_dag.py:70:78: COM812 [*] Trailing comma missing - airflow/api_connexion/endpoints/config_endpoint.py:122:103: COM812 [*] Trailing comma missing + airflow/api_connexion/endpoints/config_endpoint.py:122:45: COM812 [*] Trailing comma missing + airflow/api_connexion/endpoints/task_instance_endpoint.py:387:24: COM812 [*] Trailing comma missing - airflow/api_connexion/endpoints/task_instance_endpoint.py:387:95: COM812 [*] Trailing comma missing - airflow/api_connexion/endpoints/task_instance_endpoint.py:535:102: COM812 [*] Trailing comma missing + airflow/api_connexion/endpoints/task_instance_endpoint.py:535:20: COM812 [*] Trailing comma missing + airflow/api_connexion/parameters.py:121:20: COM812 [*] Trailing comma missing - airflow/api_connexion/parameters.py:122:57: COM812 [*] Trailing comma missing - airflow/api_internal/internal_api_call.py:106:103: COM812 [*] Trailing comma missing + airflow/auth/managers/fab/api_endpoints/role_and_permission_endpoint.py:83:20: COM812 [*] Trailing comma missing - airflow/auth/managers/fab/api_endpoints/role_and_permission_endpoint.py:84:57: COM812 [*] Trailing comma missing ... 899 additional changes omitted for rule COM812 + airflow/cli/cli_config.py:69:20: COM819 [*] Trailing comma prohibited + airflow/cli/commands/db_command.py:214:41: COM819 [*] Trailing comma prohibited + airflow/hooks/filesystem.py:86:29: COM818 Trailing comma on bare tuple prohibited + airflow/hooks/filesystem.py:87:24: COM818 Trailing comma on bare tuple prohibited + airflow/hooks/package_index.py:92:25: COM818 Trailing comma on bare tuple prohibited + airflow/hooks/package_index.py:94:20: COM818 Trailing comma on bare tuple prohibited + airflow/providers/amazon/aws/hooks/base_aws.py:866:25: COM818 Trailing comma on bare tuple prohibited + airflow/providers/apache/beam/hooks/beam.py:191:31: COM819 [*] Trailing comma prohibited + airflow/providers/apache/beam/hooks/beam.py:507:31: COM819 [*] Trailing comma prohibited + airflow/providers/apache/hive/hooks/hive.py:262:53: COM819 [*] Trailing comma prohibited + airflow/providers/apache/hive/hooks/hive.py:265:53: COM819 [*] Trailing comma prohibited + airflow/providers/apache/spark/hooks/spark_submit.py:276:40: COM819 [*] Trailing comma prohibited + airflow/providers/apache/sqoop/hooks/sqoop.py:125:36: COM819 [*] Trailing comma prohibited + airflow/providers/cncf/kubernetes/decorators/kubernetes.py:75:35: COM819 [*] Trailing comma prohibited + airflow/providers/cncf/kubernetes/pod_launcher_deprecated.py:283:49: COM819 [*] Trailing comma prohibited + airflow/providers/cncf/kubernetes/utils/delete_from.py:133:23: COM819 [*] Trailing comma prohibited + airflow/providers/cncf/kubernetes/utils/delete_from.py:134:31: COM819 [*] Trailing comma prohibited ... 123 additional changes omitted for rule COM819 + airflow/providers/slack/hooks/slack.py:227:25: COM818 Trailing comma on bare tuple prohibited + airflow/providers/slack/hooks/slack.py:231:24: COM818 Trailing comma on bare tuple prohibited + airflow/providers/tabular/hooks/tabular.py:74:25: COM818 Trailing comma on bare tuple prohibited + dev/breeze/src/airflow_breeze/commands/ci_image_commands.py:640:43: COM818 Trailing comma on bare tuple prohibited + dev/breeze/src/airflow_breeze/commands/kubernetes_commands.py:1055:29: COM818 Trailing comma on bare tuple prohibited + dev/breeze/src/airflow_breeze/commands/kubernetes_commands.py:1331:29: COM818 Trailing comma on bare tuple prohibited ... 1087 additional changes omitted for project
bokeh/bokeh (+41 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --select ALL --preview
+ examples/output/apis/autoload_static_flask.py:27:37: COM819 [*] Trailing comma prohibited + examples/server/app/stocks/main.py:75:73: COM819 [*] Trailing comma prohibited + scripts/sri.py:54:6: COM818 Trailing comma on bare tuple prohibited + scripts/sri.py:72:34: COM818 Trailing comma on bare tuple prohibited + src/bokeh/application/handlers/document_lifecycle.py:66:73: COM812 [*] Trailing comma missing + src/bokeh/document/models.py:174:49: COM819 [*] Trailing comma prohibited + src/bokeh/embed/bundle.py:309:41: COM819 [*] Trailing comma prohibited + src/bokeh/embed/bundle.py:321:46: COM819 [*] Trailing comma prohibited + src/bokeh/io/webdriver.py:83:55: COM819 [*] Trailing comma prohibited ... 13 additional changes omitted for rule COM819 + src/bokeh/plotting/_renderer.py:291:120: COM812 [*] Trailing comma missing ... 31 additional changes omitted for project
milvus-io/pymilvus (+2 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --preview
+ pymilvus/client/__init__.py:47:65: COM819 [*] Trailing comma prohibited + pymilvus/decorators.py:81:53: COM819 [*] Trailing comma prohibited
rotki/rotki (+91 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --preview
+ rotkehlchen/accounting/cost_basis/base.py:159:100: COM818 Trailing comma on bare tuple prohibited + rotkehlchen/accounting/pot.py:309:26: COM819 [*] Trailing comma prohibited + rotkehlchen/assets/asset.py:581:40: COM819 [*] Trailing comma prohibited + rotkehlchen/chain/aggregator.py:141:17: COM818 Trailing comma on bare tuple prohibited + rotkehlchen/chain/aggregator.py:776:28: COM819 [*] Trailing comma prohibited + rotkehlchen/chain/bitcoin/utils.py:189:25: COM818 Trailing comma on bare tuple prohibited + rotkehlchen/chain/bitcoin/utils.py:192:25: COM818 Trailing comma on bare tuple prohibited + rotkehlchen/chain/ethereum/modules/eth2/eth2.py:303:31: COM819 [*] Trailing comma prohibited + rotkehlchen/chain/ethereum/modules/eth2/eth2.py:304:25: COM819 [*] Trailing comma prohibited + rotkehlchen/chain/ethereum/modules/hop/decoder.py:45:44: COM819 [*] Trailing comma prohibited ... 20 additional changes omitted for rule COM819 ... 81 additional changes omitted for project
sphinx-doc/sphinx (+23 -1 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --preview
+ sphinx/domains/cpp.py:6218:80: COM812 [*] Trailing comma missing + sphinx/ext/apidoc.py:83:35: COM819 [*] Trailing comma prohibited + sphinx/ext/doctest.py:463:27: COM812 [*] Trailing comma missing + sphinx/roles.py:104:51: COM819 [*] Trailing comma prohibited + sphinx/testing/util.py:49:31: COM818 Trailing comma on bare tuple prohibited + sphinx/testing/util.py:51:41: COM818 Trailing comma on bare tuple prohibited + sphinx/testing/util.py:63:38: COM818 Trailing comma on bare tuple prohibited - sphinx/writers/texinfo.py:433:68: COM819 [*] Trailing comma prohibited + tests/test_build_latex.py:1737:50: COM818 Trailing comma on bare tuple prohibited + tests/test_ext_autodoc.py:439:50: COM818 Trailing comma on bare tuple prohibited ... 14 additional changes omitted for project
zulip/zulip (+136 -168 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --select ALL --preview
- analytics/lib/fixtures.py:60:88: COM812 [*] Trailing comma missing - analytics/management/commands/update_analytics_counts.py:49:35: COM812 [*] Trailing comma missing - analytics/management/commands/update_analytics_counts.py:94:107: COM812 [*] Trailing comma missing - analytics/tests/test_stats_views.py:463:306: COM812 [*] Trailing comma missing - analytics/tests/test_stats_views.py:478:306: COM812 [*] Trailing comma missing - analytics/tests/test_stats_views.py:512:291: COM812 [*] Trailing comma missing ... 169 additional changes omitted for rule COM812 + corporate/tests/test_stripe.py:1988:53: COM819 [*] Trailing comma prohibited + scripts/lib/sharding.py:35:35: COM818 Trailing comma on bare tuple prohibited + scripts/lib/sharding.py:69:49: COM818 Trailing comma on bare tuple prohibited + scripts/lib/zulip_tools.py:131:34: COM819 [*] Trailing comma prohibited ... 294 additional changes omitted for project
Changes by rule (3 rules affected)
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
COM812 | 1088 | 134 | 954 | 0 | 0 |
COM819 | 306 | 305 | 1 | 0 | 0 |
COM818 | 190 | 190 | 0 | 0 | 0 |
Ahh this is buggy. Need to fix. |
This reverts commit f499f0c.
Reverts #8574. This caused a bunch of ecosystem changes -- needs more work.
Closes #8556.