From 1e5fa41c1b44f1b6f248e6a4e84e7ded2f275a0f Mon Sep 17 00:00:00 2001 From: Lev Vereshchagin Date: Thu, 8 Oct 2026 13:27:13 +0300 Subject: [PATCH] Allow replace as a function verb --- src/community_of_python_flake8_plugin/constants.py | 1 + tests/test_plugin.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/community_of_python_flake8_plugin/constants.py b/src/community_of_python_flake8_plugin/constants.py index 6721bab..4ddb832 100644 --- a/src/community_of_python_flake8_plugin/constants.py +++ b/src/community_of_python_flake8_plugin/constants.py @@ -81,6 +81,7 @@ "set", "should", "update", + "replace", "write", "obtain", "perform", diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 0b4269b..3debfd9 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -155,6 +155,11 @@ def test_type_annotation_validations(input_source: str, expected_output: list[st ("def _total_value() -> int:\n return 1", ["COP009"]), # No violation: get_ prefix is allowed for sync functions ("def get_user_data() -> str:\n return 'value'", []), + # No violation: replacement is a supported operation verb + ("def replace_item() -> None:\n ...", []), + ("async def replace_item() -> None:\n ...", []), + ("def _replace_item() -> None:\n ...", []), + ("def __replace_item() -> None:\n ...", []), # COP010: Avoid get_ prefix in async function names ("async def get_user_data() -> str:\n return 'value'", ["COP010"]), # COP009: Function name must be a verb (even with mutable params)