diff --git a/integration_tests/test_flask_send_file_path_parameterization.py b/integration_tests/test_replace_flask_send_file.py similarity index 78% rename from integration_tests/test_flask_send_file_path_parameterization.py rename to integration_tests/test_replace_flask_send_file.py index 6c8abf60..ad105e09 100644 --- a/integration_tests/test_flask_send_file_path_parameterization.py +++ b/integration_tests/test_replace_flask_send_file.py @@ -1,5 +1,5 @@ -from core_codemods.flask_send_file_path_parameterization import ( - FlaskSendFilePathParameterization, +from core_codemods.replace_flask_send_file import ( + ReplaceFlaskSendFile, ) from integration_tests.base_test import ( BaseIntegrationTest, @@ -7,9 +7,9 @@ ) -class TestFlaskSendFilePathParameterization(BaseIntegrationTest): - codemod = FlaskSendFilePathParameterization - code_path = "tests/samples/flask_send_file_path_parameterization.py" +class TestReplaceFlaskSendFile(BaseIntegrationTest): + codemod = ReplaceFlaskSendFile + code_path = "tests/samples/replace_flask_send_file.py" original_code, expected_new_code = original_and_expected_from_code_path( code_path, [ @@ -49,5 +49,5 @@ class TestFlaskSendFilePathParameterization(BaseIntegrationTest): # fmt: on expected_line_change = "7" - change_description = FlaskSendFilePathParameterization.CHANGE_DESCRIPTION + change_description = ReplaceFlaskSendFile.CHANGE_DESCRIPTION num_changed_files = 1 diff --git a/src/codemodder/scripts/generate_docs.py b/src/codemodder/scripts/generate_docs.py index ddec58c2..70e0bb9e 100644 --- a/src/codemodder/scripts/generate_docs.py +++ b/src/codemodder/scripts/generate_docs.py @@ -206,7 +206,7 @@ class DocMetadata: importance="High", guidance_explained="Flask views may require proper handling of CSRF to function as expected and thus this change may break some views.", ), - "flask-send-file-path-parameterization": DocMetadata( + "replace-flask-send-file": DocMetadata( importance="Medium", guidance_explained="We believe this change is safe and will not cause any issues.", ), diff --git a/src/core_codemods/__init__.py b/src/core_codemods/__init__.py index 66172861..54f77896 100644 --- a/src/core_codemods/__init__.py +++ b/src/core_codemods/__init__.py @@ -45,7 +45,7 @@ from .combine_startswith_endswith import CombineStartswithEndswith from .fix_deprecated_logging_warn import FixDeprecatedLoggingWarn from .flask_enable_csrf_protection import FlaskEnableCSRFProtection -from .flask_send_file_path_parameterization import FlaskSendFilePathParameterization +from .replace_flask_send_file import ReplaceFlaskSendFile registry = CodemodCollection( origin="pixee", @@ -97,6 +97,6 @@ CombineStartswithEndswith, FixDeprecatedLoggingWarn, FlaskEnableCSRFProtection, - FlaskSendFilePathParameterization, + ReplaceFlaskSendFile, ], ) diff --git a/src/core_codemods/docs/pixee_python_flask-send-file-path-parameterization.md b/src/core_codemods/docs/pixee_python_replace-flask-send-file.md similarity index 100% rename from src/core_codemods/docs/pixee_python_flask-send-file-path-parameterization.md rename to src/core_codemods/docs/pixee_python_replace-flask-send-file.md diff --git a/src/core_codemods/flask_send_file_path_parameterization.py b/src/core_codemods/replace_flask_send_file.py similarity index 97% rename from src/core_codemods/flask_send_file_path_parameterization.py rename to src/core_codemods/replace_flask_send_file.py index 835c9d60..1318901f 100644 --- a/src/core_codemods/flask_send_file_path_parameterization.py +++ b/src/core_codemods/replace_flask_send_file.py @@ -7,8 +7,8 @@ from codemodder.utils.utils import positional_to_keyword -class FlaskSendFilePathParameterization(BaseCodemod, NameAndAncestorResolutionMixin): - NAME = "flask-send-file-path-parameterization" +class ReplaceFlaskSendFile(BaseCodemod, NameAndAncestorResolutionMixin): + NAME = "replace-flask-send-file" SUMMARY = "Replace unsafe usage of `flask.send_file`" DESCRIPTION = SUMMARY REVIEW_GUIDANCE = ReviewGuidance.MERGE_WITHOUT_REVIEW diff --git a/tests/codemods/test_flask_send_file_path_parameterization.py b/tests/codemods/test_replace_flask_send_file.py similarity index 95% rename from tests/codemods/test_flask_send_file_path_parameterization.py rename to tests/codemods/test_replace_flask_send_file.py index c588c06b..6a40744c 100644 --- a/tests/codemods/test_flask_send_file_path_parameterization.py +++ b/tests/codemods/test_replace_flask_send_file.py @@ -1,14 +1,14 @@ -from core_codemods.flask_send_file_path_parameterization import ( - FlaskSendFilePathParameterization, +from core_codemods.replace_flask_send_file import ( + ReplaceFlaskSendFile, ) from tests.codemods.base_codemod_test import BaseCodemodTest -class TestFlaskSendFilePathParameterization(BaseCodemodTest): - codemod = FlaskSendFilePathParameterization +class TestReplaceFlaskSendFile(BaseCodemodTest): + codemod = ReplaceFlaskSendFile def test_name(self): - assert self.codemod.name() == "flask-send-file-path-parameterization" + assert self.codemod.name() == "replace-flask-send-file" def test_direct_string(self, tmpdir): input_code = """\ diff --git a/tests/samples/flask_send_file_path_parameterization.py b/tests/samples/replace_flask_send_file.py similarity index 100% rename from tests/samples/flask_send_file_path_parameterization.py rename to tests/samples/replace_flask_send_file.py