Skip to content

All TODOs in Python code should have a username #355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2004,7 +2004,7 @@ def CleanseRawStrings(raw_lines):

lines_without_raw_strings.append(line)

# TODO(unknown): if delimiter is not None here, we might want to
# TODO(google): if delimiter is not None here, we might want to
# emit a warning for unterminated string.
return lines_without_raw_strings

Expand Down Expand Up @@ -2276,7 +2276,7 @@ def CloseExpression(clean_lines, linenum, pos):
If lines[linenum][pos] points to a '(' or '{' or '[' or '<', finds the
linenum/pos that correspond to the closing of the expression.

TODO(unknown): cpplint spends a fair bit of time matching parentheses.
TODO(google): cpplint spends a fair bit of time matching parentheses.
Ideally we would want to index all opening and closing parentheses once
and have CloseExpression be just a simple lookup, but due to preprocessor
tricks, this is not so easy.
Expand Down Expand Up @@ -3115,7 +3115,7 @@ def CheckEnd(self, filename, clean_lines, linenum, error):
# lines. However, do apply checks if there is already an end of
# namespace comment and it's incorrect.
#
# TODO(unknown): We always want to check end of namespace comments
# TODO(google): We always want to check end of namespace comments
# if a namespace is large, but sometimes we also want to apply the
# check if a short namespace contained nontrivial things (something
# other than forward declarations). There is currently no logic on
Expand Down Expand Up @@ -3353,7 +3353,7 @@ def UpdatePreprocessor(self, line):
# Restore the stack to how it was before the #if
self.stack = copy.deepcopy(self.pp_stack[-1].stack_before_if)
else:
# TODO(unknown): unexpected #else, issue warning?
# TODO(google): unexpected #else, issue warning?
pass
elif re.match(r"^\s*#\s*endif\b", line):
# End of #if or #else blocks.
Expand All @@ -3368,10 +3368,10 @@ def UpdatePreprocessor(self, line):
# Drop the corresponding #if
self.pp_stack.pop()
else:
# TODO(unknown): unexpected #endif, issue warning?
# TODO(google): unexpected #endif, issue warning?
pass

# TODO(unknown): Update() is too long, but we will refactor later.
# TODO(google): Update() is too long, but we will refactor later.
def Update(self, filename, clean_lines, linenum, error):
"""Update nesting state with current line.

Expand Down Expand Up @@ -3667,7 +3667,7 @@ def CheckForNonStandardConstructs(filename, clean_lines, linenum, nesting_state,
)

if re.search(r"^\s*const\s*string\s*&\s*\w+\s*;", line):
# TODO(unknown): Could it be expanded safely to arbitrary references,
# TODO(google): Could it be expanded safely to arbitrary references,
# without triggering too many false positives? The first
# attempt triggered 5 warnings for mostly benign code in the regtest, hence
# the restriction.
Expand Down Expand Up @@ -3845,7 +3845,7 @@ def CheckSpacingForFunctionCall(filename, clean_lines, linenum, error):
and not re.search(r"\w\s+\((\w+::)*\*\w+\)\(", fncall)
and not re.search(r"\bcase\s+\(", fncall)
):
# TODO(unknown): Space after an operator function seem to be a common
# TODO(google): Space after an operator function seem to be a common
# error, silence those for now by restricting them to highest verbosity.
if re.search(r"\boperator_*\b", line):
error(
Expand Down Expand Up @@ -4096,7 +4096,7 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
elided = clean_lines.elided
prev_line = elided[linenum - 1]
prevbrace = prev_line.rfind("{")
# TODO(unknown): Don't complain if line before blank line, and line after,
# TODO(google): Don't complain if line before blank line, and line after,
# both start with alnums and are indented the same amount.
# This ignores whitespace at the start of a namespace block
# because those are not usually indented.
Expand Down Expand Up @@ -4230,7 +4230,7 @@ def CheckOperatorSpacing(filename, clean_lines, linenum, error):

# It's ok not to have spaces around binary operators like + - * /, but if
# there's too little whitespace, we get concerned. It's hard to tell,
# though, so we punt on this one for now. TODO.
# though, so we punt on this one for now. TODO(google).

# You should always have whitespace around binary operators.
#
Expand All @@ -4245,7 +4245,7 @@ def CheckOperatorSpacing(filename, clean_lines, linenum, error):
# many false positives due to RValue references.
match = re.search(r"[^<>=!\s](==|!=|<=|>=|\|\|)[^<>=!\s,;\)]", line)
if match:
# TODO: support alternate operators
# TODO(google): support alternate operators
error(
filename, linenum, "whitespace/operators", 3, f"Missing spaces around {match.group(1)}"
)
Expand Down Expand Up @@ -4392,7 +4392,7 @@ def CheckCommaSpacing(filename, clean_lines, linenum, error):

# You should always have a space after a semicolon
# except for few corner cases
# TODO(unknown): clarify if 'if (1) { return 1;}' is requires one more
# TODO(google): clarify if 'if (1) { return 1;}' is requires one more
# space after ;
if re.search(r";[^\s};\\)/]", line):
error(filename, linenum, "whitespace/semicolon", 3, "Missing space after ;")
Expand Down Expand Up @@ -4767,7 +4767,7 @@ def CheckBraces(filename, clean_lines, linenum, error):
" should be on a separate line",
)

# TODO: Err on if...else and do...while statements without braces;
# TODO(aaronliu0130): Err on if...else and do...while statements without braces;
# style guide has changed since the below comment was written

# Check single-line if/else bodies. The style guide says 'curly braces are not
Expand Down Expand Up @@ -5288,7 +5288,7 @@ def CheckAltTokens(filename, clean_lines, linenum, error):
# it provides a way to workaround this warning for people who use
# multi-line comments in preprocessor macros.
#
# TODO(unknown): remove this once cpplint has better support for
# TODO(google): remove this once cpplint has better support for
# multi-line comments.
if line.find("/*") >= 0 or line.find("*/") >= 0:
return
Expand Down Expand Up @@ -5740,7 +5740,7 @@ def _GetTextInside(text, start_pattern):
The extracted text.
None if either the opening string or ending punctuation could not be found.
"""
# TODO(unknown): Audit cpplint.py to see what places could be profitably
# TODO(google): Audit cpplint.py to see what places could be profitably
# rewritten to use _GetTextInside (and use inferior regexp matching today).

# Give opening punctuation to get the matching close-punctuation.
Expand Down Expand Up @@ -5853,10 +5853,10 @@ def CheckLanguage(
CheckPrintf(filename, clean_lines, linenum, error)

if IsHeaderExtension(file_extension):
# TODO(unknown): check that 1-arg constructors are explicit.
# TODO(google): check that 1-arg constructors are explicit.
# How to tell it's a constructor?
# (handled in CheckForNonStandardConstructs for now)
# TODO(unknown): check that classes declare or disable copy/assign
# TODO(google): check that classes declare or disable copy/assign
# (level 1 error)
pass

Expand All @@ -5879,7 +5879,7 @@ def CheckLanguage(
)

# Check if some verboten operator overloading is going on
# TODO(unknown): catch out-of-line unary operator&:
# TODO(google): catch out-of-line unary operator&:
# class X {};
# int operator&(const X& x) { return 42; } // unary operator&
# The trick is it's hard to tell apart from binary operator&:
Expand Down Expand Up @@ -5907,7 +5907,7 @@ def CheckLanguage(
# Check for potential format string bugs like printf(foo).
# We constrain the pattern not to pick things like DocidForPrintf(foo).
# Not perfect but it can catch printf(foo.c_str()) and printf(foo->c_str())
# TODO(unknown): Catch the following case. Need to change the calling
# TODO(google): Catch the following case. Need to change the calling
# convention of the whole function to process multiple line to handle it.
# printf(
# boy_this_is_a_really_long_variable_that_cannot_fit_on_the_prev_line);
Expand Down Expand Up @@ -6047,8 +6047,8 @@ def CheckGlobalStatic(filename, clean_lines, linenum, error):
# This is dangerous because the C++ language does not guarantee that
# globals with constructors are initialized before the first access, and
# also because globals can be destroyed when some threads are still running.
# TODO(unknown): Generalize this to also find static unique_ptr instances.
# TODO(unknown): File bugs for clang-tidy to find these.
# TODO(google): Generalize this to also find static unique_ptr instances.
# TODO(google): File bugs for clang-tidy to find these.
match = re.match(
r"((?:|static +)(?:|const +))(?::*std::)?string( +const)? +"
r"([a-zA-Z0-9_:]+)\b(.*)",
Expand Down Expand Up @@ -6303,7 +6303,7 @@ def CheckForNonConstReference(filename, clean_lines, linenum, nesting_state, err
# inside declarators: reference parameter
# We will exclude the first two cases by checking that we are not inside a
# function body, including one that was just introduced by a trailing '{'.
# TODO(unknown): Doesn't account for 'catch(Exception& e)' [rare].
# TODO(google): Doesn't account for 'catch(Exception& e)' [rare].
if nesting_state.previous_stack_top and not (
isinstance(nesting_state.previous_stack_top, (_ClassInfo, _NamespaceInfo))
):
Expand Down Expand Up @@ -7010,7 +7010,7 @@ def CheckRedundantVirtual(filename, clean_lines, linenum, error):

# Look for the next opening parenthesis. This is the start of the
# parameter list (possibly on the next line shortly after virtual).
# TODO(unknown): doesn't work if there are virtual functions with
# TODO(google): doesn't work if there are virtual functions with
# decltype() or other things that use parentheses, but csearch suggests
# that this is rare.
end_col = -1
Expand Down Expand Up @@ -7457,7 +7457,7 @@ def ProcessFile(filename, vlevel, extra_check_functions=None):
lf_lines.append(linenum + 1)

except OSError:
# TODO: Maybe make this have an exit code of 2 after all is done
# TODO(aaronliu0130): Maybe make this have an exit code of 2 after all is done
_cpplint_state.PrintError(f"Skipping input '{filename}': Can't open for reading\n")
_RestoreFilters()
return
Expand Down
2 changes: 1 addition & 1 deletion cpplint_clitest.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def run_shell_command(cmd: str, args: str, cwd: str = ".") -> tuple[int, bytes,

# Make output system-agnostic, aka support Windows
if os.sep == "\\":
# TODO: Support scenario with multiple input names
# TODO(aaronliu0130): Support scenario with multiple input names
# We currently only support the last arguments as the input name
# to prevent accidentally replacing sed tests.
# Fixing would likely need coding an internal "replace slashes" option for cpplint itself.
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ lint.select = [
"SLOT", # flake8-slots
"T10", # flake8-debugger
"TC", # flake8-type-checking
"TD", # flake8-todos
"TID", # flake8-tidy-imports
"TRY", # tryceratops
"UP", # pyupgrade
Expand All @@ -122,13 +123,13 @@ lint.select = [
# "S", # flake8-bandit
# "SLF", # flake8-self
# "T20", # flake8-print
# "TD", # flake8-todos
]
lint.ignore = [
"FBT003", # flake8-boolean-trap
"FIX002", # flake8-fixme
"ISC003", # flake8-implicit-str-concat
"PIE790", # Unnecessary `pass` statement
"TD003", # flake8-todos
]
lint.per-file-ignores."cpplint.py" = [
"ICN001",
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy