MISRA Rule 16.5: A default label shall appear as either the first or the last switch label of a switch statement

Hierarchy (view full)

Constructors

Properties

context: MISRAContext

MISRA context for error tracking and rule transformations state

ruleID: string

Unique identifier for the MISRA rule.

Methods

  • Logs a MISRA-C rule violation error

    Parameters

    • $jp: Joinpoint

      The joinpoint where the violation occurred

    • msg: string

      Description of the violation

    Returns void

  • Logs a warning from automatic MISRA-C correction, which may change the program's behavior

    Parameters

    • $jp: Joinpoint

      The joinpoint where the correction was applied

    • msg: string

      Description of the warning

    Returns void

  • Checks if the given joinpoint is a switch statement where the default label appears either as first of last label

    Parameters

    • $jp: Joinpoint

      Joinpoint to analyze

    • logErrors: boolean = false

      [logErrors=false] - Whether to log errors if a violation is detected

    Returns boolean

    Returns true if the joinpoint violates the rule, false otherwise