From 2b14f1bc22c8b7fc5ad66c73c2985f6110dd4346 Mon Sep 17 00:00:00 2001 From: Kamil Kozik Date: Mon, 24 Aug 2026 19:14:27 +0200 Subject: [PATCH] chore: sort imports so ruff check passes on main `pre-commit run --all-files` fails ruff check on main: four files place `from hcl2.version import __version__` ahead of the rest of the first-party block, violating the `I` rule the repo selects. Import order only -- no behaviour change, no reordering across modules with side effects. Applied by `ruff check --fix`. Pre-existing, unrelated to any open PR; it just makes a clean `pre-commit run --all-files` impossible, which hides real failures. Note: `don't commit to branch` also fails when the suite is run while main is checked out. That hook is a guard against committing to main and failing there is its intended behaviour, not a defect. Co-Authored-By: Claude Opus 5 (1M context) --- bin/terraform_test | 3 +-- cli/hcl_to_json.py | 3 +-- cli/hq.py | 3 +-- cli/json_to_hcl.py | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/bin/terraform_test b/bin/terraform_test index ce3abbbe..6b52ccfe 100755 --- a/bin/terraform_test +++ b/bin/terraform_test @@ -13,9 +13,8 @@ Options: import argparse import os -from hcl2.version import __version__ - from hcl2 import load +from hcl2.version import __version__ if __name__ == "__main__": parser = argparse.ArgumentParser(description="This script recursively converts hcl2 files to json") diff --git a/cli/hcl_to_json.py b/cli/hcl_to_json.py index 81188923..87dae289 100644 --- a/cli/hcl_to_json.py +++ b/cli/hcl_to_json.py @@ -6,8 +6,6 @@ import sys from typing import IO, List, Optional, TextIO -from hcl2.version import __version__ - from cli.helpers import ( EXIT_IO_ERROR, EXIT_PARSE_ERROR, @@ -24,6 +22,7 @@ ) from hcl2 import load from hcl2.utils import SerializationOptions +from hcl2.version import __version__ _HCL_EXTENSIONS = {".tf", ".hcl"} diff --git a/cli/hq.py b/cli/hq.py index 61fe41a1..15b368e5 100755 --- a/cli/hq.py +++ b/cli/hq.py @@ -8,8 +8,6 @@ import sys from typing import Any, List, Optional, Tuple -from hcl2.version import __version__ - from hcl2.query._base import NodeView from hcl2.query.body import DocumentView from hcl2.query.introspect import build_schema, describe_results @@ -22,6 +20,7 @@ safe_eval, ) from hcl2.utils import SerializationOptions +from hcl2.version import __version__ from .helpers import _expand_file_args # noqa: F401 — re-exported for tests diff --git a/cli/json_to_hcl.py b/cli/json_to_hcl.py index 558633a6..d14daed5 100644 --- a/cli/json_to_hcl.py +++ b/cli/json_to_hcl.py @@ -8,8 +8,6 @@ from io import StringIO from typing import TextIO -from hcl2.version import __version__ - import hcl2 from cli.helpers import ( EXIT_DIFF, @@ -29,6 +27,7 @@ from hcl2.formatter import FormatterOptions from hcl2.query.diff import diff_dicts, format_diff_json, format_diff_text from hcl2.utils import SerializationOptions +from hcl2.version import __version__ def _json_to_hcl(