Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
tools: remove iwyu
Browse files Browse the repository at this point in the history
The amount of bugs encountered in this software during trx development
outweighs the benefits of its continued usage.
  • Loading branch information
rr- committed Sep 17, 2024
1 parent 0d395b7 commit c1f3ab5
Showing 1 changed file with 0 additions and 45 deletions.
45 changes: 0 additions & 45 deletions tools/libtrx/cli/sort_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,6 @@
from libtrx.files import find_versioned_files


@functools.cache
def get_fix_includes_exe_name() -> str:
return "fix_include" if which("fix_include") else "iwyu-fix-includes"


def fix_imports(
path: Path,
root_dir: Path,
include_dirs: list[Path] | None = None,
system_include_dirs: list[Path] | None = None,
) -> None:
cmdline = [
"include-what-you-use",
]

if include_dirs:
for include_dir in include_dirs:
if include_dir != root_dir:
cmdline.extend(["-I", str(include_dir)])

if system_include_dirs:
for include_dir in system_include_dirs:
cmdline.extend(
[
"-isystem",
str(include_dir),
]
)

cmdline.append(path)
iwyu_result = run(
cmdline, cwd=root_dir, capture_output=True, text=True
).stderr

cmdline = [get_fix_includes_exe_name(), "--noblank_lines", "--noreorder"]
run(cmdline, cwd=root_dir, input=iwyu_result, text=True)


def custom_sort(source: list[str], forced_order: list[str]) -> list[str]:
def key_func(item: str) -> tuple[int, int, str]:
if item in forced_order:
Expand Down Expand Up @@ -138,13 +100,6 @@ def run_script(
)

for path in paths:
fix_imports(
path,
root_dir=root_dir,
include_dirs=include_dirs,
system_include_dirs=system_include_dirs,
)

sort_imports(
path,
root_dir=root_dir,
Expand Down

0 comments on commit c1f3ab5

Please sign in to comment.