From 25b7525e86c1cef3a11361dddce0f9b37eb020f4 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Mon, 9 Oct 2023 10:27:26 +0200 Subject: [PATCH 1/2] FIX: ignore whitespaces in TOML comparison --- src/repoma/check_dev_files/toml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/repoma/check_dev_files/toml.py b/src/repoma/check_dev_files/toml.py index b543e25f..1425f10c 100644 --- a/src/repoma/check_dev_files/toml.py +++ b/src/repoma/check_dev_files/toml.py @@ -106,7 +106,7 @@ def _update_taplo_config() -> None: existing = tomlkit.load(f) expected_str = tomlkit.dumps(expected) existing_str = tomlkit.dumps(existing) - if existing_str != expected_str: + if existing_str.strip() != expected_str.strip(): with open(CONFIG_PATH.taplo, "w") as stream: stream.write(expected_str) msg = f"Updated {CONFIG_PATH.taplo} config file" From 1a081d6f9a927bcea3ce26422a89d13259782104 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Mon, 9 Oct 2023 10:31:30 +0200 Subject: [PATCH 2/2] ENH: sort keys in Taplo config comparison --- src/repoma/check_dev_files/toml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/repoma/check_dev_files/toml.py b/src/repoma/check_dev_files/toml.py index 1425f10c..682a8d49 100644 --- a/src/repoma/check_dev_files/toml.py +++ b/src/repoma/check_dev_files/toml.py @@ -104,7 +104,7 @@ def _update_taplo_config() -> None: del expected["exclude"] with open(CONFIG_PATH.taplo) as f: existing = tomlkit.load(f) - expected_str = tomlkit.dumps(expected) + expected_str = tomlkit.dumps(expected, sort_keys=True) existing_str = tomlkit.dumps(existing) if existing_str.strip() != expected_str.strip(): with open(CONFIG_PATH.taplo, "w") as stream: