Skip to content

Commit fd257bd

Browse files
committed
fix f-string spaces
1 parent f3b59bc commit fd257bd

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cpplint.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ def CheckNextIncludeOrder(self, header_type):
11621162
11631163
"""
11641164
error_message = (f'Found {self._TYPE_NAMES[header_type]}'
1165-
f'after {self._SECTION_NAMES[self._section]}')
1165+
f' after {self._SECTION_NAMES[self._section]}')
11661166

11671167
last_section = self._section
11681168

@@ -3179,7 +3179,7 @@ def Update(self, filename, clean_lines, linenum, error):
31793179
slots = access_match.group(3)
31803180
error(filename, linenum, 'whitespace/indent', 3,
31813181
f'{access_match.group(2)}{slots}:'
3182-
f'should be indented +1 space inside {parent}')
3182+
f' should be indented +1 space inside {parent}')
31833183

31843184
# Consume braces or semicolons from what's left of the line
31853185
while True:
@@ -4720,7 +4720,7 @@ def CheckCheck(filename, clean_lines, linenum, error):
47204720
# or rhs gets long, the error message might become unreadable.
47214721
error(filename, linenum, 'readability/check', 2,
47224722
f'Consider using {_CHECK_REPLACEMENT[check_macro][operator]}'
4723-
f'instead of {check_macro}(a {operator} b)')
4723+
f' instead of {check_macro}(a {operator} b)')
47244724

47254725

47264726
def CheckAltTokens(filename, clean_lines, linenum, error):
@@ -5295,7 +5295,8 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension,
52955295
function_name = re.search(r'\b((?:string)?printf)\s*\(',
52965296
line, re.I).group(1)
52975297
error(filename, linenum, 'runtime/printf', 4,
5298-
f'{function_name}("%%s", {match.group(1)})')
5298+
'Potential format string bug. Do'
5299+
f' {function_name}("%s", {match.group(1)}) instead.')
52995300

53005301
# Check for potential memset bugs like memset(buf, sizeof(buf), 0).
53015302
match = re.search(r'memset\s*\(([^,]*),\s*([^,]*),\s*0\s*\)', line)
@@ -6619,6 +6620,7 @@ def ProcessFile(filename, vlevel, extra_check_functions=None):
66196620
lf_lines.append(linenum + 1)
66206621

66216622
except IOError:
6623+
# TODO: Maybe make this have an exit code of 2 after all is done
66226624
_cpplint_state.PrintError(
66236625
f"Skipping input '{filename}': Can't open for reading\n")
66246626
_RestoreFilters()

0 commit comments

Comments
 (0)