-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCargo.toml
More file actions
202 lines (186 loc) · 5.17 KB
/
Cargo.toml
File metadata and controls
202 lines (186 loc) · 5.17 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
[package]
name = "libmagic-rs"
version = "0.5.0"
edition = "2024"
authors = [
"UncleSp1d3r <unclespid3r@evilbitlabs.io>",
"KryptoKat <kryptokat@evilbitlabs.io>",
]
description = "A pure-Rust implementation of libmagic for file type identification"
license = "Apache-2.0"
repository = "https://github.com/EvilBit-Labs/libmagic-rs"
homepage = "https://evilbitlabs.io/libmagic-rs"
documentation = "https://docs.rs/libmagic-rs"
keywords = ["file", "magic", "libmagic", "file-type", "identification"]
categories = ["command-line-utilities", "parsing"]
rust-version = "1.89"
readme = "README.md"
exclude = [
"/spec",
"/docs",
"/.kiro",
"/.cursor",
"/.vscode",
"/.github",
"/.git",
"/.env.*",
"*.orig",
"AGENTS.md",
]
# Workspace lint configuration
[workspace.lints.rust]
# Security: Forbid unsafe code globally
unsafe_code = "forbid"
# Zero warnings policy
warnings = "deny"
[workspace.lints.clippy]
# Pedantic clippy configuration with proper priorities
correctness = { level = "deny", priority = -1 }
suspicious = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }
nursery = { level = "warn", priority = -1 }
cargo = { level = "warn", priority = -1 }
# Security-focused linting
as_conversions = "warn"
as_ptr_cast_mut = "warn"
cast_ptr_alignment = "warn"
float_cmp = "warn"
indexing_slicing = "warn"
arithmetic_side_effects = "warn"
integer_division = "warn"
modulo_arithmetic = "warn"
expect_used = "warn"
# Security anti-patterns
# allow_attributes = "warn" # I think we need them for test and benchmarks
dbg_macro = "warn"
# print_stdout = "warn" # TODO: Revisit this
# print_stderr = "warn"
todo = "warn"
unimplemented = "warn"
unreachable = "warn"
panic = "deny" # DON'T PANIC IN PRODUCTION (it would be forbidden, but it breaks clap for some reason, so just don't do it)
unwrap_used = "deny" # DON'T UNWRAP IN PRODUCTION
exhaustive_enums = "warn"
# Performance and correctness
perf = { level = "warn", priority = -1 }
await_holding_lock = "deny"
clone_on_ref_ptr = "warn"
create_dir = "warn"
exit = "warn"
filetype_is_file = "warn"
float_equality_without_abs = "warn"
if_then_some_else_none = "warn"
# invalid_from_utf8_unchecked = "warn" # Not available in clippy
large_stack_arrays = "warn"
let_underscore_must_use = "warn"
lossy_float_literal = "warn"
map_err_ignore = "warn"
match_same_arms = "warn"
missing_assert_message = "warn"
missing_docs_in_private_items = "allow"
mixed_read_write_in_expression = "warn"
mutex_atomic = "warn"
mutex_integer = "warn"
non_ascii_literal = "warn"
non_send_fields_in_send_ty = "warn"
partial_pub_fields = "warn"
pattern_type_mismatch = "warn"
rc_buffer = "warn"
rc_mutex = "warn"
redundant_type_annotations = "warn"
ref_binding_to_reference = "warn"
same_name_method = "warn"
self_named_module_files = "warn"
semicolon_inside_block = "warn"
semicolon_outside_block = "warn"
shadow_reuse = "warn"
shadow_same = "warn"
shadow_unrelated = "warn"
str_to_string = "warn"
string_add = "warn"
string_add_assign = "warn"
string_lit_as_bytes = "warn"
string_slice = "warn"
suspicious_operation_groupings = "warn"
trailing_empty_array = "warn"
transmute_undefined_repr = "warn"
trivial_regex = "warn"
undocumented_unsafe_blocks = "deny" # We should not have unsafe code in this project, but if we do, we should document it
unnecessary_self_imports = "warn"
unseparated_literal_suffix = "warn"
unused_async = "warn"
unused_peekable = "warn"
unused_rounding = "warn"
use_debug = "warn"
verbose_file_reads = "warn"
wildcard_enum_match_arm = "warn"
zero_sized_map_values = "warn"
# Proper, but pedantic
cargo_common_metadata = "warn"
multiple_crate_versions = "warn"
missing_errors_doc = "warn"
missing_panics_doc = "deny"
must_use_candidate = "warn"
cast_possible_truncation = "warn"
cast_precision_loss = "warn"
cast_sign_loss = "warn"
module_name_repetitions = "warn"
similar_names = "warn"
too_many_lines = "warn"
type_complexity = "warn"
async_yields_async = "warn"
large_futures = "warn"
result_large_err = "warn"
[[bin]]
name = "rmagic"
path = "src/main.rs"
[dependencies]
cfg-if = "1.0.4"
chrono = { version = "0.4.41", default-features = false, features = ["std", "clock"] }
clap = { version = "4.6.0", features = ["derive"] }
clap-stdin = "0.8.1"
clap_complete = "4.6.0"
ctrlc = { version = "3.5.2", features = ["termination"] }
env_logger = "0.11"
log = "0.4"
memchr = "2.8.0"
memmap2 = "0.9.10"
nom = "8.0.0"
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.149"
thiserror = "2.0.18"
[build-dependencies]
log = "0.4"
nom = "8.0.0"
serde = { version = "1.0.228", features = ["derive"] }
thiserror = "2.0.18"
[dev-dependencies]
assert_cmd = "2.2.0"
criterion = "0.8.2"
insta = { version = "1.47.2", features = ["json"] }
nix = { version = "0.31.2", features = ["fs"] }
predicates = "3.1.4"
proptest = "1.11.0"
regex = "1.12.3"
tempfile = "3.27.0"
[[bench]]
name = "parser_bench"
harness = false
[[bench]]
name = "evaluation_bench"
harness = false
[[bench]]
name = "io_bench"
harness = false
[profile.dev.package."*"]
opt-level = 2
[profile.release]
lto = "thin"
codegen-units = 1
strip = true
# The profile that 'dist' will build with
[profile.dist]
inherits = "release"
lto = "thin"
overflow-checks = true
strip = true