util: Ignore line length check for #include pragma in C/C++ files (#134)

The length of the path of #include pragmas can be more than
79-character long. The length of the path of a #include pragma
can be outside of user's control.
This commit is contained in:
Bobby R. Bruce
2023-07-27 09:39:18 -07:00
committed by GitHub

View File

@@ -424,7 +424,11 @@ class LineLength(LineVerifier):
test_name = "line length"
opt_name = "length"
def check_line(self, line, **kwargs):
def check_line(self, line, language, **kwargs):
# Ignore line length check for include pragmas of C/C++.
if language in {"C", "C++"}:
if line.startswith("#include"):
return True
return style.normalized_len(line) <= 79
def fix(self, filename, regions=all_regions, **kwargs):