MCPcopy Create free account
hub / github.com/ClickHouse/ai-sdk-cpp / lint_file

Function lint_file

scripts/lint.py:92–123  ·  view source on GitHub ↗

Run clang-tidy on a single file.

(
    file: Path, 
    compile_commands: Path,
    fix: bool,
    extra_args: List[str],
    semaphore: asyncio.Semaphore
)

Source from the content-addressed store, hash-verified

90
91 return sorted(files)
92
93
94async def lint_file(
95 file: Path,
96 compile_commands: Path,
97 fix: bool,
98 extra_args: List[str],
99 semaphore: asyncio.Semaphore
100) -> Tuple[Path, bool, str]:
101 """Run clang-tidy on a single file."""
102 async with semaphore:
103 cmd = [
104 "clang-tidy",
105 f"-p={compile_commands.parent}",
106 *extra_args,
107 ]
108
109 if fix:
110 cmd.extend(["--fix", "--fix-errors"])
111
112 cmd.append(str(file))
113
114 proc = await asyncio.create_subprocess_exec(
115 *cmd,
116 stdout=asyncio.subprocess.PIPE,
117 stderr=asyncio.subprocess.PIPE
118 )
119
120 stdout, stderr = await proc.communicate()
121
122 output = stdout.decode() + stderr.decode()
123 success = proc.returncode == 0
124
125 return file, success, output
126

Callers 1

lint_all_filesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected