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

[perflint] Add PERF401 and PERF402 rules #5298

Merged
merged 13 commits into from
Jul 3, 2023
Merged

[perflint] Add PERF401 and PERF402 rules #5298

merged 13 commits into from
Jul 3, 2023

Conversation

qdegraaf
Copy link
Contributor

Summary

Adds PERF401 and PERF402 mirroring W8401 and W8402 from https://github.com/tonybaloney/perflint

Implementation is not super smart but should be at parity with upstream implementation judging by: https://github.com/tonybaloney/perflint/blob/c07391c17671c3c9d5a7fd69120d1f570e268d58/perflint/comprehension_checker.py#L42-L73

It essentially checks:

  • If the body of a for-loop is just one statement
  • If that statement is an if and the if-statement contains a call to append() we flag PERF401 and suggest a list comprehension
  • If that statement is a plain call to append() or insert() we flag PERF402 and suggest list() or list.copy()

I've set the violation to only flag the first append call in a long if-else statement for PERF401. Happy to change this to some other location or make it multiple violations if that makes more sense.

Test Plan

Fixtures were added with the relevant scenarios for both rules

Issue Links

Refers: #4789

@github-actions
Copy link
Contributor

github-actions bot commented Jun 22, 2023

PR Check Results

Ecosystem

ℹ️ ecosystem check detected changes. (+301, -0, 0 error(s))

airflow (+121, -0)

+ airflow/api/common/experimental/get_dag_runs.py:44:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/cli/commands/cheat_sheet_command.py:44:17: PERF401 Use a list comprehension to create a new filtered list
+ airflow/cli/commands/connection_command.py:146:13: PERF401 Use a list comprehension to create a new filtered list
+ airflow/cli/commands/connection_command.py:233:17: PERF401 Use a list comprehension to create a new filtered list
+ airflow/cli/commands/dag_command.py:380:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/cli/commands/pool_command.py:116:13: PERF401 Use a list comprehension to create a new filtered list
+ airflow/cli/commands/role_command.py:50:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/cli/commands/standalone_command.py:297:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/cli/commands/user_command.py:220:21: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/dag_processing/manager.py:865:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/dag_processing/processor.py:510:21: PERF401 Use a list comprehension to create a new filtered list
+ airflow/decorators/base.py:220:17: PERF401 Use a list comprehension to create a new filtered list
+ airflow/decorators/base.py:239:21: PERF401 Use a list comprehension to create a new filtered list
+ airflow/decorators/setup_teardown.py:66:17: PERF401 Use a list comprehension to create a new filtered list
+ airflow/example_dags/example_params_trigger_ui.py:72:17: PERF401 Use a list comprehension to create a new filtered list
+ airflow/executors/kubernetes_executor.py:838:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/jobs/triggerer_job_runner.py:225:13: PERF401 Use a list comprehension to create a new filtered list
+ airflow/jobs/triggerer_job_runner.py:705:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/kubernetes/pod_generator_deprecated.py:174:21: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/kubernetes/pod_generator_deprecated.py:181:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/kubernetes/pod_generator_deprecated.py:214:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/migrations/utils.py:49:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/models/dag.py:1420:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/models/dag.py:1521:17: PERF401 Use a list comprehension to create a new filtered list
+ airflow/models/dag.py:1707:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/models/dag.py:2999:21: PERF401 Use a list comprehension to create a new filtered list
+ airflow/models/dagrun.py:1341:17: PERF401 Use a list comprehension to create a new filtered list
+ airflow/models/dataset.py:153:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/models/dataset.py:201:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/models/dataset.py:241:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/models/dataset.py:337:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/models/taskinstance.py:2148:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/models/taskinstance.py:2647:25: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/models/taskinstance.py:2657:25: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/amazon/aws/hooks/batch_client.py:499:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/amazon/aws/hooks/s3.py:460:21: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/amazon/aws/hooks/s3.py:620:21: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/amazon/aws/log/s3_task_handler.py:128:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/amazon/aws/sensors/sqs.py:207:17: PERF401 Use a list comprehension to create a new filtered list
+ airflow/providers/amazon/aws/sensors/sqs.py:225:21: PERF401 Use a list comprehension to create a new filtered list
+ airflow/providers/apache/beam/hooks/beam.py:76:13: PERF401 Use a list comprehension to create a new filtered list
+ airflow/providers/cncf/kubernetes/backcompat/backwards_compat_converters.py:77:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/common/sql/hooks/sql.py:465:25: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/dbt/cloud/operators/dbt.py:322:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/exasol/hooks/exasol.py:147:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/google/cloud/hooks/bigtable.py:162:21: PERF401 Use a list comprehension to create a new filtered list
+ airflow/providers/google/cloud/hooks/gcs.py:810:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/google/cloud/hooks/gcs.py:927:21: PERF401 Use a list comprehension to create a new filtered list
+ airflow/providers/google/cloud/hooks/stackdriver.py:256:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/google/cloud/hooks/stackdriver.py:258:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/google/cloud/hooks/stackdriver.py:530:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/google/cloud/log/stackdriver_task_handler.py:255:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/google/cloud/log/stackdriver_task_handler.py:258:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/google/cloud/log/stackdriver_task_handler.py:320:17: PERF401 Use a list comprehension to create a new filtered list
+ airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py:135:21: PERF401 Use a list comprehension to create a new filtered list
+ airflow/providers/google/cloud/transfers/cassandra_to_gcs.py:234:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/google/cloud/transfers/cassandra_to_gcs.py:322:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/google/cloud/transfers/sql_to_gcs.py:226:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/microsoft/azure/hooks/cosmos.py:276:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/microsoft/azure/hooks/data_lake.py:468:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/microsoft/azure/hooks/data_lake.py:487:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/microsoft/azure/hooks/wasb.py:292:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/microsoft/azure/hooks/wasb.py:664:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/providers/openlineage/utils/utils.py:197:17: PERF401 Use a list comprehension to create a new filtered list
+ airflow/providers/oracle/hooks/oracle.py:298:21: PERF401 Use a list comprehension to create a new filtered list
+ airflow/providers/sftp/hooks/sftp.py:398:17: PERF401 Use a list comprehension to create a new filtered list
+ airflow/providers/slack/hooks/slack_webhook.py:197:17: PERF401 Use a list comprehension to create a new filtered list
+ airflow/providers/slack/operators/slack_webhook.py:126:17: PERF401 Use a list comprehension to create a new filtered list
+ airflow/serialization/serialized_objects.py:709:17: PERF401 Use a list comprehension to create a new filtered list
+ airflow/stats.py:66:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/utils/edgemodifier.py:71:17: PERF401 Use a list comprehension to create a new filtered list
+ airflow/utils/entry_points.py:40:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/utils/log/file_task_handler.py:496:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ airflow/www/api/experimental/endpoints.py:329:13: PERF401 Use a list comprehension to create a new filtered list
+ airflow/www/decorators.py:52:13: PERF401 Use a list comprehension to create a new filtered list
+ airflow/www/extensions/init_appbuilder.py:670:25: PERF401 Use a list comprehension to create a new filtered list
+ airflow/www/views.py:445:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ dev/breeze/src/airflow_breeze/commands/ci_commands.py:357:25: PERF402 Use `list` or `list.copy` to create a copy of a list
+ dev/breeze/src/airflow_breeze/commands/release_management_commands.py:654:25: PERF401 Use a list comprehension to create a new filtered list
+ dev/breeze/src/airflow_breeze/commands/setup_commands.py:285:21: PERF402 Use `list` or `list.copy` to create a copy of a list
+ dev/breeze/src/airflow_breeze/commands/setup_commands.py:447:17: PERF401 Use a list comprehension to create a new filtered list
+ dev/breeze/src/airflow_breeze/params/common_build_params.py:105:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ dev/breeze/src/airflow_breeze/params/shell_params.py:264:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ dev/breeze/src/airflow_breeze/utils/exclude_from_matrix.py:30:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ dev/breeze/src/airflow_breeze/utils/exclude_from_matrix.py:46:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ dev/breeze/src/airflow_breeze/utils/parallel.py:247:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ dev/breeze/src/airflow_breeze/utils/selective_checks.py:478:21: PERF401 Use a list comprehension to create a new filtered list
+ dev/breeze/src/airflow_breeze/utils/selective_checks.py:738:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ dev/provider_packages/prepare_provider_packages.py:1927:13: PERF401 Use a list comprehension to create a new filtered list
+ docs/conf.py:264:13: PERF401 Use a list comprehension to create a new filtered list
+ docs/conf.py:268:13: PERF401 Use a list comprehension to create a new filtered list
+ docs/exts/docs_build/fetch_inventories.py:103:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ docs/exts/docs_build/fetch_inventories.py:111:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ docs/exts/docs_build/fetch_inventories.py:119:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ scripts/ci/pre_commit/pre_commit_check_order_dockerfile_extras.py:85:13: PERF401 Use a list comprehension to create a new filtered list
+ scripts/ci/pre_commit/pre_commit_check_order_dockerfile_extras.py:90:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ scripts/ci/pre_commit/pre_commit_sort_in_the_wild.py:47:13: PERF401 Use a list comprehension to create a new filtered list
+ scripts/in_container/remove_arm_packages.py:41:17: PERF401 Use a list comprehension to create a new filtered list
+ scripts/in_container/run_migration_reference.py:123:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ scripts/in_container/run_provider_yaml_files_check.py:157:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ scripts/in_container/run_provider_yaml_files_check.py:161:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ scripts/in_container/run_provider_yaml_files_check.py:267:21: PERF401 Use a list comprehension to create a new filtered list
+ scripts/in_container/run_provider_yaml_files_check.py:352:21: PERF401 Use a list comprehension to create a new filtered list
+ scripts/in_container/run_provider_yaml_files_check.py:485:17: PERF401 Use a list comprehension to create a new filtered list
+ scripts/in_container/update_quarantined_test_status.py:81:13: PERF401 Use a list comprehension to create a new filtered list
+ scripts/in_container/verify_providers.py:265:17: PERF401 Use a list comprehension to create a new filtered list
+ tests/dag_processing/test_job_runner.py:1299:17: PERF401 Use a list comprehension to create a new filtered list
+ tests/jobs/test_scheduler_job.py:619:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ tests/models/test_dag.py:895:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ tests/providers/amazon/aws/sensors/test_sqs.py:169:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ tests/providers/amazon/aws/sensors/test_sqs.py:215:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ tests/providers/amazon/aws/sensors/test_sqs.py:262:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ tests/providers/amazon/aws/transfers/test_dynamodb_to_s3.py:57:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ tests/providers/amazon/aws/transfers/test_sql_to_s3.py:208:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ tests/providers/amazon/aws/transfers/test_sql_to_s3.py:259:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ tests/providers/cncf/kubernetes/utils/test_pod_manager.py:444:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ tests/providers/cncf/kubernetes/utils/test_pod_manager.py:446:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ tests/providers/google/cloud/hooks/test_pubsub.py:395:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ tests/providers/google/cloud/transfers/test_sql_to_gcs.py:144:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ tests/utils/test_log_handlers.py:562:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ tests/utils/test_task_group.py:213:13: PERF402 Use `list` or `list.copy` to create a copy of a list

bokeh (+46, -0)

+ examples/topics/pie/donut.py:53:5: PERF402 Use `list` or `list.copy` to create a copy of a list
+ setup.py:68:13: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/core/has_props.py:806:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ src/bokeh/core/property/container.py:101:21: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/document/callbacks.py:304:17: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/embed/bundle.py:206:21: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/embed/util.py:334:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ src/bokeh/layouts.py:417:25: PERF402 Use `list` or `list.copy` to create a copy of a list
+ src/bokeh/layouts.py:436:25: PERF402 Use `list` or `list.copy` to create a copy of a list
+ src/bokeh/layouts.py:449:17: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/layouts.py:521:13: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/layouts.py:541:21: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/layouts.py:591:13: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/model/model.py:315:17: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/models/layouts.py:492:17: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/models/plots.py:470:21: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/models/plots.py:477:21: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/models/renderers/glyph_renderer.py:166:17: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/models/tools.py:1582:17: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/models/tools.py:1647:17: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/models/tools.py:1708:17: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/models/tools.py:1753:17: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/models/tools.py:1800:17: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/models/tools.py:1859:17: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/plotting/_figure.py:385:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ src/bokeh/plotting/_figure.py:426:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ src/bokeh/plotting/_figure.py:476:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ src/bokeh/plotting/_figure.py:482:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ src/bokeh/plotting/_figure.py:565:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ src/bokeh/plotting/_figure.py:607:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ src/bokeh/plotting/_tools.py:179:17: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/resources.py:470:25: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/server/contexts.py:310:17: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/server/contexts.py:88:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ src/bokeh/settings.py:756:21: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/settings.py:767:21: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/sphinxext/bokeh_directive.py:67:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ src/bokeh/sphinxext/bokeh_plot.py:272:21: PERF402 Use `list` or `list.copy` to create a copy of a list
+ src/bokeh/sphinxext/bokeh_sampledata_xref.py:134:17: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/sphinxext/bokeh_sampledata_xref.py:202:17: PERF401 Use a list comprehension to create a new filtered list
+ src/bokeh/util/functions.py:66:13: PERF401 Use a list comprehension to create a new filtered list
+ tests/codebase/test_no_request_host.py:48:17: PERF401 Use a list comprehension to create a new filtered list
+ tests/codebase/test_windows_reserved_filenames.py:43:17: PERF401 Use a list comprehension to create a new filtered list
+ tests/unit/bokeh/document/test_document.py:715:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ tests/unit/bokeh/protocol/messages/test_patch_doc.py:103:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ tests/unit/bokeh/protocol/messages/test_patch_doc.py:90:13: PERF402 Use `list` or `list.copy` to create a copy of a list

