Rule reference
Search LinTi rules and run their examples in your browser.
C150Code Quality Ruleserror
Invalid Function Placement
Detects TI functions used in a procedure section where they are not allowed
Checks function calls against the Prolog, Metadata, Data and Epilog sections and reports a placement the IBM function reference documents as invalid. Valid placement produces no diagnostic.
- DimensionElementInsert / HierarchyElementInsert: valid in Prolog/Metadata; invalid in Data/Epilog.
- DimensionElementComponentAdd / HierarchyElementComponentAdd: valid in Prolog/Metadata/Data; invalid in Epilog.
- DisableBulkLoadMode: valid in the Epilog; invalid in Prolog/Metadata/Data, because bulk load mode has to stay on for the whole process. IBM asks for it in the Epilog's last line; that position is not checked.
- AddInfoCubeRestriction: valid in the Prolog only (IBM: "must be placed in the Prolog").
- DisableMTQViewConstruct: invalid in Metadata/Data. IBM wants it in the Prolog, where it is the only place it has an effect, or, after EnableMTQViewConstruct, on the Epilog's last line; that position is not checked.
- Dimension and Hierarchy Direct functions: ElementInsertDirect, ElementDeleteDirect, ElementComponentAddDirect, ElementComponentDeleteDirect and TopElementInsertDirect are unrestricted in all four sections. IBM describes direct edits during Data loads; they do not inherit the non-Direct functions' restrictions.
- ItemSkip: valid in Metadata/Data; invalid in Prolog/Epilog.
Restrictions are function-specific. ElementDelete, ElementComponentDelete and TopElementInsert are not automatically restricted like ElementInsert. See docs/function-placement.md for the IBM sources.
Placements that are only discouraged (for example attribute writes in Metadata, security changes in Data/Epilog, once-per-process operations in Metadata/Data) are reported as warnings by Discouraged Function Placement (C151), which shares this rule's placement table. `--select C15` runs both. Before C151 existed, this rule reported those recommendations as errors; a `# noqa: C150` no longer suppresses them, use `# noqa: C151`.
Function matching is case-insensitive. Unknown functions and code without a known procedure section are not reported. Calls inside expressions and nested control flow are checked too. Statements the parser could not read are skipped.
allowed_functions lists functions to exempt from the check in every section, for a placement this project disagrees with. C151 falls back to this list when it sets none of its own.
Supersedes ItemSkip Block Usage (C130), which is disabled by default and skipped with a warning whenever this rule is active, so the same ItemSkip is never reported twice. Selecting C130 (or its alias S120) explicitly still runs the legacy ItemSkip-only rule with its own rules.item_skip settings.
Try C150
Edit an example and run the real Python rule in your browser. The first run loads Pyodide; subsequent runs reuse it.
TI codeConfiguration used: LinTi defaults
This example uses LinTi's default configuration.
Default values for C150 in a full scan:
rules:
misplaced_function:
enabled: true
severity: error
report_not_recommended: true
allowed_functions: []
Add:
Pick an example, edit its TI code, and run that rule locally in your browser. Expand the configuration panel to see which settings the example uses: either LinTi's defaults or the example's YAML. To customize a rule, open it in the configurator.