Skip to content

Rule Proposal: Prefer Function over direct control cube accessΒ #21

Description

@onefloid

πŸ“œ Rule Proposal

πŸ§‘β€πŸ’» User Story

As a TI developer, I want linti to flag direct reads of control cubes that are only implicitly created by other functions, so that my process doesn't crash when that control cube doesn't exist yet.

πŸ“ Description

Certain TM1 functions implicitly create control cubes the first time they run, e.g. CubeSetLogChanges or CubeGetLogChanges creates }CubeProperties.

# Bad
CellGetS('}CubeProperties', pCube, 'LOGGING' );

# Good
CubeGetLogChanges( pCube )
# Bad
CellPutS(pCubeLogging, '}CubeProperties', pCube, 'LOGGING' );

# Good
CubeSetLogChanges( pCube, pCubeLogging);

AttrInsert/ElementAttrInsert create }ElementAttributes_<Dimension>, and ElementSecurityPut creates }ElementSecurity_<Dimension>. A direct read of one of these cubes (e.g. via CellGetN/CellGetS) without a preceding CubeExists check aborts the process if the cube was never created.

βœ… Acceptance Criteria

  • A list of known control-cube patterns exists (cube name pattern + the function that normally creates it)
  • A direct read of one of these control cube names is flagged if no CubeExists check for that cube precedes it in the same block
  • The rule recognizes both fixed cube names and dynamically composed names (e.g. '}ElementAttributes_' | vDim), to the extent the architecture allows
  • The error message names the affected control cube and the function that would normally create it

Notes

  • Possible Rule ID: C420

Metadata

Metadata

Assignees

No one assigned

    Labels

    ruleNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions