From 0ba8757d94104c62f2431160f3316e51203bd60d Mon Sep 17 00:00:00 2001 From: Samuele Maci Date: Sun, 14 Jul 2024 10:03:59 +0100 Subject: [PATCH] Remove support for dropbox style in ktfmt Dropbox style was removed in https://github.com/facebook/ktfmt/commit/4a393bb8c1156a4a0fd1ab736c02ca8dbd39a969 --- .../pretty_format_kotlin.py | 2 +- .../NotPrettyFormattedFixedKtfmtDropbox.kt | 3 --- tests/pretty_format_kotlin_test.py | 18 ------------------ 3 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 test-data/pretty_format_kotlin/NotPrettyFormattedFixedKtfmtDropbox.kt diff --git a/language_formatters_pre_commit_hooks/pretty_format_kotlin.py b/language_formatters_pre_commit_hooks/pretty_format_kotlin.py index 19f6aec..9374d5f 100644 --- a/language_formatters_pre_commit_hooks/pretty_format_kotlin.py +++ b/language_formatters_pre_commit_hooks/pretty_format_kotlin.py @@ -97,7 +97,7 @@ def pretty_format_kotlin(argv: typing.Optional[typing.List[str]] = None) -> int: ) parser.add_argument( "--ktfmt-style", - choices=["dropbox", "google", "kotlinlang"], + choices=["google", "kotlinlang"], dest="ktfmt_style", help="Which style to use", ) diff --git a/test-data/pretty_format_kotlin/NotPrettyFormattedFixedKtfmtDropbox.kt b/test-data/pretty_format_kotlin/NotPrettyFormattedFixedKtfmtDropbox.kt deleted file mode 100644 index a27b0db..0000000 --- a/test-data/pretty_format_kotlin/NotPrettyFormattedFixedKtfmtDropbox.kt +++ /dev/null @@ -1,3 +0,0 @@ -fun main(args: Array) { - println("Hello, world!") -} diff --git a/tests/pretty_format_kotlin_test.py b/tests/pretty_format_kotlin_test.py index d141efa..fab7353 100644 --- a/tests/pretty_format_kotlin_test.py +++ b/tests/pretty_format_kotlin_test.py @@ -91,7 +91,6 @@ def test_pretty_format_kotlin_checksum(undecorate_method, checksum, expected_ret @pytest.mark.parametrize( ("filename", "expected_retval"), ( - ("NotPrettyFormattedFixedKtfmtDropbox.kt", 1), ("NotPrettyFormattedFixedKtfmtGoogle.kt", 0), ("NotPrettyFormattedFixedKtfmtKotlinlang.kt", 1), ("NotPrettyFormatted.kt", 1), @@ -119,21 +118,6 @@ def test_pretty_format_kotlin_ktfmt_checksum(undecorate_method, checksum, expect @pytest.mark.parametrize( ("filename", "expected_retval"), ( - ("NotPrettyFormattedFixedKtfmtDropbox.kt", 0), - ("NotPrettyFormattedFixedKtfmtGoogle.kt", 1), - ("NotPrettyFormattedFixedKtfmtKotlinlang.kt", 0), - ("NotPrettyFormatted.kt", 1), - ("Invalid.kt", 1), - ), -) -def test_pretty_format_kotlin_ktfmt_dropbox_style(undecorate_method, filename, expected_retval): - assert undecorate_method(["--ktfmt", "--ktfmt-style=dropbox", filename]) == expected_retval - - -@pytest.mark.parametrize( - ("filename", "expected_retval"), - ( - ("NotPrettyFormattedFixedKtfmtDropbox.kt", 1), ("NotPrettyFormattedFixedKtfmtGoogle.kt", 0), ("NotPrettyFormattedFixedKtfmtKotlinlang.kt", 1), ("NotPrettyFormatted.kt", 1), @@ -147,7 +131,6 @@ def test_pretty_format_kotlin_ktfmt_google_style(undecorate_method, filename, ex @pytest.mark.parametrize( ("filename", "expected_retval"), ( - ("NotPrettyFormattedFixedKtfmtDropbox.kt", 0), ("NotPrettyFormattedFixedKtfmtGoogle.kt", 1), ("NotPrettyFormattedFixedKtfmtKotlinlang.kt", 0), ("NotPrettyFormatted.kt", 1), @@ -164,7 +147,6 @@ def test_pretty_format_kotlin_ktfmt_kotlinglang_style(undecorate_method, filenam ("NotPrettyFormatted.kt", "NotPrettyFormattedFixedKtlint.kt", []), ("NotPrettyFormatted.kt", "NotPrettyFormattedFixedKtfmtGoogle.kt", ["--ktfmt"]), ("NotPrettyFormatted.kt", "NotPrettyFormattedFixedKtfmtGoogle.kt", ["--ktfmt", "--ktfmt-style=google"]), - ("NotPrettyFormatted.kt", "NotPrettyFormattedFixedKtfmtDropbox.kt", ["--ktfmt", "--ktfmt-style=dropbox"]), ("NotPrettyFormatted.kt", "NotPrettyFormattedFixedKtfmtKotlinlang.kt", ["--ktfmt", "--ktfmt-style=kotlinlang"]), ), )