zulip (+134, -0)

+ analytics/lib/fixtures.py:68:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ analytics/views/installation_activity.py:612:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ corporate/views/upgrade.py:382:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ manage.py:99:21: PERF402 Use `list` or `list.copy` to create a copy of a list
+ scripts/lib/check_rabbitmq_queue.py:173:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ tools/lib/capitalization.py:232:13: PERF401 Use a list comprehension to create a new filtered list
+ tools/lib/html_branches.py:97:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ tools/setup/emoji/emoji_setup_utils.py:124:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/actions/create_user.py:197:17: PERF401 Use a list comprehension to create a new filtered list
+ zerver/actions/create_user.py:292:13: PERF401 Use a list comprehension to create a new filtered list
+ zerver/actions/message_edit.py:818:17: PERF401 Use a list comprehension to create a new filtered list
+ zerver/actions/message_flags.py:239:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/actions/streams.py:234:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/actions/streams.py:329:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/actions/streams.py:341:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/actions/streams.py:501:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/actions/users.py:457:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/data_import/gitter.py:125:13: PERF401 Use a list comprehension to create a new filtered list
+ zerver/data_import/gitter.py:161:13: PERF401 Use a list comprehension to create a new filtered list
+ zerver/data_import/gitter.py:330:17: PERF401 Use a list comprehension to create a new filtered list
+ zerver/data_import/mattermost.py:254:13: PERF401 Use a list comprehension to create a new filtered list
+ zerver/data_import/rocketchat.py:281:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/data_import/slack.py:387:13: PERF401 Use a list comprehension to create a new filtered list
+ zerver/data_import/slack.py:806:17: PERF401 Use a list comprehension to create a new filtered list
+ zerver/lib/bulk_create.py:226:13: PERF401 Use a list comprehension to create a new filtered list
+ zerver/lib/cache.py:547:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/display_recipient.py:169:17: PERF401 Use a list comprehension to create a new filtered list
+ zerver/lib/email_notifications.py:648:13: PERF401 Use a list comprehension to create a new filtered list
+ zerver/lib/events.py:1147:21: PERF401 Use a list comprehension to create a new filtered list
+ zerver/lib/events.py:496:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/events.py:506:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/fix_unreads.py:105:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/fix_unreads.py:65:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/generate_test_data.py:28:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/generate_test_data.py:33:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/generate_test_data.py:52:13: PERF401 Use a list comprehension to create a new filtered list
+ zerver/lib/home.py:58:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/import_realm.py:273:13: PERF401 Use a list comprehension to create a new filtered list
+ zerver/lib/import_realm.py:284:13: PERF401 Use a list comprehension to create a new filtered list
+ zerver/lib/import_realm.py:397:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/markdown/__init__.py:1922:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/markdown/__init__.py:2411:13: PERF401 Use a list comprehension to create a new filtered list
+ zerver/lib/markdown/__init__.py:852:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/markdown/__init__.py:866:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/markdown/__init__.py:880:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/message.py:1598:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/message.py:263:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/narrow.py:964:13: PERF401 Use a list comprehension to create a new filtered list
+ zerver/lib/request.py:358:13: PERF401 Use a list comprehension to create a new filtered list
+ zerver/lib/soft_deactivation.py:194:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/soft_deactivation.py:230:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/soft_deactivation.py:353:13: PERF401 Use a list comprehension to create a new filtered list
+ zerver/lib/topic.py:216:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/user_groups.py:118:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/user_groups.py:124:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/users.py:339:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/lib/users.py:663:13: PERF401 Use a list comprehension to create a new filtered list
+ zerver/lib/webhooks/git.py:84:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/migrations/0236_remove_illegal_characters_email_full.py:18:17: PERF401 Use a list comprehension to create a new filtered list
+ zerver/migrations/0434_create_nobody_system_group.py:18:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/migrations/0436_realmauthenticationmethods.py:18:17: PERF401 Use a list comprehension to create a new filtered list
+ zerver/models.py:1361:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/models.py:1427:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/openapi/curl_param_value_generators.py:147:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/openapi/markdown_extension.py:159:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/openapi/markdown_extension.py:198:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/openapi/markdown_extension.py:347:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/openapi/python_examples.py:1167:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/openapi/test_curl_examples.py:58:25: PERF401 Use a list comprehension to create a new filtered list
+ zerver/tests/test_auth_backends.py:5037:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_auth_backends.py:5099:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_events.py:1452:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_events.py:1499:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_events.py:845:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_events.py:863:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_events.py:899:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_events.py:921:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_events.py:944:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_home.py:1214:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_invite.py:104:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_invite.py:1401:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_invite.py:1631:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_invite.py:1687:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_invite.py:1741:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_markdown.py:677:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_message_fetch.py:2092:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_message_fetch.py:2369:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_message_fetch.py:2712:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_message_fetch.py:3062:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_message_fetch.py:4278:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_message_fetch.py:4290:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_message_fetch.py:4343:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_message_send.py:1361:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_message_send.py:1370:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_message_send.py:1382:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_message_send.py:1387:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_message_send.py:1923:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_message_send.py:1930:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_message_send.py:1951:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_message_send.py:1958:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_migrations.py:70:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_queue_worker.py:800:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_realm_export.py:283:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_retention.py:938:17: PERF401 Use a list comprehension to create a new filtered list
+ zerver/tests/test_soft_deactivation.py:123:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_soft_deactivation.py:138:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_soft_deactivation.py:186:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_soft_deactivation.py:248:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_soft_deactivation.py:67:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/tests/test_subs.py:2379:17: PERF401 Use a list comprehension to create a new filtered list
+ zerver/tests/test_subs.py:5005:17: PERF401 Use a list comprehension to create a new filtered list
+ zerver/views/message_fetch.py:150:17: PERF401 Use a list comprehension to create a new filtered list
+ zerver/views/streams.py:498:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/views/streams.py:523:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/views/streams.py:525:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/webhooks/azuredevops/view.py:77:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/webhooks/beanstalk/view.py:41:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/webhooks/freshstatus/view.py:134:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/webhooks/freshstatus/view.py:152:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/webhooks/github/view.py:567:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/webhooks/github/view.py:575:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/webhooks/gogs/view.py:51:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/webhooks/lidarr/view.py:105:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/webhooks/lidarr/view.py:118:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/webhooks/rhodecode/view.py:19:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/webhooks/slack_incoming/view.py:212:17: PERF401 Use a list comprehension to create a new filtered list
+ zerver/webhooks/slack_incoming/view.py:222:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/webhooks/slack_incoming/view.py:64:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/webhooks/slack_incoming/view.py:68:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zerver/webhooks/taiga/view.py:34:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zilencer/management/commands/populate_db.py:1179:9: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zilencer/management/commands/populate_db.py:187:13: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zilencer/management/commands/populate_db.py:550:17: PERF402 Use `list` or `list.copy` to create a copy of a list
+ zproject/urls.py:690:5: PERF402 Use `list` or `list.copy` to create a copy of a list

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00      7.8±0.01ms     5.2 MB/sec    1.01      7.9±0.01ms     5.2 MB/sec
formatter/numpy/ctypeslib.py               1.00   1729.8±1.98µs     9.6 MB/sec    1.00   1734.8±4.11µs     9.6 MB/sec
formatter/numpy/globals.py                 1.00    192.6±0.31µs    15.3 MB/sec    1.00    193.5±0.24µs    15.3 MB/sec
formatter/pydantic/types.py                1.01      3.8±0.01ms     6.8 MB/sec    1.00      3.7±0.01ms     6.8 MB/sec
linter/all-rules/large/dataset.py          1.00     13.3±0.05ms     3.1 MB/sec    1.01     13.5±0.08ms     3.0 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      3.4±0.00ms     5.0 MB/sec    1.00      3.4±0.01ms     5.0 MB/sec
linter/all-rules/numpy/globals.py          1.00    434.7±0.57µs     6.8 MB/sec    1.00    434.2±0.43µs     6.8 MB/sec
linter/all-rules/pydantic/types.py         1.00      5.9±0.01ms     4.3 MB/sec    1.00      5.9±0.01ms     4.3 MB/sec
linter/default-rules/large/dataset.py      1.00      6.7±0.02ms     6.1 MB/sec    1.00      6.7±0.02ms     6.1 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00   1474.6±1.89µs    11.3 MB/sec    1.00   1472.1±1.76µs    11.3 MB/sec
linter/default-rules/numpy/globals.py      1.00    167.9±0.49µs    17.6 MB/sec    1.01    169.0±0.31µs    17.5 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.0±0.01ms     8.4 MB/sec    1.00      3.0±0.01ms     8.4 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00      9.3±0.12ms     4.4 MB/sec    1.02      9.5±0.14ms     4.3 MB/sec
formatter/numpy/ctypeslib.py               1.00  1982.0±35.69µs     8.4 MB/sec    1.03      2.0±0.05ms     8.1 MB/sec
formatter/numpy/globals.py                 1.00    222.7±4.84µs    13.3 MB/sec    1.04   231.1±14.63µs    12.8 MB/sec
formatter/pydantic/types.py                1.00      4.4±0.06ms     5.8 MB/sec    1.02      4.5±0.08ms     5.7 MB/sec
linter/all-rules/large/dataset.py          1.00     15.7±0.22ms     2.6 MB/sec    1.00     15.7±0.23ms     2.6 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      4.1±0.12ms     4.1 MB/sec    1.00      4.1±0.06ms     4.1 MB/sec
linter/all-rules/numpy/globals.py          1.00    491.7±8.69µs     6.0 MB/sec    1.02   499.5±16.43µs     5.9 MB/sec
linter/all-rules/pydantic/types.py         1.00      6.9±0.12ms     3.7 MB/sec    1.01      7.0±0.13ms     3.7 MB/sec
linter/default-rules/large/dataset.py      1.01      8.1±0.10ms     5.0 MB/sec    1.00      8.0±0.09ms     5.1 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00  1678.0±22.24µs     9.9 MB/sec    1.01  1701.2±29.13µs     9.8 MB/sec
linter/default-rules/numpy/globals.py      1.00    194.5±3.12µs    15.2 MB/sec    1.01    196.4±5.23µs    15.0 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.6±0.05ms     7.1 MB/sec    1.00      3.6±0.04ms     7.1 MB/sec

@qdegraaf qdegraaf changed the title [perflint] Add PERF401 and PERF402 rules [perflint] Add PERF401 and PERF402 rules Jun 22, 2023
}

/// PERF401
pub(crate) fn slow_filtered_list_creation(checker: &mut Checker, body: &[Stmt]) {
Copy link
Member

Choose a reason for hiding this comment

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

@charliermarsh do we know whether it's cheaper to traverse the if-body inside of the rule OR call this check for every statement and test if the parent is an if statement?

@charliermarsh charliermarsh self-requested a review June 29, 2023 01:08
@charliermarsh
Copy link
Member

Sorry, I meant to get to this and the other perflint PR tonight, but I ran out of time. No action needed, I'll review + merge these when I can.

@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Jul 3, 2023
@charliermarsh charliermarsh enabled auto-merge (squash) July 3, 2023 03:58
@charliermarsh charliermarsh merged commit 93b2bd7 into astral-sh:main Jul 3, 2023
15 checks passed
renovate bot added a commit to ixm-one/pytest-cmake-presets that referenced this pull request Jul 3, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [ruff](https://beta.ruff.rs/docs)
([source](https://github.com/astral-sh/ruff),
[changelog](https://github.com/astral-sh/ruff/releases)) | `^0.0.275`
-> `^0.0.276` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.276/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.276/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.276/compatibility-slim/0.0.275)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.276/confidence-slim/0.0.275)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>astral-sh/ruff (ruff)</summary>

###
[`v0.0.276`](https://github.com/astral-sh/ruff/releases/tag/v0.0.276)

[Compare
Source](https://github.com/astral-sh/ruff/compare/v0.0.275...v0.0.276)

<!-- Release notes generated using configuration in .github/release.yml
at v0.0.276 -->

See the [release blog post](https://astral.sh/blog/ruff-v0.0.276) for
more, including detailed descriptions of any newly added rules.

#### What's Changed

Highlights include: experimental support for linting Jupyter Notebooks.

To opt-in to linting Jupyter Notebook files, add the `*.ipynb` pattern
to your [`include`](settings.md#include)
setting, like so:

```toml
[tool.ruff]

### Allow Ruff to discover `*.ipynb` files.
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
```

This will prompt Ruff to discover Jupyter Notebook files in any
specified directories, and lint them
accordingly.

Jupyter Notebook support is currently opt-in and experimental. We'd love
your help testing it out.
Have feedback? Run into issues? [Let us
know!](https://github.com/astral-sh/ruff/issues/new)

##### New Rules

- \[`flake8-pyi`] Implement `PYI002`, `PYI003`, `PYI004`, `PYI005` by
[@&#8203;density](https://github.com/density) in
[astral-sh/ruff#5457
- \[`numpy`] Implement `numpy-deprecated-function` (`NPY003`) by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5468
- \[`perflint`] Implement `unnecessary-list-cast` (`PERF101`) by
[@&#8203;qdegraaf](https://github.com/qdegraaf) in
[astral-sh/ruff#5121
- \[`perflint`] Implement `try-except-in-loop` (`PERF203`) by
[@&#8203;evanrittenhouse](https://github.com/evanrittenhouse) in
[astral-sh/ruff#5166
- \[`perflint`] Implement `manual-list-comprehension` (`PERF401`) and
`manual-list-copy` (`PERF402`) rules by
[@&#8203;qdegraaf](https://github.com/qdegraaf) in
[astral-sh/ruff#5298
- \[`pylint`] Implement Pylint `single-string-used-for-slots` (`C0205`)
as `single-string-slots` (`PLC0205`) by
[@&#8203;tjkuson](https://github.com/tjkuson) in
[astral-sh/ruff#5399

##### Jupyter

- Experimental release for Jupyter notebook integration by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5363
- Enable --watch for Jupyter notebooks by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5394
- Consider Jupyter index for code frames (`--show-source`) by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5402
- fixup! Consider Jupyter index for code frames (`--show-source`)
([#&#8203;5402](https://github.com/astral-sh/ruff/issues/5402)) by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5414

##### Settings

- \[`pyupgrade`] Restore the `keep-runtime-typing` setting by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5470
- Add `PythonVersion::Py312` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5316

##### Bug Fixes

- Support `pydantic.BaseSettings` in `mutable-class-default` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5312
- Allow `__slots__` assignments in `mutable-class-default` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5314
- Avoid syntax errors when removing f-string prefixes by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5319
- Ignore unpacking in `iteration-over-set` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5392
- Replace same length equal line with dash line in D407 by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5383
- Exclude docstrings from PYI053 by
[@&#8203;intgr](https://github.com/intgr) in
[astral-sh/ruff#5405
- Use "manual" fixability for E731 in shadowed context by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5430
- Detect consecutive, non-newline-delimited NumPy sections by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5467
- Fix `unnecessary-encode-utf8` to fix `encode` on parenthesized strings
correctly by [@&#8203;harupy](https://github.com/harupy) in
[astral-sh/ruff#5478
- Allow `Final` assignments in stubs by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5490
- Respect `abc` decorators when classifying function types by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5315
- Allow `@Author` format for "Missing Author" rule in `flake8-todos` by
[@&#8203;mayrholu](https://github.com/mayrholu) in
[astral-sh/ruff#4903
- Ignore type aliases for RUF013 by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5344
- Change W605 autofix to use raw strings if possible by
[@&#8203;hauntsaninja](https://github.com/hauntsaninja) in
[astral-sh/ruff#5352
- Add space when migrating to raw string by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5358
- Update the `invalid-escape-sequence` rule by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5359
- Include BaseException in B017 rule by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5466
- \[`flake8-django`] Skip duplicate violations in `DJ012` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5469

#### New Contributors

- [@&#8203;mayrholu](https://github.com/mayrholu) made their first
contribution in
[astral-sh/ruff#4903
- [@&#8203;hauntsaninja](https://github.com/hauntsaninja) made their
first contribution in
[astral-sh/ruff#5352
- [@&#8203;ethunk](https://github.com/ethunk) made their first
contribution in
[astral-sh/ruff#5397
- [@&#8203;LouisDISPA](https://github.com/LouisDISPA) made their first
contribution in
[astral-sh/ruff#5475

**Full Changelog**:
astral-sh/ruff@v0.0.275...v0.0.276

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/ixm-one/pytest-cmake-presets).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xNDQuMiIsInVwZGF0ZWRJblZlciI6IjM1LjE0NC4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
jankatins added a commit to jankatins/pr-workflow-example that referenced this pull request Jul 3, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [ruff](https://beta.ruff.rs/docs)
([source](https://github.com/astral-sh/ruff),
[changelog](https://github.com/astral-sh/ruff/releases)) | `0.0.275`
-> `0.0.276` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.276/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.276/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.276/compatibility-slim/0.0.275)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.276/confidence-slim/0.0.275)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>astral-sh/ruff (ruff)</summary>

###
[`v0.0.276`](https://github.com/astral-sh/ruff/releases/tag/v0.0.276)

[Compare
Source](https://github.com/astral-sh/ruff/compare/v0.0.275...v0.0.276)

<!-- Release notes generated using configuration in .github/release.yml
at v0.0.276 -->

See the [release blog post](https://astral.sh/blog/ruff-v0.0.276) for
more, including detailed descriptions of any newly added rules.

#### What's Changed

Highlights include: experimental support for linting Jupyter Notebooks.

To opt-in to linting Jupyter Notebook files, add the `*.ipynb` pattern
to your [`include`](settings.md#include)
setting, like so:

```toml
[tool.ruff]

### Allow Ruff to discover `*.ipynb` files.
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
```

This will prompt Ruff to discover Jupyter Notebook files in any
specified directories, and lint them
accordingly.

Jupyter Notebook support is currently opt-in and experimental. We'd love
your help testing it out.
Have feedback? Run into issues? [Let us
know!](https://github.com/astral-sh/ruff/issues/new)

##### New Rules

- \[`flake8-pyi`] Implement `PYI002`, `PYI003`, `PYI004`, `PYI005` by
[@&#8203;density](https://github.com/density) in
[astral-sh/ruff#5457
- \[`numpy`] Implement `numpy-deprecated-function` (`NPY003`) by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5468
- \[`perflint`] Implement `unnecessary-list-cast` (`PERF101`) by
[@&#8203;qdegraaf](https://github.com/qdegraaf) in
[astral-sh/ruff#5121
- \[`perflint`] Implement `try-except-in-loop` (`PERF203`) by
[@&#8203;evanrittenhouse](https://github.com/evanrittenhouse) in
[astral-sh/ruff#5166
- \[`perflint`] Implement `manual-list-comprehension` (`PERF401`) and
`manual-list-copy` (`PERF402`) rules by
[@&#8203;qdegraaf](https://github.com/qdegraaf) in
[astral-sh/ruff#5298
- \[`pylint`] Implement Pylint `single-string-used-for-slots` (`C0205`)
as `single-string-slots` (`PLC0205`) by
[@&#8203;tjkuson](https://github.com/tjkuson) in
[astral-sh/ruff#5399

##### Jupyter

- Experimental release for Jupyter notebook integration by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5363
- Enable --watch for Jupyter notebooks by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5394
- Consider Jupyter index for code frames (`--show-source`) by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5402
- fixup! Consider Jupyter index for code frames (`--show-source`)
([#&#8203;5402](https://github.com/astral-sh/ruff/issues/5402)) by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5414

##### Settings

- \[`pyupgrade`] Restore the `keep-runtime-typing` setting by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5470
- Add `PythonVersion::Py312` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5316

##### Bug Fixes

- Support `pydantic.BaseSettings` in `mutable-class-default` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5312
- Allow `__slots__` assignments in `mutable-class-default` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5314
- Avoid syntax errors when removing f-string prefixes by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5319
- Ignore unpacking in `iteration-over-set` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5392
- Replace same length equal line with dash line in D407 by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5383
- Exclude docstrings from PYI053 by
[@&#8203;intgr](https://github.com/intgr) in
[astral-sh/ruff#5405
- Use "manual" fixability for E731 in shadowed context by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5430
- Detect consecutive, non-newline-delimited NumPy sections by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5467
- Fix `unnecessary-encode-utf8` to fix `encode` on parenthesized strings
correctly by [@&#8203;harupy](https://github.com/harupy) in
[astral-sh/ruff#5478
- Allow `Final` assignments in stubs by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5490
- Respect `abc` decorators when classifying function types by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5315
- Allow `@Author` format for "Missing Author" rule in `flake8-todos` by
[@&#8203;mayrholu](https://github.com/mayrholu) in
[astral-sh/ruff#4903
- Ignore type aliases for RUF013 by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5344
- Change W605 autofix to use raw strings if possible by
[@&#8203;hauntsaninja](https://github.com/hauntsaninja) in
[astral-sh/ruff#5352
- Add space when migrating to raw string by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5358
- Update the `invalid-escape-sequence` rule by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5359
- Include BaseException in B017 rule by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5466
- \[`flake8-django`] Skip duplicate violations in `DJ012` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5469

#### New Contributors

- [@&#8203;mayrholu](https://github.com/mayrholu) made their first
contribution in
[astral-sh/ruff#4903
- [@&#8203;hauntsaninja](https://github.com/hauntsaninja) made their
first contribution in
[astral-sh/ruff#5352
- [@&#8203;ethunk](https://github.com/ethunk) made their first
contribution in
[astral-sh/ruff#5397
- [@&#8203;LouisDISPA](https://github.com/LouisDISPA) made their first
contribution in
[astral-sh/ruff#5475

**Full Changelog**:
astral-sh/ruff@v0.0.275...v0.0.276

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/jankatins/pr-workflow-example).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xNDQuMiIsInVwZGF0ZWRJblZlciI6IjM1LjE0NC4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
renovate bot added a commit to allenporter/pyrainbird that referenced this pull request Jul 5, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [ruff](https://beta.ruff.rs/docs)
([source](https://github.com/astral-sh/ruff),
[changelog](https://github.com/astral-sh/ruff/releases)) | `==0.0.275`
-> `==0.0.277` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.277/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.277/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.277/compatibility-slim/0.0.275)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.277/confidence-slim/0.0.275)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>astral-sh/ruff (ruff)</summary>

###
[`v0.0.277`](https://github.com/astral-sh/ruff/compare/v0.0.276...v0.0.277)

[Compare
Source](https://github.com/astral-sh/ruff/compare/v0.0.276...v0.0.277)

###
[`v0.0.276`](https://github.com/astral-sh/ruff/releases/tag/v0.0.276)

[Compare
Source](https://github.com/astral-sh/ruff/compare/v0.0.275...v0.0.276)

<!-- Release notes generated using configuration in .github/release.yml
at v0.0.276 -->

See the [release blog post](https://astral.sh/blog/ruff-v0.0.276) for
more, including detailed descriptions of any newly added rules.

#### What's Changed

Highlights include: experimental support for linting Jupyter Notebooks.

To opt-in to linting Jupyter Notebook files, add the `*.ipynb` pattern
to your [`include`](settings.md#include)
setting, like so:

```toml
[tool.ruff]

### Allow Ruff to discover `*.ipynb` files.
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
```

This will prompt Ruff to discover Jupyter Notebook files in any
specified directories, and lint them
accordingly.

Jupyter Notebook support is currently opt-in and experimental. We'd love
your help testing it out.
Have feedback? Run into issues? [Let us
know!](https://github.com/astral-sh/ruff/issues/new)

##### New Rules

- \[`flake8-pyi`] Implement `PYI002`, `PYI003`, `PYI004`, `PYI005` by
[@&#8203;density](https://github.com/density) in
[astral-sh/ruff#5457
- \[`numpy`] Implement `numpy-deprecated-function` (`NPY003`) by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5468
- \[`perflint`] Implement `unnecessary-list-cast` (`PERF101`) by
[@&#8203;qdegraaf](https://github.com/qdegraaf) in
[astral-sh/ruff#5121
- \[`perflint`] Implement `try-except-in-loop` (`PERF203`) by
[@&#8203;evanrittenhouse](https://github.com/evanrittenhouse) in
[astral-sh/ruff#5166
- \[`perflint`] Implement `manual-list-comprehension` (`PERF401`) and
`manual-list-copy` (`PERF402`) rules by
[@&#8203;qdegraaf](https://github.com/qdegraaf) in
[astral-sh/ruff#5298
- \[`pylint`] Implement Pylint `single-string-used-for-slots` (`C0205`)
as `single-string-slots` (`PLC0205`) by
[@&#8203;tjkuson](https://github.com/tjkuson) in
[astral-sh/ruff#5399

##### Jupyter

- Experimental release for Jupyter notebook integration by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5363
- Enable --watch for Jupyter notebooks by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5394
- Consider Jupyter index for code frames (`--show-source`) by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5402
- fixup! Consider Jupyter index for code frames (`--show-source`)
([#&#8203;5402](https://github.com/astral-sh/ruff/issues/5402)) by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5414

##### Settings

- \[`pyupgrade`] Restore the `keep-runtime-typing` setting by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5470
- Add `PythonVersion::Py312` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5316

##### Bug Fixes

- Support `pydantic.BaseSettings` in `mutable-class-default` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5312
- Allow `__slots__` assignments in `mutable-class-default` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5314
- Avoid syntax errors when removing f-string prefixes by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5319
- Ignore unpacking in `iteration-over-set` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5392
- Replace same length equal line with dash line in D407 by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5383
- Exclude docstrings from PYI053 by
[@&#8203;intgr](https://github.com/intgr) in
[astral-sh/ruff#5405
- Use "manual" fixability for E731 in shadowed context by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5430
- Detect consecutive, non-newline-delimited NumPy sections by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5467
- Fix `unnecessary-encode-utf8` to fix `encode` on parenthesized strings
correctly by [@&#8203;harupy](https://github.com/harupy) in
[astral-sh/ruff#5478
- Allow `Final` assignments in stubs by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5490
- Respect `abc` decorators when classifying function types by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5315
- Allow `@Author` format for "Missing Author" rule in `flake8-todos` by
[@&#8203;mayrholu](https://github.com/mayrholu) in
[astral-sh/ruff#4903
- Ignore type aliases for RUF013 by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5344
- Change W605 autofix to use raw strings if possible by
[@&#8203;hauntsaninja](https://github.com/hauntsaninja) in
[astral-sh/ruff#5352
- Add space when migrating to raw string by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5358
- Update the `invalid-escape-sequence` rule by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5359
- Include BaseException in B017 rule by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5466
- \[`flake8-django`] Skip duplicate violations in `DJ012` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5469

#### New Contributors

- [@&#8203;mayrholu](https://github.com/mayrholu) made their first
contribution in
[astral-sh/ruff#4903
- [@&#8203;hauntsaninja](https://github.com/hauntsaninja) made their
first contribution in
[astral-sh/ruff#5352
- [@&#8203;ethunk](https://github.com/ethunk) made their first
contribution in
[astral-sh/ruff#5397
- [@&#8203;LouisDISPA](https://github.com/LouisDISPA) made their first
contribution in
[astral-sh/ruff#5475

**Full Changelog**:
astral-sh/ruff@v0.0.275...v0.0.276

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/allenporter/pyrainbird).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xNDQuMiIsInVwZGF0ZWRJblZlciI6IjM1LjE0NC4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@qdegraaf qdegraaf deleted the feature/PERF401PERF402 branch July 6, 2023 17:34
renovate bot added a commit to allenporter/flux-local that referenced this pull request Jul 15, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [ruff](https://beta.ruff.rs/docs)
([source](https://github.com/astral-sh/ruff),
[changelog](https://github.com/astral-sh/ruff/releases)) | `==0.0.275`
-> `==0.0.278` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.278/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.278/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.278/compatibility-slim/0.0.275)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.278/confidence-slim/0.0.275)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>astral-sh/ruff (ruff)</summary>

###
[`v0.0.278`](https://github.com/astral-sh/ruff/releases/tag/v0.0.278)

[Compare
Source](https://github.com/astral-sh/ruff/compare/v0.0.277...v0.0.278)

<!-- Release notes generated using configuration in .github/release.yml
at main -->

See the [release blog post](https://astral.sh/blog/ruff-v0.0.278) for
more, including detailed descriptions of any newly added rules.

#### What's Changed

##### Rules

- \[`pylint`] Implement `typevar-bivariance` (`PLC0131`) by
[@&#8203;tjkuson](https://github.com/tjkuson) in
[astral-sh/ruff#5517
- \[`flake8-pyi`] Implement `unnecessary-literal-union` (`PYI030`) by
[@&#8203;zanieb](https://github.com/zanieb) in
[astral-sh/ruff#5570
- \[`pylint`] Implement `type-name-incorrect-variance` (`PLC0105`) by
[@&#8203;tjkuson](https://github.com/tjkuson) in
[astral-sh/ruff#5651
- \[`ruff`] Implement `unnecessary-list-allocation-for-first-element`
(`RUF015`) by
[@&#8203;evanrittenhouse](https://github.com/evanrittenhouse) in
[astral-sh/ruff#5549
- \[`flake8-bugbear`] Implement `re-sub-positional-args` (`B034`) by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5669
- \[`ruff`] Implement `invalid-index-type` (`RUF016`) by
[@&#8203;zanieb](https://github.com/zanieb) in
[astral-sh/ruff#5602

##### Settings

- \[`isort`] Add `--case-sensitive` flag by
[@&#8203;qdegraaf](https://github.com/qdegraaf) in
[astral-sh/ruff#5539
- \[`isort`] Support globbing in `isort` options by
[@&#8203;tjkuson](https://github.com/tjkuson) in
[astral-sh/ruff#5473

##### Bug Fixes

- Support autofix for some multiline `str.format` calls by
[@&#8203;harupy](https://github.com/harupy) in
[astral-sh/ruff#5638
- Avoid triggering `unnecessary-map` (`C417`) for late-bound lambdas by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5520
- Avoid triggering DTZ001-006 when using `.astimezone()` by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5524
- Enable attribute lookups via semantic model by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5536
- Avoid syntax errors when rewriting str(dict) in f-strings by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5538
- Differentiate between runtime and typing-time annotations by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5575
- Only run pyproject.toml lint rules when enabled by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5578
- Refactor isort directive skips to use iterators by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5623
- Allow descriptor instantiations in dataclass fields by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5537
- Refactor `noqa` directive parsing away from regex-based implementation
by [@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5554
- Emit warnings for invalid `# noqa` directives by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5571
- Support individual codes on `# flake8: noqa` directives by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5618
- Add `tkinter` import convention by
[@&#8203;tjkuson](https://github.com/tjkuson) in
[astral-sh/ruff#5626
- Avoid `PERF401` if conditional depends on list var by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5603
- Fix typo in complex-if-statement-in-stub message by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5635
- Make TRY301 trigger only if a `raise` throws a caught exception by
[@&#8203;evanrittenhouse](https://github.com/evanrittenhouse) in
[astral-sh/ruff#5455
- Skip flake8-future-annotations checks in stub files by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5652
- Always allow PEP 585 and PEP 604 rewrites in stub files by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5653
- Add support for `Union` declarations without `|` to PYI016 by
[@&#8203;zanieb](https://github.com/zanieb) in
[astral-sh/ruff#5598
- Ignore `_name_` and `_value_` accesses in `flake8-self` rules by
[@&#8203;monosans](https://github.com/monosans) in
[astral-sh/ruff#5663
- Refactor `repeated_keys()` to use `ComparableExpr` by
[@&#8203;qdegraaf](https://github.com/qdegraaf) in
[astral-sh/ruff#5696

#### New Contributors

- [@&#8203;karosis88](https://github.com/karosis88) made their first
contribution in
[astral-sh/ruff#5560
- [@&#8203;petermattia](https://github.com/petermattia) made their
first contribution in
[astral-sh/ruff#5579
-
[@&#8203;DimitriPapadopoulos](https://github.com/DimitriPapadopoulos)
made their first contribution in
[astral-sh/ruff#5607

**Full Changelog**:
astral-sh/ruff@v0.0.277...v0.0.278

###
[`v0.0.277`](https://github.com/astral-sh/ruff/releases/tag/v0.0.277)

[Compare
Source](https://github.com/astral-sh/ruff/compare/v0.0.276...v0.0.277)

<!-- Release notes generated using configuration in .github/release.yml
at v0.0.277 -->

#### What's Changed

##### Breaking Changes

- Add .ipynb_checkpoints, .pyenv, .pytest_cache, and .vscode to default
excludes by [@&#8203;charliermarsh](https://github.com/charliermarsh)
in
[astral-sh/ruff#5513

##### Rules

- \[`pylint`] Implement Pylint `typevar-name-mismatch` (`C0132`) by
[@&#8203;tjkuson](https://github.com/tjkuson) in
[astral-sh/ruff#5501

##### Settings

- Add `ruff rule --all` subcommand (with JSON output) by
[@&#8203;akx](https://github.com/akx) in
[astral-sh/ruff#5059

##### Bug Fixes

- Fix eval detection for suspicious-eval-usage by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5506
- Avoid PERF rules for iteration-dependent assignments by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5508
- Avoid returning first-match for rule prefixes by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5511

**Full Changelog**:
astral-sh/ruff@v0.0.276...v0.0.277

###
[`v0.0.276`](https://github.com/astral-sh/ruff/releases/tag/v0.0.276)

[Compare
Source](https://github.com/astral-sh/ruff/compare/v0.0.275...v0.0.276)

<!-- Release notes generated using configuration in .github/release.yml
at v0.0.276 -->

See the [release blog post](https://astral.sh/blog/ruff-v0.0.276) for
more, including detailed descriptions of any newly added rules.

#### What's Changed

Highlights include: experimental support for linting Jupyter Notebooks.

To opt-in to linting Jupyter Notebook files, add the `*.ipynb` pattern
to your [`include`](settings.md#include)
setting, like so:

```toml
[tool.ruff]

### Allow Ruff to discover `*.ipynb` files.
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
```

This will prompt Ruff to discover Jupyter Notebook files in any
specified directories, and lint them
accordingly.

Jupyter Notebook support is currently opt-in and experimental. We'd love
your help testing it out.
Have feedback? Run into issues? [Let us
know!](https://github.com/astral-sh/ruff/issues/new)

##### New Rules

- \[`flake8-pyi`] Implement `PYI002`, `PYI003`, `PYI004`, `PYI005` by
[@&#8203;density](https://github.com/density) in
[astral-sh/ruff#5457
- \[`numpy`] Implement `numpy-deprecated-function` (`NPY003`) by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5468
- \[`perflint`] Implement `unnecessary-list-cast` (`PERF101`) by
[@&#8203;qdegraaf](https://github.com/qdegraaf) in
[astral-sh/ruff#5121
- \[`perflint`] Implement `try-except-in-loop` (`PERF203`) by
[@&#8203;evanrittenhouse](https://github.com/evanrittenhouse) in
[astral-sh/ruff#5166
- \[`perflint`] Implement `manual-list-comprehension` (`PERF401`) and
`manual-list-copy` (`PERF402`) rules by
[@&#8203;qdegraaf](https://github.com/qdegraaf) in
[astral-sh/ruff#5298
- \[`pylint`] Implement Pylint `single-string-used-for-slots` (`C0205`)
as `single-string-slots` (`PLC0205`) by
[@&#8203;tjkuson](https://github.com/tjkuson) in
[astral-sh/ruff#5399

##### Jupyter

- Experimental release for Jupyter notebook integration by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5363
- Enable --watch for Jupyter notebooks by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5394
- Consider Jupyter index for code frames (`--show-source`) by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5402
- fixup! Consider Jupyter index for code frames (`--show-source`)
([#&#8203;5402](https://github.com/astral-sh/ruff/issues/5402)) by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5414

##### Settings

- \[`pyupgrade`] Restore the `keep-runtime-typing` setting by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5470
- Add `PythonVersion::Py312` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5316

##### Bug Fixes

- Support `pydantic.BaseSettings` in `mutable-class-default` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5312
- Allow `__slots__` assignments in `mutable-class-default` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5314
- Avoid syntax errors when removing f-string prefixes by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5319
- Ignore unpacking in `iteration-over-set` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5392
- Replace same length equal line with dash line in D407 by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5383
- Exclude docstrings from PYI053 by
[@&#8203;intgr](https://github.com/intgr) in
[astral-sh/ruff#5405
- Use "manual" fixability for E731 in shadowed context by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5430
- Detect consecutive, non-newline-delimited NumPy sections by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5467
- Fix `unnecessary-encode-utf8` to fix `encode` on parenthesized strings
correctly by [@&#8203;harupy](https://github.com/harupy) in
[astral-sh/ruff#5478
- Allow `Final` assignments in stubs by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5490
- Respect `abc` decorators when classifying function types by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5315
- Allow `@Author` format for "Missing Author" rule in `flake8-todos` by
[@&#8203;mayrholu](https://github.com/mayrholu) in
[astral-sh/ruff#4903
- Ignore type aliases for RUF013 by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#5344
- Change W605 autofix to use raw strings if possible by
[@&#8203;hauntsaninja](https://github.com/hauntsaninja) in
[astral-sh/ruff#5352
- Add space when migrating to raw string by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5358
- Update the `invalid-escape-sequence` rule by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5359
- Include BaseException in B017 rule by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5466
- \[`flake8-django`] Skip duplicate violations in `DJ012` by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[astral-sh/ruff#5469

#### New Contributors

- [@&#8203;mayrholu](https://github.com/mayrholu) made their first
contribution in
[astral-sh/ruff#4903
- [@&#8203;hauntsaninja](https://github.com/hauntsaninja) made their
first contribution in
[astral-sh/ruff#5352
- [@&#8203;ethunk](https://github.com/ethunk) made their first
contribution in
[astral-sh/ruff#5397
- [@&#8203;LouisDISPA](https://github.com/LouisDISPA) made their first
contribution in
[astral-sh/ruff#5475

**Full Changelog**:
astral-sh/ruff@v0.0.275...v0.0.276

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/allenporter/flux-local).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xNTkuNyIsInVwZGF0ZWRJblZlciI6IjM2LjUuMyIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

3 participants