Reach.Smell.Helpers (Reach v2.7.1)

Copy Markdown View Source

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

Summary

Functions

Returns top-level statements from a function body.

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

ast_modules_in_file(ast)

body_statements(function)

Returns top-level statements from a function body.

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.