MCPcopy Create free account
hub / github.com/FastLED/FastLED / truncate_snippet

Function truncate_snippet

ci/lint_cpp/check_namespace_includes.py:117–122  ·  view source on GitHub ↗

Truncate text to max_len characters.

(text: str, max_len: int = 50)

Source from the content-addressed store, hash-verified

115 include_pattern = re.compile(r"^\s*#\s*include")
116
117 def truncate_snippet(text: str, max_len: int = 50) -> str:
118 """Truncate text to max_len characters."""
119 text = text.strip()
120 if len(text) <= max_len:
121 return text
122 return text[: max_len - 3] + "..."
123
124 for i, (line, line_no_comments) in enumerate(zip(lines, lines_no_comments), 1):
125 line_stripped = line_no_comments.strip()

Calls

no outgoing calls

Tested by

no test coverage detected