Enforce writing username in TODO comments (#4235)
This commit is contained in:
parent
8a10f81ca0
commit
f8d7d0ebaa
|
|
@ -88,7 +88,7 @@ pub(crate) fn install_document_events(runner_ref: &WebRunner) -> Result<(), JsVa
|
|||
if let Some(key) = egui_key {
|
||||
runner.input.raw.events.push(egui::Event::Key {
|
||||
key,
|
||||
physical_key: None, // TODO
|
||||
physical_key: None, // TODO(fornwall)
|
||||
pressed: true,
|
||||
repeat: false, // egui will fill this in for us!
|
||||
modifiers,
|
||||
|
|
@ -155,7 +155,7 @@ pub(crate) fn install_document_events(runner_ref: &WebRunner) -> Result<(), JsVa
|
|||
if let Some(key) = translate_key(&event.key()) {
|
||||
runner.input.raw.events.push(egui::Event::Key {
|
||||
key,
|
||||
physical_key: None, // TODO
|
||||
physical_key: None, // TODO(fornwall)
|
||||
pressed: false,
|
||||
repeat: false,
|
||||
modifiers,
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ impl State {
|
|||
consumed: false,
|
||||
}
|
||||
}
|
||||
// WindowEvent::TouchpadPressure {device_id, pressure, stage, .. } => {} // TODO
|
||||
// WindowEvent::TouchpadPressure {device_id, pressure, stage, .. } => {} // TODO(emilk)
|
||||
WindowEvent::Touch(touch) => {
|
||||
self.on_touch(window, touch);
|
||||
let consumed = match touch.phase {
|
||||
|
|
@ -1298,7 +1298,7 @@ fn process_viewport_command(
|
|||
ViewportCommand::StartDrag => {
|
||||
// If `is_viewport_focused` is not checked on x11 the input will be permanently taken until the app is killed!
|
||||
|
||||
// TODO: check that the left mouse-button was pressed down recently,
|
||||
// TODO(emilk): check that the left mouse-button was pressed down recently,
|
||||
// or we will have bugs on Windows.
|
||||
// See https://github.com/emilk/egui/pull/1108
|
||||
if is_viewport_focused {
|
||||
|
|
|
|||
|
|
@ -2770,7 +2770,7 @@ impl Context {
|
|||
/// The `Context` lock is held while the given closure is called!
|
||||
///
|
||||
/// Returns `None` if acesskit is off.
|
||||
// TODO: consider making both RO and RW versions
|
||||
// TODO(emilk): consider making both RO and RW versions
|
||||
#[cfg(feature = "accesskit")]
|
||||
pub fn accesskit_node_builder<R>(
|
||||
&self,
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ impl InputState {
|
|||
// So we smooth it out over several frames for a nicer user experience when scrolling in egui.
|
||||
unprocessed_scroll_delta += raw_scroll_delta;
|
||||
let dt = stable_dt.at_most(0.1);
|
||||
let t = crate::emath::exponential_smooth_factor(0.90, 0.1, dt); // reach _% in _ seconds. TODO: parameterize
|
||||
let t = crate::emath::exponential_smooth_factor(0.90, 0.1, dt); // reach _% in _ seconds. TODO(emilk): parameterize
|
||||
|
||||
for d in 0..2 {
|
||||
if unprocessed_scroll_delta[d].abs() < 1.0 {
|
||||
|
|
|
|||
|
|
@ -247,8 +247,8 @@ pub(crate) fn interact(
|
|||
hits.click.iter().chain(&hits.drag).map(|w| w.id).collect()
|
||||
} else {
|
||||
// Whatever is topmost is what we are hovering.
|
||||
// TODO: consider handle hovering over multiple top-most widgets?
|
||||
// TODO: allow hovering close widgets?
|
||||
// TODO(emilk): consider handle hovering over multiple top-most widgets?
|
||||
// TODO(emilk): allow hovering close widgets?
|
||||
hits.contains_pointer
|
||||
.last()
|
||||
.map(|w| w.id)
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ impl Options {
|
|||
pub fn ui(&mut self, ui: &mut crate::Ui) {
|
||||
let Self {
|
||||
style, // covered above
|
||||
zoom_factor: _, // TODO
|
||||
zoom_factor: _, // TODO(emilk)
|
||||
zoom_with_keyboard,
|
||||
tessellation_options,
|
||||
repaint_on_widget_change,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use super::{
|
|||
};
|
||||
|
||||
/// Turn on to help debug this
|
||||
const DEBUG: bool = false; // TODO: don't merge this while `true`
|
||||
const DEBUG: bool = false; // Don't merge `true`!
|
||||
|
||||
fn paint_selection(
|
||||
ui: &Ui,
|
||||
|
|
@ -169,7 +169,7 @@ impl LabelSelectionState {
|
|||
|
||||
if ctx.input(|i| i.pointer.any_pressed() && !i.modifiers.shift) {
|
||||
// Maybe a new selection is about to begin, but the old one is over:
|
||||
// state.selection = None; // TODO: this makes sense, but doesn't work as expected.
|
||||
// state.selection = None; // TODO(emilk): this makes sense, but doesn't work as expected.
|
||||
}
|
||||
|
||||
state.selection_bbox_last_frame = state.selection_bbox_this_frame;
|
||||
|
|
@ -562,7 +562,7 @@ impl LabelSelectionState {
|
|||
old.widget_id != new_primary.widget_id || old.ccursor != new_primary.ccursor
|
||||
});
|
||||
if primary_changed && new_primary.widget_id == widget_id {
|
||||
let is_fully_visible = ui.clip_rect().contains_rect(response.rect); // TODO: remove this HACK workaround for https://github.com/emilk/egui/issues/1531
|
||||
let is_fully_visible = ui.clip_rect().contains_rect(response.rect); // TODO(emilk): remove this HACK workaround for https://github.com/emilk/egui/issues/1531
|
||||
if selection_changed && !is_fully_visible {
|
||||
// Scroll to keep primary cursor in view:
|
||||
let row_height = estimate_row_height(galley);
|
||||
|
|
|
|||
|
|
@ -452,7 +452,7 @@ impl ImageSize {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: unit-tests
|
||||
// TODO(jprochazk): unit-tests
|
||||
fn scale_to_fit(image_size: Vec2, available_size: Vec2, maintain_aspect_ratio: bool) -> Vec2 {
|
||||
if maintain_aspect_ratio {
|
||||
let ratio_x = available_size.x / image_size.x;
|
||||
|
|
|
|||
|
|
@ -687,7 +687,7 @@ impl<'t> TextEdit<'t> {
|
|||
let primary_cursor_rect =
|
||||
cursor_rect(galley_pos, &galley, &cursor_range.primary, row_height);
|
||||
|
||||
let is_fully_visible = ui.clip_rect().contains_rect(rect); // TODO: remove this HACK workaround for https://github.com/emilk/egui/issues/1531
|
||||
let is_fully_visible = ui.clip_rect().contains_rect(rect); // TODO(emilk): remove this HACK workaround for https://github.com/emilk/egui/issues/1531
|
||||
if (response.changed || selection_changed) && !is_fully_visible {
|
||||
// Scroll to keep primary cursor in view:
|
||||
ui.scroll_to_rect(primary_cursor_rect, None);
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ The style characters are chosen to be similar to what they are representing:
|
|||
`$` = $small$
|
||||
`^` = ^raised^
|
||||
|
||||
# TODO
|
||||
# To do
|
||||
- Sub-headers (`## h2`, `### h3` etc)
|
||||
- Hotkey Editor
|
||||
- International keyboard algorithm for non-letter keys
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// TODO: automatic cache eviction
|
||||
// TODO(jprochazk): automatic cache eviction
|
||||
|
||||
/// Installs a set of image loaders.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ pub struct AxisHints {
|
|||
pub(super) label_spacing: Rangef,
|
||||
}
|
||||
|
||||
// TODO: this just a guess. It might cease to work if a user changes font size.
|
||||
// TODO(JohannesProgrammiert): this just a guess. It might cease to work if a user changes font size.
|
||||
const LINE_HEIGHT: f32 = 12.0;
|
||||
|
||||
impl AxisHints {
|
||||
|
|
@ -366,7 +366,7 @@ impl AxisWidget {
|
|||
|
||||
match HPlacement::from(self.hints.placement) {
|
||||
HPlacement::Left => {
|
||||
let angle = 0.0; // TODO: allow users to rotate text
|
||||
let angle = 0.0; // TODO(emilk): allow users to rotate text
|
||||
|
||||
if angle == 0.0 {
|
||||
let x = self.rect.max.x - galley.size().x;
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ impl Default for Orientation {
|
|||
pub enum PlotPoints {
|
||||
Owned(Vec<PlotPoint>),
|
||||
Generator(ExplicitGenerator),
|
||||
// Borrowed(&[PlotPoint]), // TODO: Lifetimes are tricky in this case.
|
||||
// Borrowed(&[PlotPoint]), // TODO(EmbersArc): Lifetimes are tricky in this case.
|
||||
}
|
||||
|
||||
impl Default for PlotPoints {
|
||||
|
|
|
|||
|
|
@ -800,7 +800,7 @@ impl Plot {
|
|||
let plot_id = id.unwrap_or_else(|| ui.make_persistent_id(id_source));
|
||||
|
||||
let ([x_axis_widgets, y_axis_widgets], plot_rect) = axis_widgets(
|
||||
PlotMemory::load(ui.ctx(), plot_id).as_ref(), // TODO: avoid loading plot memory twice
|
||||
PlotMemory::load(ui.ctx(), plot_id).as_ref(), // TODO(emilk): avoid loading plot memory twice
|
||||
show_axes,
|
||||
complete_rect,
|
||||
[&x_axes, &y_axes],
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ impl PaintStats {
|
|||
fn add(&mut self, shape: &Shape) {
|
||||
match shape {
|
||||
Shape::Vec(shapes) => {
|
||||
// self += PaintStats::from_shapes(&shapes); // TODO
|
||||
// self += PaintStats::from_shapes(&shapes); // TODO(emilk)
|
||||
self.shapes += AllocInfo::from_slice(shapes);
|
||||
self.shape_vec += AllocInfo::from_slice(shapes);
|
||||
for shape in shapes {
|
||||
|
|
|
|||
|
|
@ -1864,7 +1864,7 @@ impl Tessellator {
|
|||
.filter(|(_, clipped_shape)| should_parallelize(&clipped_shape.shape))
|
||||
.map(|(index, clipped_shape)| {
|
||||
crate::profile_scope!("tessellate_big_shape");
|
||||
// TODO: reuse tessellator in a thread local
|
||||
// TODO(emilk): reuse tessellator in a thread local
|
||||
let mut tessellator = (*self).clone();
|
||||
let mut mesh = Mesh::default();
|
||||
tessellator.tessellate_shape(clipped_shape.shape.clone(), &mut mesh);
|
||||
|
|
|
|||
|
|
@ -960,7 +960,7 @@ fn is_kana(c: char) -> bool {
|
|||
|
||||
#[inline]
|
||||
fn is_cjk(c: char) -> bool {
|
||||
// TODO: Add support for Korean Hangul.
|
||||
// TODO(bigfarts): Add support for Korean Hangul.
|
||||
is_cjk_ideograph(c) || is_kana(c)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -441,7 +441,7 @@ fn drag_source<R>(
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Update to be more like `crates/egui_demo_lib/src/debo/drag_and_drop.rs`
|
||||
// TODO(emilk): Update to be more like `crates/egui_demo_lib/src/debo/drag_and_drop.rs`
|
||||
fn drop_target<R>(
|
||||
ui: &mut egui::Ui,
|
||||
body: impl FnOnce(&mut egui::Ui) -> R,
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ def lint_lines(filepath, lines_in):
|
|||
for line_nr, line in enumerate(lines_in):
|
||||
line_nr = line_nr + 1
|
||||
|
||||
# TODO: only # and /// on lines before a keyword
|
||||
# TODO(emilk): only # and /// on lines before a keyword
|
||||
|
||||
pattern = (
|
||||
r"^\s*((///)|((pub(\(\w*\))? )?((impl|fn|struct|enum|union|trait)\b))).*$"
|
||||
|
|
@ -66,6 +66,12 @@ def lint_lines(filepath, lines_in):
|
|||
)
|
||||
lines_out.append("#[inline]")
|
||||
|
||||
|
||||
if re.search(r"TODO[^(]", line):
|
||||
errors.append(
|
||||
f"{filepath}:{line_nr}: write 'TODO(username):' instead"
|
||||
)
|
||||
|
||||
if (
|
||||
"(target_os" in line
|
||||
and filepath.startswith("./crates/egui/")
|
||||
|
|
|
|||
Loading…
Reference in New Issue