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

Callers 1

lint_all_filesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected