Use "TODO" comments to track deprecated codes or workarounds for old versions #3705
Closed
4 tasks done
Labels
maintenance
Boring but important stuff for the core devs
Milestone
Sometimes, we may need to mark part of the codes for future reference. For example,
pygmt/pygmt/clib/session.py
Lines 1940 to 1944 in 5702209
pygmt/pygmt/clib/conversion.py
Lines 180 to 187 in 5702209
pygmt/pygmt/src/timestamp.py
Line 102 in 5702209
pygmt/pygmt/conftest.py
Lines 8 to 9 in 5702209
Currently, for case 1, we use the
grep --include="*.py" -r vX.Y.Z
command to find the matches, but for case 2, we don't have a way to track them.To better track codes that should be removed/refactored in the future, I suggest using the TODO comments in our source codes. It should be noted that TODO comments should not be abused for marking unimplemented features or incomplete documentation, which should be tracked by issues instead.
There is no style guide like PEP8 for TODO comments. Looking at this todo tool (https://github.com/ianlewis/todos), the ruff's TODO linter, and also searching for the web, here are the TODO comment styles I've found:
Since we're using TODO comments for tracking deprecated codes/workarounds, I think we can use the following style:
e.g.,
Then we can use
grep "# TODO" **/*
to find all TODOs. Some editors even have plugins to highlight TODO comments or show all TODOs in a compact way.If agreed, we should do:
The text was updated successfully, but these errors were encountered: