import { Joinpoint } from "@specs-feup/clava/api/Joinpoints.js"; import { MISRAError, MISRATransformationResults, MISRATransformationType } from "./MISRA.js"; import Context from "./ast-visitor/Context.js"; /** * Tracks MISRA-C violations during the analysis and/or transformation of the code. * Also generates unique variable and function names. */ export default class MISRAContext extends Context { #private; /** * Returns all violations found in the source code. */ get errors(): MISRAError[]; /** * Returns violations linked to nodes that are still present in the AST after correction. */ get activeErrors(): MISRAError[]; /** * Orders errors according to their location */ private sortErrors; /** * Returns the user-provided configuration that assists in violation correction, if provided. Otherwise, returns undefined. */ get config(): Map | undefined; /** * Loads the JSON config file and transforms it into an internal Map representation. * If the file does not exist, logs an error and exits the process. */ set config(configFilePath: string); /** * Clears stored information. */ resetStorage(): void; /** * Returns the type of transformation applied by the specified rule to the given AST node. * If no transformation was recorded, returns undefined. * * @param ruleID Identifier of the violated rule * @param $jp AST node * @returns The type of transformation applied, or undefined if none was recorded. */ getRuleResult(ruleID: string, $jp: Joinpoint): MISRATransformationType | undefined; /** * Registers the type of transformation a rule applied to a AST node * @param ruleID Identifier of the violated rule * @param $jp * @param result Applied transformation */ addRuleResult(ruleID: string, $jp: Joinpoint, result: MISRATransformationType): void; /** * Registers a new violation of the standard * * @param ruleID Identifier of the violated rule * @param $jp Joinpoint where the error was detected * @param message Description of the error */ addMISRAError(ruleID: string, $jp: Joinpoint, message: string): void; generateIdentifierName($jp: Joinpoint): string | undefined; /** * Outputs a formatted MISRA-C rule violation message * * @param error - The MISRA error object containing the rule ID, message, and location */ private outputError; /** * Displays all violations found in the source code. */ outputAllErrors(): void; /** * Displays violations linked to nodes that are still present in the AST after correction. */ outputActiveErrors(): void; } //# sourceMappingURL=MISRAContext.d.ts.map