Skip to content

Fix DisallowModule rule missing Pexp_ident — pipe calls with no extra args (#15) - #16

Merged
LTibbetts merged 2 commits into
masterfrom
fix/issue-15-disallow-module-pexp-ident
Feb 27, 2026
Merged

Fix DisallowModule rule missing Pexp_ident — pipe calls with no extra args (#15)#16
LTibbetts merged 2 commits into
masterfrom
fix/issue-15-disallow-module-pexp-ident

Conversation

@LTibbetts

Copy link
Copy Markdown
Contributor

Summary

Fixes #15DisallowModule rule now catches disallowed module usage in pipe calls with no extra arguments (e.g. x->Belt.List.toArray).

Root Cause

The linter's lintExpression only matched Pexp_apply nodes (function calls with arguments). When x->f has no extra args, the bundled parser represents f as a bare Pexp_ident argument to the pipe operator — not as Pexp_apply of f — so it was invisible to the rule.

Fix

Replaced the Pexp_apply-only pattern with a Pexp_ident pattern in DisallowModuleRule.ml. Since the AST iterator visits every expression node, Pexp_ident naturally catches the disallowed module identifier whether it appears in a direct call, a pipe with args, or a pipe with no extra args. No double-counting occurs because the Pexp_apply case was removed.

Tests

  • disallow_module_test_6.res — TDD red-to-green test for the bug: direct call, pipe+args, pipe no-args (toArray, length)
  • disallow_module_test_7.res — Verifies all Pexp_apply scenarios still work: single arg, multiple args, pipe+args, pipe no-args, chained pipes, nested calls
  • All 23 tests pass, 0 regressions

Version

Bumped to v0.4.3

… args now caught (#15)

Replace Pexp_apply-only matching with Pexp_ident matching in
lintExpression so bare module references (e.g. x->Belt.List.toArray)
are detected. Adds tests for the bug case and verifies all existing
Pexp_apply scenarios still pass.

Bump version to 0.4.3.
@LTibbetts
LTibbetts merged commit d52051c into master Feb 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DisallowModule rule misses Pexp_ident — pipe calls with no extra arguments bypass lint

2 participants