Reach.Smell.Helpers (Reach v2.3.2)

Copy Markdown View Source

Shared helpers for smell checks including loop detection, statement pairs, and callbacks.

Summary

Functions

Extracts the callback fn body nodes from an Enum call.

Returns true if node is inside an accumulator-carrying loop (reduce/scan).

Returns true if node is inside a loop body (reduce/map/for/recursion).

Returns true if the function contains a self-recursive call.

Returns adjacent top-level statement pairs from a function body.

Functions

call_name(node)

callback_body(arg1)

Extracts the callback fn body nodes from an Enum call.

function_defs(project)

inside_accumulator?(node, function)

Returns true if node is inside an accumulator-carrying loop (reduce/scan).

inside_loop?(node, function)

Returns true if node is inside a loop body (reduce/map/for/recursion).

location(node)

recursive?(function)

Returns true if the function contains a self-recursive call.

statement_pairs(function)

Returns adjacent top-level statement pairs from a function body.