Skip to content

docs(pc0038,fc0007,lc0089) Document shared flow-terminating built-ins across rules - #164

Open
MODUSCarstenScholling wants to merge 2 commits into
ALCops:mainfrom
MODUSCarstenScholling:dev-pr153-terminating-new
Open

docs(pc0038,fc0007,lc0089) Document shared flow-terminating built-ins across rules#164
MODUSCarstenScholling wants to merge 2 commits into
ALCops:mainfrom
MODUSCarstenScholling:dev-pr153-terminating-new

Conversation

@MODUSCarstenScholling

Copy link
Copy Markdown
Contributor

Summary

Document shared flow-terminating built-ins across PC0038, FC0007, and LC0089.

This documentation change accompanies ALCops/Analyzers#505, which implements the described behavior.

Changes

PC0038

  • Explain that return values are required only on reachable paths.
  • Document named-return assignment tracking in conditions, case selectors, loop expressions, for bounds, and foreach collections.
  • Document exhaustive enum and option case handling.
  • Document terminating built-in calls:
    • Error(...)
    • Record.FieldError(...)
    • FieldRef.FieldError(...)
  • Clarify that user-defined procedures named Error or FieldError do not terminate a path.

FC0007

  • Document Record.FieldError(...) and FieldRef.FieldError(...) as scope-leaving statements for ErrorOnly and ExitAndError.
  • Clarify that scope-leaving spacing applies only to the supported built-in calls.
  • Keep direct if-branch behavior unchanged: branch statements are not sibling statements for FC0007 spacing analysis.

LC0089

  • Document Error(...), Record.FieldError(...), and FieldRef.FieldError(...) as guard-clause exits.
  • Explicitly document the supported report and XMLport guard exits:
    • CurrReport.Break()
    • CurrReport.Skip()
    • CurrReport.Quit()
    • CurrXMLport.Break()
    • CurrXMLport.Skip()
    • CurrXMLport.Quit()
  • Clarify that CurrReport and CurrXMLport methods are Cognitive Complexity guard exits only; they are not general procedure terminators.
  • Clarify that user-defined Error and FieldError methods remain normal calls.

Known limitation

Error(ErrorInfo) is currently documented as flow-terminating even when ErrorInfo.Collectible is true and execution happens inside an ErrorBehavior::Collect scope.

AL can continue after a collectible error in that context. Identifying this precisely requires data-flow analysis of the ErrorInfo value and surrounding collection behavior, which is outside the current invocation-level analysis.

Dependency

Depends on ALCops/Analyzers#505. Merge the analyzer implementation before releasing documentation that describes this behavior.

Replaces existing #153

- Relates to ALCops/Analyzers#463 and ALCops/Analyzers#468
- Document FieldError handling for PC0038, FC0007, and LC0089
- Explain the collectible ErrorInfo limitation
- Relates to ALCops/Analyzers#463
- Document CurrReport and CurrXMLport guard-clause behavior
- Distinguish metric-specific guard exits from general procedure terminators
@MODUSCarstenScholling MODUSCarstenScholling changed the title docs: Document shared flow-terminating built-ins across PC0038, FC0007, and LC0089. docs(pc0038,fc0007,lc0089) Document shared flow-terminating built-ins across rules Sep 2, 2026
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.

1 participant