Skip to content

require-paired-calls

Checks opener and closer call pairs across control flow.

The rule keeps a stack of configured opener calls and matches later closers against that stack.

It reports missing closers, extra closers, closers called out of order, early exits that skip cleanup, and branch paths where an opener is not closed everywhere. When requireSync is on, it also reports await and yield between the opener and closer.

With no options, it defaults to Roblox profiling rules:

  • opener: debug.profilebegin
  • closer: debug.profileend
  • requireSync: true
  • platform: "roblox"
  • yielding functions: task.wait, wait, *.WaitForChild, *.*Async
Incorrect
function runTask() {
debug.profilebegin("runTask");
if (!ready) return;
debug.profileend();
}
Correct
function runTask() {
debug.profilebegin("runTask");
try {
doWork();
} finally {
debug.profileend();
}
}
OptionTypeDefault
allowConditionalClosersbooleanfalse
allowMultipleOpenersbooleantrue
maxNestingDepthnumber0
pairsPairConfiguration[]default Roblox profiling pair when omitted

Each pair supports these fields:

FieldType
openerstring
closerstring | string[]
alternativesstring[]
openerAlternativesstring[]
platform"roblox"
requireSyncboolean
yieldingFunctionsstring[]