Skip to content

Commit 5acb22b

Browse files
authored
Enforce TODO formatting (#3404)
A trivial PR to enforce the formatting of TODOs. This is groundwork for an upcoming PR that checks for zombie TODOs on CI (TODOs that reference an issue that is already fixed). TL;DR: these are legal, everything else is not (hopefully): - `TODO(bob)` - `TODO(bob, alice)` - `TODO(#42)` - `TODO(#42, #43)` - `TODO(rust-lang/rust#42)` - `TODO(rust-lang/rust#42, rust-lang/rust#43)`
1 parent b2b2fac commit 5acb22b

File tree

24 files changed

+52
-32
lines changed

24 files changed

+52
-32
lines changed

crates/re_query/src/archetype_view.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ impl<A: Archetype> ArchetypeView<A> {
272272
#[inline]
273273
pub fn iter_instance_keys(&self) -> impl Iterator<Item = InstanceKey> {
274274
re_tracing::profile_function!();
275-
// TODO(https://github.com/rerun-io/rerun/issues/2750): Maybe make this an intersection instead
275+
// TODO(#2750): Maybe make this an intersection instead
276276
self.required_comp().instance_keys().into_iter()
277277
}
278278

crates/re_sdk/src/recording_stream.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ mod tests {
13861386
assert_eq!(store_info.store_id, rid);
13871387

13881388
let mut got = DataTable::from_arrow_msg(&msg).unwrap();
1389-
// TODO(1760): we shouldn't have to (re)do this!
1389+
// TODO(#1760): we shouldn't have to (re)do this!
13901390
got.compute_all_size_bytes();
13911391
// NOTE: Override the resulting table's ID so they can be compared.
13921392
got.table_id = table.table_id;
@@ -1456,7 +1456,7 @@ mod tests {
14561456
assert_eq!(store_info.store_id, rid);
14571457

14581458
let mut got = DataTable::from_arrow_msg(&msg).unwrap();
1459-
// TODO(1760): we shouldn't have to (re)do this!
1459+
// TODO(#1760): we shouldn't have to (re)do this!
14601460
got.compute_all_size_bytes();
14611461
// NOTE: Override the resulting table's ID so they can be compared.
14621462
got.table_id = table.table_id;
@@ -1521,7 +1521,7 @@ mod tests {
15211521
assert_eq!(store_info.store_id, rid);
15221522

15231523
let mut got = DataTable::from_arrow_msg(&msg).unwrap();
1524-
// TODO(1760): we shouldn't have to (re)do this!
1524+
// TODO(#1760): we shouldn't have to (re)do this!
15251525
got.compute_all_size_bytes();
15261526
// NOTE: Override the resulting table's ID so they can be compared.
15271527
got.table_id = table.table_id;

crates/re_space_view_spatial/src/contexts/non_interactive_entities.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use re_viewer_context::{NamedViewSystem, ViewContextSystem};
55

66
/// List of all non-interactive entities for lookup during picking evaluation.
77
///
8-
/// TODO(wumpf/jleibs): This is a temporary solution until the picking code can query propagated blueprint properties directly.
8+
/// TODO(wumpf, jleibs): This is a temporary solution until the picking code can query propagated blueprint properties directly.
99
#[derive(Default)]
1010
pub struct NonInteractiveEntities(pub IntSet<EntityPathHash>);
1111

crates/re_space_view_spatial/src/parts/points2d.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl Points2DPart {
153153
{
154154
re_tracing::profile_scope!("marking additional highlight points");
155155
for (highlighted_key, instance_mask_ids) in &ent_context.highlight.instances {
156-
// TODO(andreas/jeremy): We can do this much more efficiently
156+
// TODO(andreas, jeremy): We can do this much more efficiently
157157
let highlighted_point_index = arch_view
158158
.iter_instance_keys()
159159
.position(|key| *highlighted_key == key);

crates/re_space_view_spatial/src/parts/points3d.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ impl Points3DPart {
158158
{
159159
re_tracing::profile_scope!("marking additional highlight points");
160160
for (highlighted_key, instance_mask_ids) in &ent_context.highlight.instances {
161-
// TODO(andreas/jeremy): We can do this much more efficiently
161+
// TODO(andreas, jeremy): We can do this much more efficiently
162162
let highlighted_point_index = arch_view
163163
.iter_instance_keys()
164164
.position(|key| *highlighted_key == key);

crates/re_space_view_spatial/src/space_camera_3d.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl SpaceCamera3D {
6868
// we need to pre-transform the data from the user-defined `pinhole_view_coordinates` to the required
6969
// `image_view_coordinates`.
7070
//
71-
// TODO(): When Pinhole is an archetype instead of a component, `pinhole.project` should do this
71+
// TODO(emilk): When Pinhole is an archetype instead of a component, `pinhole.project` should do this
7272
// internally.
7373
let point_in_image_unprojected =
7474
image_view_coordinates().from_other(&self.pinhole_view_coordinates) * point_in_cam;

crates/re_types/definitions/rerun/components/view_coordinates.fbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ include "rerun/datatypes.fbs";
77

88
namespace rerun.components;
99

10-
// TODO(https://github.com/rerun-io/rerun/issues/3384)
10+
// TODO(#3384)
1111
/*
1212
enum ViewDir: byte {
1313
Up = 1,

crates/re_types/source_hash.txt

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/re_types_builder/src/codegen/rust/serializer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ fn quote_arrow_field_serializer(
595595
}
596596
};
597597

598-
// TODO(https://github.com/rerun-io/rerun/issues/2993): The inner
598+
// TODO(#2993): The inner
599599
// types of lists shouldn't be nullable, but both the python and C++
600600
// code-gen end up setting these to null when an outer fixed-sized
601601
// field does happen to be null. In order to keep everything aligned

crates/re_ui/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ impl ReUi {
805805
image_size,
806806
);
807807

808-
// TODO(emilk/andreas): change color and size on hover
808+
// TODO(emilk, andreas): change color and size on hover
809809
let tint = ui.visuals().widgets.inactive.fg_stroke.color;
810810
icon.as_image().tint(tint).paint_at(ui, image_rect);
811811

crates/re_viewer/src/app.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl App {
164164
storage
165165
.and_then(|storage| {
166166
// This re-implements: `eframe::get_value` so we can customize the warning message.
167-
// TODO(https://github.com/rerun-io/rerun/issues/2849): More thorough error-handling.
167+
// TODO(#2849): More thorough error-handling.
168168
storage.get_string(eframe::APP_KEY).and_then(|value| {
169169
match ron::from_str(&value) {
170170
Ok(value) => Some(value),
@@ -948,7 +948,7 @@ impl eframe::App for App {
948948
eframe::set_value(storage, eframe::APP_KEY, &self.state);
949949

950950
// Save the blueprints
951-
// TODO(2579): implement web-storage for blueprints as well
951+
// TODO(#2579): implement web-storage for blueprints as well
952952
if let Some(hub) = &mut self.store_hub {
953953
match hub.gc_and_persist_app_blueprints() {
954954
Ok(f) => f,

crates/re_viewer/src/store_hub.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl StoreHub {
161161
pub fn set_app_id(&mut self, app_id: ApplicationId) {
162162
// If we don't know of a blueprint for this `ApplicationId` yet,
163163
// try to load one from the persisted store
164-
// TODO(2579): implement web-storage for blueprints as well
164+
// TODO(#2579): implement web-storage for blueprints as well
165165
#[cfg(not(target_arch = "wasm32"))]
166166
if !self.blueprint_by_app_id.contains_key(&app_id) {
167167
if let Err(err) = self.try_to_load_persisted_blueprint(&app_id) {

crates/re_viewer_context/src/space_view/view_query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub struct ViewQuery<'s> {
2323
pub latest_at: TimeInt,
2424

2525
/// The entity properties for all queried entities.
26-
/// TODO(jleibs/wumpf): This will be replaced by blueprint queries.
26+
/// TODO(jleibs, wumpf): This will be replaced by blueprint queries.
2727
pub entity_props_map: &'s EntityPropertyMap,
2828

2929
/// Hover/select highlighting information for this space view.

docs/content/reference/viewer/viewport.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ Rerun distinguishes various categories of Space Views:
3939

4040
Which category is used is determined upon creation of a Space View.
4141

42-
[TODO(@#1164)](https://github.com/rerun-io/rerun/issues/1164): Allow configuring the category of a space view after its creation.
42+
[TODO(#1164)](https://github.com/rerun-io/rerun/issues/1164): Allow configuring the category of a space view after its creation.
4343

4444
The kind of Space View determines which Entities it can display, how it displays them and the way they can be interacted with.

examples/python/arkit_scenes/main.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def log_annotated_bboxes(annotation: dict[str, Any]) -> tuple[npt.NDArray[np.flo
4343
Logs annotated oriented bounding boxes to Rerun.
4444
4545
We currently calculate and return the 3D bounding boxes keypoints, labels, and colors for each object to log them in
46-
each camera frame TODO(pablovela5620): Once #1581 is resolved this can be removed.
46+
each camera frame TODO(#1581): once resolved this can be removed.
4747
4848
annotation json file
4949
| |-- label: object name of bounding box
@@ -55,7 +55,7 @@ def log_annotated_bboxes(annotation: dict[str, Any]) -> tuple[npt.NDArray[np.flo
5555
bbox_labels = []
5656
num_objects = len(annotation["data"])
5757
# Generate a color per object that can be reused across both 3D obb and their 2D projections
58-
# TODO(pablovela5620): Once #1581 or #1728 is resolved this can be removed
58+
# TODO(#1581, #1728): once resolved this can be removed
5959
color_positions = np.linspace(0, 1, num_objects)
6060
colormap = plt.colormaps["viridis"]
6161
colors = [colormap(pos) for pos in color_positions]
@@ -93,7 +93,7 @@ def compute_box_3d(
9393
"""
9494
Given obb compute 3d keypoints of the box.
9595
96-
TODO(pablovela5620): Once #1581 is resolved this can be removed
96+
TODO(#1581): once resolved this can be removed
9797
"""
9898
length, height, width = half_size.tolist()
9999
center = np.reshape(transform, (-1, 3))
@@ -123,7 +123,7 @@ def log_line_segments(entity_path: str, bboxes_2d_filtered: npt.NDArray[np.float
123123
|/ |/
124124
1 -------- 0
125125
126-
TODO(pablovela5620): Once #1581 is resolved this can be removed
126+
TODO(#1581): once resolved this can be removed
127127
128128
:param bboxes_2d_filtered:
129129
A numpy array of shape (8, 2), representing the filtered 2D keypoints of the 3D bounding boxes.
@@ -175,7 +175,7 @@ def project_3d_bboxes_to_2d_keypoints(
175175
"""
176176
Returns 2D keypoints of the 3D bounding box in the camera view.
177177
178-
TODO(pablovela5620): Once #1581 is resolved this can be removed
178+
TODO(#1581): once resolved this can be removed
179179
Args:
180180
bboxes_3d: (nObjects, 8, 3) containing the 3D bounding box keypoints in world frame.
181181
camera_from_world: Tuple containing the camera translation and rotation_quaternion in world frame.
@@ -242,7 +242,7 @@ def log_camera(
242242
intrinsic = np.array([[fx, 0, cx], [0, fy, cy], [0, 0, 1]])
243243
camera_from_world = poses_from_traj[frame_id]
244244

245-
# TODO(pablovela5620): Once #1581 is resolved this can be removed
245+
# TODO(#1581): once resolved this can be removed
246246
# Project 3D bounding boxes into 2D image
247247
bboxes_2d = project_3d_bboxes_to_2d_keypoints(bboxes, camera_from_world, intrinsic, img_width=w, img_height=h)
248248
# clear previous centroid labels

examples/python/depth_guided_stable_diffusion/huggingface_pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ def __call__(
570570
)
571571
rr.log_tensor("diffusion/latents", latents, names=["b", "c", "h", "w"])
572572

573-
# 8. Prepare extra step kwargs. TODO(original author): Logic should ideally just be moved out of the pipeline
573+
# 8. Prepare extra step kwargs. TODO(someone): Logic should ideally just be moved out of the pipeline
574574
extra_step_kwargs = self.prepare_extra_step_kwargs(generator, eta)
575575

576576
# 9. Denoising loop

examples/rust/custom_space_view/src/color_coordinates_space_view.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl std::fmt::Display for ColorCoordinatesMode {
4646
/// This state is preserved between frames, but not across Viewer sessions.
4747
#[derive(Default)]
4848
pub struct ColorCoordinatesSpaceViewState {
49-
// TODO(wumpf/jleibs): This should be part of the Blueprint so that it is serialized out.
49+
// TODO(wumpf, jleibs): This should be part of the Blueprint so that it is serialized out.
5050
// but right now there is no way of doing that.
5151
mode: ColorCoordinatesMode,
5252
}

rerun_py/rerun_sdk/rerun/_baseclasses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def as_component_batches(self) -> Iterable[ComponentBatchLike]:
5757
for fld in fields(type(self)):
5858
if "component" in fld.metadata:
5959
comp = getattr(self, fld.name)
60-
# TODO(https://github.com/rerun-io/rerun/issues/3341): Depending on what we decide
60+
# TODO(#3341): Depending on what we decide
6161
# to do with optional components, we may need to make this instead call `_empty_pa_array`
6262
if comp is not None:
6363
yield comp

rerun_py/rerun_sdk/rerun/datatypes/tensor_buffer.py

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rerun_py/rerun_sdk/rerun/log_deprecated/scalar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def log_scalar(
7777
7878
This won't show up on points at the moment, as our plots don't yet
7979
support displaying labels for individual points
80-
TODO(https://github.com/rerun-io/rerun/issues/1289). If all points
80+
TODO(#1289). If all points
8181
within a single entity path (i.e. a line) share the same label, then
8282
this label will be used as the label for the line itself. Otherwise, the
8383
line will be named after the entity path. The plot itself is named after

rerun_py/rerun_sdk/rerun_demo/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def run_structure_from_motion(args):
3131

3232
serve_opts = []
3333

34-
# TODO(https://github.com/rerun-io/rerun/issues/1924): The need to special-case
34+
# TODO(#1924): The need to special-case
3535
# this flag conversion is a bit awkward.
3636
if args.connect or args.addr:
3737
print("Connecting to external viewer is only supported with the --cube demo.", file=sys.stderr)

rerun_py/tests/test_types/datatypes/affix_fuzzer3.py

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/generate_view_coordinate_defs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
This will modify the different archetype extensions to include the appropriate constants.
66
"""
7-
# TODO(https://github.com/rerun-io/rerun/issues/2388): This script can potentially go away or be significantly reduced.
7+
# TODO(#2388): This script can potentially go away or be significantly reduced.
88

99
from __future__ import annotations
1010

scripts/lint.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
explicit_quotes = re.compile(r'[^(]\\"\{\w*\}\\"') # looks for: \"{foo}\"
2929
ellipsis = re.compile(r"[^.]\.\.\.[^\-.0-9a-zA-Z]")
3030

31+
any_todo_pattern = re.compile(r"TODO\(.*\)")
32+
legal_todo_inner_pattern = re.compile(
33+
r"TODO\(((?:[a-zA-Z\-_/]+)?#\d+|[a-zA-Z]+)(?:,\s*((?:[a-zA-Z\-_/]+)?#\d+|[a-zA-Z]+))*\)"
34+
)
35+
3136

3237
def lint_line(line: str, file_extension: str = "rs") -> str | None:
3338
if line == "":
@@ -94,6 +99,9 @@ def lint_line(line: str, file_extension: str = "rs") -> str | None:
9499
if explicit_quotes.search(line):
95100
return "Prefer using {:?} - it will also escape newlines etc"
96101

102+
if any_todo_pattern.search(line) and not legal_todo_inner_pattern.search(line):
103+
return "TODOs should be formatted as either TODO(name), TODO(#42) or TODO(org/repo#42)"
104+
97105
return None
98106

99107

@@ -104,8 +112,16 @@ def test_lint_line() -> None:
104112
"hello world",
105113
"todo lowercase is fine",
106114
'todo!("macro is ok with text")',
107-
"TODO(emilk):",
108115
"TODO_TOKEN",
116+
"TODO(bob):",
117+
"TODO(bob,alice):",
118+
"TODO(bob, alice):",
119+
"TODO(#42):",
120+
"TODO(#42,#43):",
121+
"TODO(#42, #43):",
122+
"TODO(rust-lang/rust#42):",
123+
"TODO(rust-lang/rust#42,rust-lang/rust#43):",
124+
"TODO(rust-lang/rust#42, rust-lang/rust#43):",
109125
'eprintln!("{:?}, {err}", foo)',
110126
'eprintln!("{:#?}, {err}", foo)',
111127
'eprintln!("{err}")',
@@ -129,6 +145,10 @@ def test_lint_line() -> None:
129145
"HACK",
130146
"TODO",
131147
"TODO:",
148+
"TODO(42)",
149+
"TODO(https://github.com/rerun-io/rerun/issues/42)",
150+
"TODO(bob/alice)",
151+
"TODO(bob|alice)",
132152
"todo!()",
133153
'eprintln!("{err:?}")',
134154
'eprintln!("{err:#?}")',

0 commit comments

Comments
 (0)