-
Notifications
You must be signed in to change notification settings - Fork 325
/
clippy.toml
100 lines (80 loc) · 4.43 KB
/
clippy.toml
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
# 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.79"
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 = 2 # TODO(emilk): decrease this to 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 = [
'dbg',
# 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 = "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_extras::TableBody::row", reason = "`row` doesn't scale. Use `rows` instead." },
{ 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::thread::spawn", reason = "Use `std::thread::Builder` and name the thread" },
# Specify both `arrow2` and `re_arrow2` -- clippy gets lost in all the package renaming happening.
{ path = "arrow2::compute::concatenate::concatenate", reason = "Use `re_chunk::util::concat_arrays` instead, which has proper early outs" },
{ path = "arrow2::compute::filter::filter", reason = "Use `re_chunk::util::filter_array` instead, which has proper early outs" },
{ path = "arrow2::compute::take::take", reason = "Use `re_chunk::util::take_array` instead, which has proper early outs" },
{ path = "re_arrow2::compute::concatenate::concatenate", reason = "Use `re_chunk::util::concat_arrays` instead, which has proper early outs" },
{ path = "re_arrow2::compute::filter::filter", reason = "Use `re_chunk::util::filter_array` instead, which has proper early outs" },
{ path = "re_arrow2::compute::take::take", reason = "Use `re_chunk::util::take_array` instead, which has proper early outs" },
# 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 = "ring::digest::SHA1_FOR_LEGACY_USE_ONLY", reason = "SHA1 is cryptographically broken" },
{ 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`!
"GitHub",
"GLB",
"GLTF",
"iOS",
"macOS",
"MessagePack",
"MiMalloc",
"NaN",
"OBJ",
"OpenGL",
"PyPI",
"sRGB",
"sRGBA",
"WebGL",
"WebGPU",
"WebSocket",
"WebSockets",
]