Repository navigation
Open
Description
Tracks the lint ideas that weren't in #234.
Correctness and security
-
unchecked_puzzle_call(oruntrusted_tree_hash): a function-typed value (for example aninner_puzzleparameter ofmain) is called, but itstree_hashis never compared against a curried or otherwise trusted hash. This is the classic puzzle bug. It needs a dataflow analysis to avoid false positives. A first version could flag function-typed parameters of entrypoints that are called but never passed totree_hash. -
discarded_condition: aConditionstruct is built but never reaches the returned condition list. For example, it's only used in a branch that drops it.unused_bindingdoesn't catch this when the binding is used. -
non_exhaustive_union_guard: anif x is A { .. } else if x is B { .. }chain overA | B | Cthat never handlesCand falls into araise. This would build on the existing narrowing.
Style
-
bool_bitwise_operator:&/|onBool. This needs care, since&is used on purpose to avoid branching (for exampleparent_is_cat & (extra_delta == 0)inexamples/puzzles/cat.rue). It should beallowby default, or only fire when the right side may raise or is expensive enough that short-circuiting matters. -
missing_entrypoint_return_type: entrypoints whose return type isAnyor inferred, since puzzle outputs should be explicit.
Follow-ups from #234
- Lint groups for the new lints (for example
styleandcomplexity), so they can be turned off together. - Configurable thresholds for
large_inline, which currently uses fixed HIR node counts. A size estimate based on the lowered code would also be more meaningful than HIR nodes. -
repeated_expensive_callcould use a cost model, rather than treating every function call as expensive.
Cleanups from #234
-
Hir::children()allocates aVecfor every node that the lint walk visits. An iterator or a callback would avoid that. - Skipping a struct's default field values is implemented twice, in
crates/rue-lint/src/visit.rsandcrates/rue-lint/src/lints/recursion.rs. It should be one shared helper. -
unnecessary_parensincrates/rue-lint/src/lints/syntax.rshas its own copy of the word spacing check.separate_wordsincrates/rue-lint/src/context.rsalready does this for every machine-applicable suggestion, so the lint can rely on it.
Metadata
Metadata
Assignees
Labels
No labels
Activity