forked from rerun-io/rerun
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclippy.toml
More file actions
132 lines (111 loc) · 7.79 KB
/
clippy.toml
File metadata and controls
132 lines (111 loc) · 7.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# There is also a scripts/clippy_wasm/clippy.toml which forbids some methods that are not available in wasm.
# -----------------------------------------------------------------------------
# Section identical to the main scripts/clippy_wasm/clippy.toml:
msrv = "1.92"
allow-unwrap-in-tests = true
# https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#avoid-breaking-exported-api
# We want suggestions, even if it changes public API.
avoid-breaking-exported-api = false
excessive-nesting-threshold = 16 # TODO(emilk): lower this
max-fn-params-bools = 1
# https://rust-lang.github.io/rust-clippy/master/index.html#/large_include_file
max-include-file-size = 1000000
# https://rust-lang.github.io/rust-clippy/master/index.html#/large_stack_frames
stack-size-threshold = 512000
too-many-lines-threshold = 600 # TODO(emilk): decrease this
# -----------------------------------------------------------------------------
# https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_macros
disallowed-macros = [
'std::dbg',
{ path = "egui::hex_color", reason = "Do not hard-code colors - declare them design_tokens.rs instead, and define in light/dark_theme.json" },
{ path = "std::debug_assert", reason = "Use `re_log::debug_assert` instead" },
{ path = "std::debug_assert_eq", reason = "Use `re_log::debug_assert_eq` instead" },
# TODO(emilk): consider forbidding these to encourage the use of proper log stream, and then explicitly allow legitimate uses
# 'std::eprint',
# 'std::eprintln',
# 'std::print',
# 'std::println',
# 'std::unimplemented', # generated by ArrowDeserialize derive-macro :(
]
# https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_methods
disallowed-methods = [
{ path = "arrow_array::record_batch::RecordBatch::try_new", reason = "Use `arrow_array::record_batch::RecordBatch::try_new_with_options` instead. There is a corner case for empty batches that require the length specified." },
{ path = "arrow::compute::concat", reason = "Use `re_arrow_util::arrow_util::concat_arrays` instead, which has better memory management" },
{ path = "arrow::compute::filter", reason = "Use `re_arrow_util::arrow_util::filter_array` instead" },
{ path = "arrow::compute::take", reason = "Use `re_arrow_util::arrow_util::take_array` instead" },
{ path = "arrow::datatypes::Schema::new", reason = "Use `arrow::datatypes::Schema::new_with_metadata` instead. There is usually some metadata you want to preserve." },
{ path = "crossbeam::channel::Sender::send", reason = "Use `re_quota_channel::send_crossbeam` instead, which warns if the channel is full." },
{ path = "crossbeam::channel::unbounded", reason = "Consider using bounded channels (like re_quota_channel) to apply backpressure. Only use unbounded channels when the sender and receiver are on the same thread." },
{ path = "ecolor::Color32::from_additive_luminance", reason = "Do not hard-code colors - declare them design_tokens.rs instead, and define in light/dark_theme.json" },
{ path = "ecolor::Color32::from_black_alpha", reason = "Do not hard-code colors - declare them design_tokens.rs instead, and define in light/dark_theme.json" },
{ path = "ecolor::Color32::from_gray", reason = "Do not hard-code colors - declare them design_tokens.rs instead, and define in light/dark_theme.json" },
{ path = "ecolor::Color32::from_rgb", reason = "Do not hard-code colors - declare them design_tokens.rs instead, and define in light/dark_theme.json" },
{ path = "ecolor::Color32::from_rgba_premultiplied", reason = "Do not hard-code colors - declare them design_tokens.rs instead, and define in light/dark_theme.json" },
{ path = "ecolor::Color32::from_rgba_unmultiplied", reason = "Do not hard-code colors - declare them design_tokens.rs instead, and define in light/dark_theme.json" },
{ path = "ecolor::Color32::from_white_alpha", reason = "Do not hard-code colors - declare them design_tokens.rs instead, and define in light/dark_theme.json" },
{ path = "ecolor::Rgba::from_black_alpha", reason = "Do not hard-code colors - declare them design_tokens.rs instead, and define in light/dark_theme.json" },
{ path = "ecolor::Rgba::from_gray", reason = "Do not hard-code colors - declare them design_tokens.rs instead, and define in light/dark_theme.json" },
{ path = "ecolor::Rgba::from_luminance_alpha", reason = "Do not hard-code colors - declare them design_tokens.rs instead, and define in light/dark_theme.json" },
{ path = "ecolor::Rgba::from_rgb", reason = "Do not hard-code colors - declare them design_tokens.rs instead, and define in light/dark_theme.json" },
{ path = "ecolor::Rgba::from_rgba_premultiplied", reason = "Do not hard-code colors - declare them design_tokens.rs instead, and define in light/dark_theme.json" },
{ path = "ecolor::Rgba::from_rgba_unmultiplied", reason = "Do not hard-code colors - declare them design_tokens.rs instead, and define in light/dark_theme.json" },
{ path = "ecolor::Rgba::from_white_alpha", reason = "Do not hard-code colors - declare them design_tokens.rs instead, and define in light/dark_theme.json" },
{ path = "egui_extras::TableBody::row", reason = "`row` doesn't scale. Use `rows` instead." },
{ path = "egui::Ui::checkbox", reason = "Use `re_checkbox` from `re_ui::UiEx" },
{ path = "egui::Ui::radio_value", reason = "Use `re_radio_value` from `re_ui::UiEx" },
{ path = "egui::Ui::spinner", reason = "Use `ui.loading_indicator` from `re_ui::UiEx" },
{ path = "glam::Vec2::normalize", reason = "normalize() can create NaNs. Use try_normalize or normalize_or_zero" },
{ path = "glam::Vec3::normalize", reason = "normalize() can create NaNs. Use try_normalize or normalize_or_zero" },
{ path = "sha1::Digest::new", reason = "SHA1 is cryptographically broken" },
{ path = "std::env::temp_dir", reason = "Use the tempdir crate instead" },
{ path = "std::panic::catch_unwind", reason = "We compile with `panic = 'abort'`" },
{ path = "std::sync::mpsc::channel", reason = "Use bounded channels (like re_quota_channel) to apply backpressure." },
{ path = "std::thread::spawn", reason = "Use `std::thread::Builder` and name the thread" },
{ path = "std::time::Duration::from_secs_f32", reason = "Use try_from_secs_f32 instead to avoid panics" },
{ path = "std::time::Duration::from_secs_f64", reason = "Use try_from_secs_f64 instead to avoid panics" },
{ path = "tokio::sync::mpsc::unbounded_channel", reason = "Use bounded channels to apply backpressure." },
# There are many things that aren't allowed on wasm,
# but we cannot disable them all here (because of e.g. https://github.com/rust-lang/rust-clippy/issues/10406)
# so we do that in `clippy_wasm.toml` instead.
]
# https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_names
disallowed-names = []
# https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_types
disallowed-types = [
{ path = "egui::Checkbox", reason = "Use `re_checkbox` from `re_ui::UiEx" },
{ path = "egui::Spinner", reason = "Use re_ui::loading_indicator" },
{ path = "once_cell::sync::OnceCell", reason = "Use `std::sync::OnceLock` instead" },
{ path = "std::sync::Condvar", reason = "Use parking_lot instead" },
{ path = "std::sync::Mutex", reason = "Use parking_lot instead" },
{ path = "std::sync::RwLock", reason = "Use parking_lot instead" },
# "std::sync::Once", # enabled for now as the `log_once` macro uses it internally
]
# Allow-list of words for markdown in docstrings https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
doc-valid-idents = [
# You must also update the same list in `scripts/clippy_wasm/clippy.toml`!
"AOMedia",
"DataFusion",
"GiB",
"GitHub",
"GLB",
"GLTF",
"iOS",
"IPv4",
"IPv6",
"macOS",
"MessagePack",
"MiB",
"MiMalloc",
"NaN",
"OBJ",
"OpenGL",
"OpenID",
"PyPI",
"sRGB",
"sRGBA",
"WebCodec",
"WebGL",
"WebGPU",
"WebSocket",
"WebSockets",
]