@specs-feup/clava-misra 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitignore +117 -0
- package/README.md +70 -15
- package/dist/MISRA.d.ts +129 -0
- package/dist/MISRA.d.ts.map +1 -0
- package/dist/MISRA.js +245 -0
- package/dist/MISRA.js.map +1 -0
- package/dist/MISRAContext.d.ts +21 -0
- package/dist/MISRAContext.d.ts.map +1 -0
- package/dist/MISRAContext.js +75 -0
- package/dist/MISRAContext.js.map +1 -0
- package/dist/MISRARule.d.ts +56 -0
- package/dist/MISRARule.d.ts.map +1 -0
- package/dist/MISRARule.js +45 -0
- package/dist/MISRARule.js.map +1 -0
- package/dist/MISRATool.d.ts +12 -0
- package/dist/MISRATool.d.ts.map +1 -0
- package/dist/MISRATool.js +84 -0
- package/dist/MISRATool.js.map +1 -0
- package/dist/foo.d.ts +2 -0
- package/dist/foo.d.ts.map +1 -0
- package/{src/foo.ts → dist/foo.js} +3 -2
- package/dist/foo.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +5 -0
- package/dist/main.js.map +1 -0
- package/dist/misra/MISRAAnalyser.d.ts +14 -0
- package/dist/misra/MISRAAnalyser.d.ts.map +1 -0
- package/{src/misra/MISRAAnalyser.ts → dist/misra/MISRAAnalyser.js} +13 -23
- package/dist/misra/MISRAAnalyser.js.map +1 -0
- package/dist/misra/MISRAPass.d.ts +27 -0
- package/dist/misra/MISRAPass.d.ts.map +1 -0
- package/dist/misra/MISRAPass.js +60 -0
- package/dist/misra/MISRAPass.js.map +1 -0
- package/dist/misra/MISRAPassResult.d.ts +13 -0
- package/dist/misra/MISRAPassResult.d.ts.map +1 -0
- package/dist/misra/MISRAPassResult.js +11 -0
- package/dist/misra/MISRAPassResult.js.map +1 -0
- package/dist/misra/MISRAReporter.d.ts +20 -0
- package/dist/misra/MISRAReporter.d.ts.map +1 -0
- package/dist/misra/MISRAReporter.js +43 -0
- package/dist/misra/MISRAReporter.js.map +1 -0
- package/dist/misra/passes/S10_EssentialTypePass.d.ts +42 -0
- package/dist/misra/passes/S10_EssentialTypePass.d.ts.map +1 -0
- package/dist/misra/passes/S10_EssentialTypePass.js +370 -0
- package/dist/misra/passes/S10_EssentialTypePass.js.map +1 -0
- package/dist/misra/passes/S12_ExpressionPass.d.ts +18 -0
- package/dist/misra/passes/S12_ExpressionPass.d.ts.map +1 -0
- package/dist/misra/passes/S12_ExpressionPass.js +72 -0
- package/dist/misra/passes/S12_ExpressionPass.js.map +1 -0
- package/dist/misra/passes/S13_SideEffectPass.d.ts +18 -0
- package/dist/misra/passes/S13_SideEffectPass.d.ts.map +1 -0
- package/dist/misra/passes/S13_SideEffectPass.js +105 -0
- package/dist/misra/passes/S13_SideEffectPass.js.map +1 -0
- package/dist/misra/passes/S15_ControlFlowPass.d.ts +19 -0
- package/dist/misra/passes/S15_ControlFlowPass.d.ts.map +1 -0
- package/dist/misra/passes/S15_ControlFlowPass.js +94 -0
- package/dist/misra/passes/S15_ControlFlowPass.js.map +1 -0
- package/dist/misra/passes/S16_SwitchStatementPass.d.ts +17 -0
- package/dist/misra/passes/S16_SwitchStatementPass.d.ts.map +1 -0
- package/dist/misra/passes/S16_SwitchStatementPass.js +152 -0
- package/dist/misra/passes/S16_SwitchStatementPass.js.map +1 -0
- package/dist/misra/passes/S17_FunctionPass.d.ts +12 -0
- package/dist/misra/passes/S17_FunctionPass.d.ts.map +1 -0
- package/dist/misra/passes/S17_FunctionPass.js +38 -0
- package/dist/misra/passes/S17_FunctionPass.js.map +1 -0
- package/dist/misra/passes/S18_PointersArraysPass.d.ts +17 -0
- package/dist/misra/passes/S18_PointersArraysPass.d.ts.map +1 -0
- package/dist/misra/passes/S18_PointersArraysPass.js +115 -0
- package/dist/misra/passes/S18_PointersArraysPass.js.map +1 -0
- package/dist/misra/passes/S19_OverlappingStoragePass.d.ts +11 -0
- package/dist/misra/passes/S19_OverlappingStoragePass.d.ts.map +1 -0
- package/dist/misra/passes/S19_OverlappingStoragePass.js +20 -0
- package/dist/misra/passes/S19_OverlappingStoragePass.js.map +1 -0
- package/dist/misra/passes/S21_StandardLibPass.d.ts +20 -0
- package/dist/misra/passes/S21_StandardLibPass.d.ts.map +1 -0
- package/dist/misra/passes/S21_StandardLibPass.js +77 -0
- package/dist/misra/passes/S21_StandardLibPass.js.map +1 -0
- package/dist/misra/passes/S3_CommentPass.d.ts +12 -0
- package/dist/misra/passes/S3_CommentPass.d.ts.map +1 -0
- package/dist/misra/passes/S3_CommentPass.js +27 -0
- package/dist/misra/passes/S3_CommentPass.js.map +1 -0
- package/dist/misra/passes/S5_IdentifierPass.d.ts +13 -0
- package/dist/misra/passes/S5_IdentifierPass.d.ts.map +1 -0
- package/dist/misra/passes/S5_IdentifierPass.js +60 -0
- package/dist/misra/passes/S5_IdentifierPass.js.map +1 -0
- package/dist/misra/passes/S6_TypePass.d.ts +11 -0
- package/dist/misra/passes/S6_TypePass.d.ts.map +1 -0
- package/dist/misra/passes/S6_TypePass.js +25 -0
- package/dist/misra/passes/S6_TypePass.js.map +1 -0
- package/dist/misra/passes/S7_LiteralsConstantsPass.d.ts +14 -0
- package/dist/misra/passes/S7_LiteralsConstantsPass.d.ts.map +1 -0
- package/dist/misra/passes/S7_LiteralsConstantsPass.js +71 -0
- package/dist/misra/passes/S7_LiteralsConstantsPass.js.map +1 -0
- package/dist/misra/passes/S8_DeclDefPass.d.ts +18 -0
- package/dist/misra/passes/S8_DeclDefPass.d.ts.map +1 -0
- package/dist/misra/passes/S8_DeclDefPass.js +127 -0
- package/dist/misra/passes/S8_DeclDefPass.js.map +1 -0
- package/dist/misra/sections/Section10_EssentialTypeModel.d.ts +33 -0
- package/dist/misra/sections/Section10_EssentialTypeModel.d.ts.map +1 -0
- package/{src/misra/sections/Section10_EssentialTypeModel.ts → dist/misra/sections/Section10_EssentialTypeModel.js} +58 -73
- package/dist/misra/sections/Section10_EssentialTypeModel.js.map +1 -0
- package/dist/misra/sections/Section11_PointerTypeConversions.d.ts +12 -0
- package/dist/misra/sections/Section11_PointerTypeConversions.d.ts.map +1 -0
- package/{src/misra/sections/Section11_PointerTypeConversions.ts → dist/misra/sections/Section11_PointerTypeConversions.js} +16 -27
- package/dist/misra/sections/Section11_PointerTypeConversions.js.map +1 -0
- package/dist/misra/sections/Section12_Expressions.d.ts +15 -0
- package/dist/misra/sections/Section12_Expressions.d.ts.map +1 -0
- package/dist/misra/sections/Section12_Expressions.js +70 -0
- package/dist/misra/sections/Section12_Expressions.js.map +1 -0
- package/dist/misra/sections/Section13_SideEffects.d.ts +14 -0
- package/dist/misra/sections/Section13_SideEffects.d.ts.map +1 -0
- package/dist/misra/sections/Section13_SideEffects.js +90 -0
- package/dist/misra/sections/Section13_SideEffects.js.map +1 -0
- package/dist/misra/sections/Section14_ControlStmtExprs.d.ts +8 -0
- package/dist/misra/sections/Section14_ControlStmtExprs.d.ts.map +1 -0
- package/{src/misra/sections/Section14_ControlStmtExprs.ts → dist/misra/sections/Section14_ControlStmtExprs.js} +8 -10
- package/dist/misra/sections/Section14_ControlStmtExprs.js.map +1 -0
- package/dist/misra/sections/Section15_ControlFlow.d.ts +14 -0
- package/dist/misra/sections/Section15_ControlFlow.d.ts.map +1 -0
- package/dist/misra/sections/Section15_ControlFlow.js +97 -0
- package/dist/misra/sections/Section15_ControlFlow.js.map +1 -0
- package/dist/misra/sections/Section16_SwitchStatements.d.ts +13 -0
- package/dist/misra/sections/Section16_SwitchStatements.d.ts.map +1 -0
- package/{src/misra/sections/Section16_SwitchStatements.ts → dist/misra/sections/Section16_SwitchStatements.js} +49 -74
- package/dist/misra/sections/Section16_SwitchStatements.js.map +1 -0
- package/dist/misra/sections/Section17_Functions.d.ts +9 -0
- package/dist/misra/sections/Section17_Functions.d.ts.map +1 -0
- package/{src/misra/sections/Section17_Functions.ts → dist/misra/sections/Section17_Functions.js} +10 -13
- package/dist/misra/sections/Section17_Functions.js.map +1 -0
- package/dist/misra/sections/Section18_PointersAndArrays.d.ts +13 -0
- package/dist/misra/sections/Section18_PointersAndArrays.d.ts.map +1 -0
- package/{src/misra/sections/Section18_PointersAndArrays.ts → dist/misra/sections/Section18_PointersAndArrays.js} +36 -40
- package/dist/misra/sections/Section18_PointersAndArrays.js.map +1 -0
- package/dist/misra/sections/Section19_OverlappingStorage.d.ts +8 -0
- package/dist/misra/sections/Section19_OverlappingStorage.d.ts.map +1 -0
- package/dist/misra/sections/Section19_OverlappingStorage.js +16 -0
- package/dist/misra/sections/Section19_OverlappingStorage.js.map +1 -0
- package/dist/misra/sections/Section20_PreprocessingDirectives.d.ts +8 -0
- package/dist/misra/sections/Section20_PreprocessingDirectives.d.ts.map +1 -0
- package/{src/misra/sections/Section20_PreprocessingDirectives.ts → dist/misra/sections/Section20_PreprocessingDirectives.js} +7 -9
- package/dist/misra/sections/Section20_PreprocessingDirectives.js.map +1 -0
- package/dist/misra/sections/Section21_StandardLibraries.d.ts +17 -0
- package/dist/misra/sections/Section21_StandardLibraries.d.ts.map +1 -0
- package/dist/misra/sections/Section21_StandardLibraries.js +54 -0
- package/dist/misra/sections/Section21_StandardLibraries.js.map +1 -0
- package/dist/misra/sections/Section2_UnusedCode.d.ts +9 -0
- package/dist/misra/sections/Section2_UnusedCode.d.ts.map +1 -0
- package/{src/misra/sections/Section2_UnusedCode.ts → dist/misra/sections/Section2_UnusedCode.js} +11 -16
- package/dist/misra/sections/Section2_UnusedCode.js.map +1 -0
- package/dist/misra/sections/Section3_Comments.d.ts +9 -0
- package/dist/misra/sections/Section3_Comments.d.ts.map +1 -0
- package/{src/misra/sections/Section3_Comments.ts → dist/misra/sections/Section3_Comments.js} +7 -10
- package/dist/misra/sections/Section3_Comments.js.map +1 -0
- package/dist/misra/sections/Section5_Identifiers.d.ts +12 -0
- package/dist/misra/sections/Section5_Identifiers.d.ts.map +1 -0
- package/dist/misra/sections/Section5_Identifiers.js +139 -0
- package/dist/misra/sections/Section5_Identifiers.js.map +1 -0
- package/dist/misra/sections/Section6_Types.d.ts +8 -0
- package/dist/misra/sections/Section6_Types.d.ts.map +1 -0
- package/dist/misra/sections/Section6_Types.js +23 -0
- package/dist/misra/sections/Section6_Types.js.map +1 -0
- package/dist/misra/sections/Section7_LiteralsConstants.d.ts +11 -0
- package/dist/misra/sections/Section7_LiteralsConstants.d.ts.map +1 -0
- package/{src/misra/sections/Section7_LiteralsConstants.ts → dist/misra/sections/Section7_LiteralsConstants.js} +18 -25
- package/dist/misra/sections/Section7_LiteralsConstants.js.map +1 -0
- package/dist/misra/sections/Section8_DeclarationsDefinitions.d.ts +15 -0
- package/dist/misra/sections/Section8_DeclarationsDefinitions.d.ts.map +1 -0
- package/{src/misra/sections/Section8_DeclarationsDefinitions.ts → dist/misra/sections/Section8_DeclarationsDefinitions.js} +18 -33
- package/dist/misra/sections/Section8_DeclarationsDefinitions.js.map +1 -0
- package/dist/misra/tests/utils.d.ts +10 -0
- package/dist/misra/tests/utils.d.ts.map +1 -0
- package/dist/misra/tests/utils.js +33 -0
- package/dist/misra/tests/utils.js.map +1 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_2_TopLevelSwitch.d.ts +15 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_2_TopLevelSwitch.d.ts.map +1 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_2_TopLevelSwitch.js +33 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_2_TopLevelSwitch.js.map +1 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_3_UnconditionalBreak.d.ts +16 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_3_UnconditionalBreak.d.ts.map +1 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_3_UnconditionalBreak.js +60 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_3_UnconditionalBreak.js.map +1 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_4_SwitchHasDefault.d.ts +19 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_4_SwitchHasDefault.d.ts.map +1 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_4_SwitchHasDefault.js +42 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_4_SwitchHasDefault.js.map +1 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_5_DefaultFirstOrLast.d.ts +43 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_5_DefaultFirstOrLast.d.ts.map +1 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_5_DefaultFirstOrLast.js +103 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_5_DefaultFirstOrLast.js.map +1 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_6_SwitchMinTwoClauses.d.ts +26 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_6_SwitchMinTwoClauses.d.ts.map +1 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_6_SwitchMinTwoClauses.js +49 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_6_SwitchMinTwoClauses.js.map +1 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_7_NonBooleanSwitchCondition.d.ts +26 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_7_NonBooleanSwitchCondition.d.ts.map +1 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_7_NonBooleanSwitchCondition.js +49 -0
- package/dist/rules/Section16_SwitchStatements/Rule_16_7_NonBooleanSwitchCondition.js.map +1 -0
- package/dist/rules/Section17_Functions/Rule_17_4_NonVoidReturn.d.ts +31 -0
- package/dist/rules/Section17_Functions/Rule_17_4_NonVoidReturn.d.ts.map +1 -0
- package/dist/rules/Section17_Functions/Rule_17_4_NonVoidReturn.js +71 -0
- package/dist/rules/Section17_Functions/Rule_17_4_NonVoidReturn.js.map +1 -0
- package/dist/rules/Section17_Functions/Rule_17_6_StaticArraySizeParam.d.ts +27 -0
- package/dist/rules/Section17_Functions/Rule_17_6_StaticArraySizeParam.d.ts.map +1 -0
- package/dist/rules/Section17_Functions/Rule_17_6_StaticArraySizeParam.js +58 -0
- package/dist/rules/Section17_Functions/Rule_17_6_StaticArraySizeParam.js.map +1 -0
- package/dist/rules/Section17_Functions/Rule_17_7_UnusedReturnValue.d.ts +28 -0
- package/dist/rules/Section17_Functions/Rule_17_7_UnusedReturnValue.d.ts.map +1 -0
- package/dist/rules/Section17_Functions/Rule_17_7_UnusedReturnValue.js +44 -0
- package/dist/rules/Section17_Functions/Rule_17_7_UnusedReturnValue.js.map +1 -0
- package/dist/rules/Section20-PreprocessingDirectives/Rule_20_2_InvalidHeaderFileName.d.ts +55 -0
- package/dist/rules/Section20-PreprocessingDirectives/Rule_20_2_InvalidHeaderFileName.d.ts.map +1 -0
- package/dist/rules/Section20-PreprocessingDirectives/Rule_20_2_InvalidHeaderFileName.js +108 -0
- package/dist/rules/Section20-PreprocessingDirectives/Rule_20_2_InvalidHeaderFileName.js.map +1 -0
- package/dist/rules/Section2_UnusedCode/Rule_2_3_UnusedTypeDecl.d.ts +43 -0
- package/dist/rules/Section2_UnusedCode/Rule_2_3_UnusedTypeDecl.d.ts.map +1 -0
- package/dist/rules/Section2_UnusedCode/Rule_2_3_UnusedTypeDecl.js +68 -0
- package/dist/rules/Section2_UnusedCode/Rule_2_3_UnusedTypeDecl.js.map +1 -0
- package/dist/rules/Section2_UnusedCode/Rule_2_4_UnusedTagDecl.d.ts +29 -0
- package/dist/rules/Section2_UnusedCode/Rule_2_4_UnusedTagDecl.d.ts.map +1 -0
- package/dist/rules/Section2_UnusedCode/Rule_2_4_UnusedTagDecl.js +53 -0
- package/dist/rules/Section2_UnusedCode/Rule_2_4_UnusedTagDecl.js.map +1 -0
- package/dist/rules/Section2_UnusedCode/Rule_2_6_UnusedLabels.d.ts +15 -0
- package/dist/rules/Section2_UnusedCode/Rule_2_6_UnusedLabels.d.ts.map +1 -0
- package/dist/rules/Section2_UnusedCode/Rule_2_6_UnusedLabels.js +35 -0
- package/dist/rules/Section2_UnusedCode/Rule_2_6_UnusedLabels.js.map +1 -0
- package/dist/rules/Section2_UnusedCode/Rule_2_7_UnusedParameters.d.ts +13 -0
- package/dist/rules/Section2_UnusedCode/Rule_2_7_UnusedParameters.d.ts.map +1 -0
- package/dist/rules/Section2_UnusedCode/Rule_2_7_UnusedParameters.js +53 -0
- package/dist/rules/Section2_UnusedCode/Rule_2_7_UnusedParameters.js.map +1 -0
- package/dist/rules/Section3_Comments/Rule_3_1_CommentSequences.d.ts +13 -0
- package/dist/rules/Section3_Comments/Rule_3_1_CommentSequences.d.ts.map +1 -0
- package/dist/rules/Section3_Comments/Rule_3_1_CommentSequences.js +32 -0
- package/dist/rules/Section3_Comments/Rule_3_1_CommentSequences.js.map +1 -0
- package/dist/rules/Section3_Comments/Rule_3_2_LineSplicing.d.ts +10 -0
- package/dist/rules/Section3_Comments/Rule_3_2_LineSplicing.d.ts.map +1 -0
- package/dist/rules/Section3_Comments/Rule_3_2_LineSplicing.js +26 -0
- package/dist/rules/Section3_Comments/Rule_3_2_LineSplicing.js.map +1 -0
- package/dist/rules/index.d.ts +20 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +38 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/tests/Section17_Functions/misra_config.json +10 -0
- package/dist/tests/utils.d.ts +10 -0
- package/dist/tests/utils.d.ts.map +1 -0
- package/dist/tests/utils.js +29 -0
- package/dist/tests/utils.js.map +1 -0
- package/dist/utils/utils.d.ts +102 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +202 -0
- package/dist/utils/utils.js.map +1 -0
- package/jest.config.js +6 -6
- package/package.json +44 -8
- package/src/MISRA.ts +276 -0
- package/src/MISRAContext.ts +84 -0
- package/src/MISRARule.ts +64 -0
- package/src/MISRATool.ts +95 -0
- package/src/main.ts +4 -33
- package/src/misra-old/MISRAAnalyser.ts +60 -0
- package/src/misra-old/MISRAAnalyserResult.ts +16 -0
- package/src/misra-old/sections/Section10_EssentialTypeModel.ts +377 -0
- package/src/misra-old/sections/Section11_PointerTypeConversions.ts +104 -0
- package/src/{misra → misra-old}/sections/Section12_Expressions.ts +7 -7
- package/src/{misra → misra-old}/sections/Section13_SideEffects.ts +15 -15
- package/src/misra-old/sections/Section14_ControlStmtExprs.ts +27 -0
- package/src/{misra → misra-old}/sections/Section15_ControlFlow.ts +10 -10
- package/src/misra-old/sections/Section18_PointersAndArrays.ts +108 -0
- package/src/{misra → misra-old}/sections/Section19_OverlappingStorage.ts +4 -4
- package/src/misra-old/sections/Section20_PreprocessingDirectives.ts +22 -0
- package/src/misra-old/sections/Section21_StandardLibraries.ts +99 -0
- package/src/{misra → misra-old}/sections/Section5_Identifiers.ts +16 -15
- package/src/{misra → misra-old}/sections/Section6_Types.ts +4 -4
- package/src/misra-old/sections/Section7_LiteralsConstants.ts +76 -0
- package/src/misra-old/sections/Section8_DeclarationsDefinitions.ts +133 -0
- package/src/rules/Section16_SwitchStatements/Rule_16_2_TopLevelSwitch.ts +41 -0
- package/src/rules/Section16_SwitchStatements/Rule_16_3_UnconditionalBreak.ts +70 -0
- package/src/rules/Section16_SwitchStatements/Rule_16_4_SwitchHasDefault.ts +41 -0
- package/src/rules/Section16_SwitchStatements/Rule_16_5_DefaultFirstOrLast.ts +113 -0
- package/src/rules/Section16_SwitchStatements/Rule_16_6_SwitchMinTwoClauses.ts +61 -0
- package/src/rules/Section16_SwitchStatements/Rule_16_7_NonBooleanSwitchCondition.ts +57 -0
- package/src/rules/Section17_Functions/Rule_17_3_ImplicitFunction.ts +180 -0
- package/src/rules/Section17_Functions/Rule_17_4_NonVoidReturn.ts +91 -0
- package/src/rules/Section17_Functions/Rule_17_6_StaticArraySizeParam.ts +68 -0
- package/src/rules/Section17_Functions/Rule_17_7_UnusedReturnValue.ts +49 -0
- package/src/rules/Section20-PreprocessingDirectives/Rule_20_2_InvalidHeaderFileName.ts +120 -0
- package/src/rules/Section2_UnusedCode/Rule_2_3_UnusedTypeDecl.ts +78 -0
- package/src/rules/Section2_UnusedCode/Rule_2_4_UnusedTagDecl.ts +61 -0
- package/src/rules/Section2_UnusedCode/Rule_2_6_UnusedLabels.ts +47 -0
- package/src/rules/Section2_UnusedCode/Rule_2_7_UnusedParameters.ts +67 -0
- package/src/rules/Section3_Comments/Rule_3_1_CommentSequences.ts +41 -0
- package/src/rules/Section3_Comments/Rule_3_2_LineSplicing.ts +36 -0
- package/src/rules/index.ts +44 -0
- package/src/tests/Section16_SwitchStatements/Rule_16_2_TopLevelSwitch.test.ts +55 -0
- package/src/tests/Section16_SwitchStatements/Rule_16_3_UnconditionalBreak.test.ts +70 -0
- package/src/tests/Section16_SwitchStatements/Rule_16_4_SwitchHasDefault.test.ts +128 -0
- package/src/tests/Section16_SwitchStatements/Rule_16_5_DefaultFirstOrLast.test.ts +132 -0
- package/src/tests/Section16_SwitchStatements/Rule_16_6_SwitchMinTwoClauses.test.ts +146 -0
- package/src/tests/Section16_SwitchStatements/Rule_16_7_NonBooleanSwitchCondition.test.ts +102 -0
- package/src/tests/Section17_Functions/Rule_17_3_ImplicitFunctions.test.ts +79 -0
- package/src/tests/Section17_Functions/Rule_17_4_NonVoidReturn.test.ts +98 -0
- package/src/tests/Section17_Functions/Rule_17_4_NonVoidReturn_MissingConfig.test.ts +77 -0
- package/src/tests/Section17_Functions/Rule_17_6_StaticArraySizeParam.test.ts +36 -0
- package/src/tests/Section17_Functions/Rule_17_7_UnusedReturnValue.test.ts +44 -0
- package/src/tests/Section17_Functions/misra_config.json +19 -0
- package/src/tests/Section2_UnusedCode/Rule_2_3_UnusedTypeDecl.test.ts +175 -0
- package/src/tests/Section2_UnusedCode/Rule_2_4_UnusedTagDecl.test.ts +219 -0
- package/src/tests/Section2_UnusedCode/Rule_2_6_UnusedLabels.test.ts +49 -0
- package/src/tests/Section2_UnusedCode/Rule_2_7_UnusedParameters.test.ts +55 -0
- package/src/tests/Section3_Comments/Rule_3_1_CommentSequences.test.ts +37 -0
- package/src/tests/utils.ts +51 -0
- package/src/utils/utils.ts +280 -0
- package/tsconfig.json +4 -3
- package/typedoc.config.js +1 -1
- package/CxxSources/lib.cpp +0 -3
- package/CxxSources/lib.h +0 -8
- package/CxxSources/main.cpp +0 -40
- package/TODO.md +0 -1
- package/consumer_order.txt +0 -2
- package/enum_integer_type.txt +0 -0
- package/is_temporary.txt +0 -0
- package/omp.txt +0 -0
- package/src/misra/passes/S16_SwitchStatementPass.ts +0 -168
- package/src/misra/passes/S3_CommentPass.ts +0 -40
- package/src/misra/sections/Section21_StandardLibraries.ts +0 -65
- package/src/misra/tests/S10_EssentialTypes.test.ts +0 -253
- package/src/misra/tests/S12_Expressions.test.ts +0 -43
- package/src/misra/tests/S13_SideEffects.test.ts +0 -77
- package/src/misra/tests/S15_ControlFlow.test.ts +0 -144
- package/src/misra/tests/S16_SwitchStatements.test.ts +0 -164
- package/src/misra/tests/S17_Functions.test.ts +0 -46
- package/src/misra/tests/S18_PointersArrays.test.ts +0 -167
- package/src/misra/tests/S19_OverlappingStorage.test.ts +0 -38
- package/src/misra/tests/S3_Comments.test.ts +0 -36
- package/src/misra/tests/S6_Types.test.ts +0 -36
- package/src/misra/tests/S7_LiteralsConstants.test.ts +0 -48
- package/src/misra/tests/utils.ts +0 -47
- package/types_with_templates.txt +0 -0
- /package/src/{misra → misra-old}/MISRAPass.ts +0 -0
- /package/src/{misra → misra-old}/MISRAPassResult.ts +0 -0
- /package/src/{misra → misra-old}/MISRAReporter.ts +0 -0
- /package/src/{misra → misra-old}/passes/S10_EssentialTypePass.ts +0 -0
- /package/src/{misra → misra-old}/passes/S12_ExpressionPass.ts +0 -0
- /package/src/{misra → misra-old}/passes/S13_SideEffectPass.ts +0 -0
- /package/src/{misra → misra-old}/passes/S15_ControlFlowPass.ts +0 -0
- /package/src/{misra → misra-old}/passes/S17_FunctionPass.ts +0 -0
- /package/src/{misra → misra-old}/passes/S18_PointersArraysPass.ts +0 -0
- /package/src/{misra → misra-old}/passes/S19_OverlappingStoragePass.ts +0 -0
- /package/src/{misra → misra-old}/passes/S21_StandardLibPass.ts +0 -0
- /package/src/{misra → misra-old}/passes/S5_IdentifierPass.ts +0 -0
- /package/src/{misra → misra-old}/passes/S6_TypePass.ts +0 -0
- /package/src/{misra → misra-old}/passes/S7_LiteralsConstantsPass.ts +0 -0
- /package/src/{misra → misra-old}/passes/S8_DeclDefPass.ts +0 -0
package/.gitignore
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
##### User-added #####
|
2
|
+
woven_code/
|
3
|
+
/dist
|
4
|
+
/docs
|
5
|
+
package-lock.json
|
6
|
+
CxxSources
|
7
|
+
/misra_config.json
|
8
|
+
/src/main.ts
|
9
|
+
|
10
|
+
# Extensions
|
11
|
+
ltex.dictionary.*
|
12
|
+
######################
|
13
|
+
|
14
|
+
# Logs
|
15
|
+
logs
|
16
|
+
*.log
|
17
|
+
npm-debug.log*
|
18
|
+
yarn-debug.log*
|
19
|
+
yarn-error.log*
|
20
|
+
lerna-debug.log*
|
21
|
+
|
22
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
23
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
24
|
+
|
25
|
+
# Runtime data
|
26
|
+
pids
|
27
|
+
*.pid
|
28
|
+
*.seed
|
29
|
+
*.pid.lock
|
30
|
+
|
31
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
32
|
+
lib-cov
|
33
|
+
|
34
|
+
# Coverage directory used by tools like istanbul
|
35
|
+
coverage
|
36
|
+
*.lcov
|
37
|
+
|
38
|
+
# nyc test coverage
|
39
|
+
.nyc_output
|
40
|
+
|
41
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
42
|
+
.grunt
|
43
|
+
|
44
|
+
# Bower dependency directory (https://bower.io/)
|
45
|
+
bower_components
|
46
|
+
|
47
|
+
# node-waf configuration
|
48
|
+
.lock-wscript
|
49
|
+
|
50
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
51
|
+
build/Release
|
52
|
+
|
53
|
+
# Dependency directories
|
54
|
+
node_modules/
|
55
|
+
jspm_packages/
|
56
|
+
|
57
|
+
# TypeScript v1 declaration files
|
58
|
+
typings/
|
59
|
+
|
60
|
+
# TypeScript cache
|
61
|
+
*.tsbuildinfo
|
62
|
+
|
63
|
+
# Optional npm cache directory
|
64
|
+
.npm
|
65
|
+
|
66
|
+
# Optional eslint cache
|
67
|
+
.eslintcache
|
68
|
+
|
69
|
+
# Microbundle cache
|
70
|
+
.rpt2_cache/
|
71
|
+
.rts2_cache_cjs/
|
72
|
+
.rts2_cache_es/
|
73
|
+
.rts2_cache_umd/
|
74
|
+
|
75
|
+
# Optional REPL history
|
76
|
+
.node_repl_history
|
77
|
+
|
78
|
+
# Output of 'npm pack'
|
79
|
+
*.tgz
|
80
|
+
|
81
|
+
# Yarn Integrity file
|
82
|
+
.yarn-integrity
|
83
|
+
|
84
|
+
# dotenv environment variables file
|
85
|
+
.env
|
86
|
+
.env.test
|
87
|
+
|
88
|
+
# parcel-bundler cache (https://parceljs.org/)
|
89
|
+
.cache
|
90
|
+
|
91
|
+
# Next.js build output
|
92
|
+
.next
|
93
|
+
|
94
|
+
# Nuxt.js build / generate output
|
95
|
+
.nuxt
|
96
|
+
dist
|
97
|
+
|
98
|
+
# Gatsby files
|
99
|
+
.cache/
|
100
|
+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
|
101
|
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
102
|
+
# public
|
103
|
+
|
104
|
+
# vuepress build output
|
105
|
+
.vuepress/dist
|
106
|
+
|
107
|
+
# Serverless directories
|
108
|
+
.serverless/
|
109
|
+
|
110
|
+
# FuseBox cache
|
111
|
+
.fusebox/
|
112
|
+
|
113
|
+
# DynamoDB Local files
|
114
|
+
.dynamodb/
|
115
|
+
|
116
|
+
# TernJS port file
|
117
|
+
.tern-port
|
package/README.md
CHANGED
@@ -1,32 +1,87 @@
|
|
1
|
-
#
|
1
|
+
# Clava MISRA Tool
|
2
2
|
|
3
|
-
A
|
3
|
+
A Clava-based library to automatically detect and correct parts of C code that violate MISRA-C:2012 coding standard.
|
4
4
|
|
5
|
-
|
5
|
+
For more details, see the [Clava Transpiler repository](https://github.com/specs-feup/clava).
|
6
6
|
|
7
|
-
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
To get started, ensure the tool's NPM package is installed in your project:
|
8
10
|
|
9
11
|
```bash
|
10
|
-
npm install
|
12
|
+
npm install @specs-feup/clava-misra
|
11
13
|
```
|
12
14
|
|
13
|
-
##
|
15
|
+
## Usage
|
14
16
|
|
15
|
-
|
17
|
+
### 1. Analysis
|
18
|
+
You can use the tool to simply check the violations by executing the following statements in your script:
|
16
19
|
|
17
|
-
```
|
18
|
-
|
20
|
+
```ts
|
21
|
+
import MISRATool from "@specs-feup/clava-misra/dist/MISRATool.js";
|
22
|
+
|
23
|
+
MISRATool.checkCompliance();
|
19
24
|
```
|
25
|
+
After analysis, each identified violation will be displayed, including its location and description.
|
20
26
|
|
21
|
-
|
27
|
+
### 2. Correction
|
28
|
+
Besides analysis, the tool can also correct the provided source code to comply with the coding guidelines, using the following statements:
|
29
|
+
|
30
|
+
```ts
|
31
|
+
import MISRATool from "@specs-feup/clava-misra/dist/MISRATool.js";
|
32
|
+
|
33
|
+
MISRATool.applyCorrections();
|
34
|
+
```
|
22
35
|
|
23
|
-
|
36
|
+
After the transformation, any violations that could not be fixed will be displayed along with their justification. The corrected files will be saved in the `woven_code` folder.
|
24
37
|
|
25
|
-
|
38
|
+
You can provide an **optional** JSON config file to assist in correcting specific rules, such as implicit function calls, disallowed functions, and missing return statements. For instance, you can:
|
39
|
+
- Define default values for certain types to address functions with missing return statements.
|
40
|
+
- Provide custom implementations for disallowed functions.
|
41
|
+
- Specify the path or library for implicit function calls.
|
26
42
|
|
27
|
-
|
28
|
-
|
43
|
+
The config file should follow this structure:
|
44
|
+
```json
|
45
|
+
{
|
46
|
+
"defaultValues": {
|
47
|
+
"unsigned int": 0,
|
48
|
+
"float": 0.0,
|
49
|
+
"enum Status": "SUCCESS",
|
50
|
+
"Color": "RED",
|
51
|
+
"my_int_type": "0"
|
52
|
+
}
|
53
|
+
}
|
54
|
+
```
|
55
|
+
**Note:** Not all fields are required and if the config file is not provided or lacks the necessary information to fix a violation, the violation will remain and be displayed as unresolved.
|
56
|
+
|
57
|
+
After preparing the config file, provide its full path to `applyCorrections` method call:
|
58
|
+
|
59
|
+
```ts
|
60
|
+
import MISRATool from "@specs-feup/clava-misra/dist/MISRATool.js";
|
61
|
+
|
62
|
+
MISRATool.applyCorrections("/full/path/to/json/config/file");
|
63
|
+
```
|
64
|
+
|
65
|
+
## Execution
|
66
|
+
|
67
|
+
To execute a project that uses this tool, you must provide the following information:
|
68
|
+
|
69
|
+
- The path to your **script file**.
|
70
|
+
- The **C standard** to use (`c90`, `c99`, or `c11`).
|
71
|
+
- The path to the **source code** to process.
|
72
|
+
|
73
|
+
```bash
|
74
|
+
npx clava classic [path/to/scriptFile.js] -pi -std [c90 | c99 | c11] -p [path/to/source/code]
|
75
|
+
```
|
76
|
+
|
77
|
+
**Example:**
|
29
78
|
|
30
79
|
```bash
|
31
|
-
|
80
|
+
npx clava classic main.js -pi -std c99 -p CxxSources/
|
32
81
|
```
|
82
|
+
|
83
|
+
To view other available options, run:
|
84
|
+
|
85
|
+
```bash
|
86
|
+
npx clava classic -dummy
|
87
|
+
```
|
package/dist/MISRA.d.ts
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
import { If, Joinpoint, Statement, Switch } from "@specs-feup/clava/api/Joinpoints.js";
|
2
|
+
export declare enum MISRATransformationType {
|
3
|
+
NoChange = 0,
|
4
|
+
DescendantChange = 1,
|
5
|
+
Replacement = 2,
|
6
|
+
Removal = 3
|
7
|
+
}
|
8
|
+
/**
|
9
|
+
* Represents an error in MISRA compliance, including the rule ID, the joinpoint where the violation occurred, and a descriptive message.
|
10
|
+
*/
|
11
|
+
export declare class MISRAError {
|
12
|
+
/**
|
13
|
+
* Represents the specific MISRA rule that was violated
|
14
|
+
*/
|
15
|
+
ruleID: string;
|
16
|
+
/**
|
17
|
+
* The joinpoint where the error was detected
|
18
|
+
*/
|
19
|
+
$jp: Joinpoint;
|
20
|
+
/**
|
21
|
+
* Explanation of the violation
|
22
|
+
*/
|
23
|
+
message: string;
|
24
|
+
/**
|
25
|
+
*
|
26
|
+
* @param ruleID - specific MISRA rule that was violated
|
27
|
+
* @param $jp - joinpoint where the error was detected
|
28
|
+
* @param message - description of the error
|
29
|
+
*/
|
30
|
+
constructor(ruleID: string, $jp: Joinpoint, message: string);
|
31
|
+
/**
|
32
|
+
* Checks if two instances of MISRAError are equal based on all properties
|
33
|
+
* @param other
|
34
|
+
* @returns Returns `true` if the errors are the same, `false` otherwise
|
35
|
+
*/
|
36
|
+
equals(other: MISRAError): boolean;
|
37
|
+
}
|
38
|
+
/**
|
39
|
+
* A report of a MISRA transformation, including the transformation type and an optional new joinpoint node.
|
40
|
+
*
|
41
|
+
* If the transformation type is `Replacement`, the `newNode` must be provided to indicate the new joinpoint.
|
42
|
+
*/
|
43
|
+
export declare class MISRATransformationReport {
|
44
|
+
/**
|
45
|
+
* The type of the MISRA transformation
|
46
|
+
*/
|
47
|
+
type: MISRATransformationType;
|
48
|
+
/**
|
49
|
+
* An optional new joinpoint node, provided if the transformation involves a replacement
|
50
|
+
*/
|
51
|
+
newNode?: Joinpoint;
|
52
|
+
/**
|
53
|
+
*
|
54
|
+
* @param type The type of the MISRA transformation
|
55
|
+
* @param newNode The new joinpoint node resulting from the transformation. Required if the transformation type is `Replacement`.
|
56
|
+
*/
|
57
|
+
constructor(type: MISRATransformationType, newNode?: Joinpoint);
|
58
|
+
}
|
59
|
+
/**
|
60
|
+
* Converts a switch statement into either consecutive statements or if statements
|
61
|
+
* - If the switch has only one clause and a default case, it is converted to consecutive statements
|
62
|
+
* - Otherwise, it is converted to if statements
|
63
|
+
*/
|
64
|
+
export declare class MISRASwitchConverter {
|
65
|
+
/**
|
66
|
+
* Converts a switch statement to consecutive statements or if statements
|
67
|
+
*
|
68
|
+
* @param switchStmt - The switch statement to convert
|
69
|
+
* @returns The converted statements or `undefined` if no statements remain
|
70
|
+
*/
|
71
|
+
static convert(switchStmt: Switch): Statement | undefined;
|
72
|
+
/**
|
73
|
+
* Converts a switch with only one clause and a default case into consecutive statements
|
74
|
+
*
|
75
|
+
* @param switchStmt - The switch statement to convert
|
76
|
+
* @returns The first statement or `undefined` if no statements remain
|
77
|
+
*/
|
78
|
+
static convertToConsecutiveStmts(switchStmt: Switch): Statement | undefined;
|
79
|
+
/**
|
80
|
+
* Converts a switch statement into a series of if statements
|
81
|
+
*
|
82
|
+
* @param switchStmt - The switch statement to convert
|
83
|
+
* @returns The first if statement created
|
84
|
+
*/
|
85
|
+
static convertToIfStatements(switchStmt: Switch): If;
|
86
|
+
/**
|
87
|
+
* Creates an if statement for the given consecutive cases
|
88
|
+
*
|
89
|
+
* @param condition - The switch condition
|
90
|
+
* @param cases - A list of consecutive cases
|
91
|
+
* @param index - The index of the current case group
|
92
|
+
* @param lastIfStmt - The last if statement, used to chain else
|
93
|
+
* @returns The new if statement
|
94
|
+
*/
|
95
|
+
private static createIfStatement;
|
96
|
+
/**
|
97
|
+
* Creates the equivalent condition for an if statement based on the case values
|
98
|
+
*
|
99
|
+
* @param condition - The switch condition
|
100
|
+
* @param cases - A list of case` statements
|
101
|
+
* @returns The combined condition
|
102
|
+
*/
|
103
|
+
private static equivalentCondition;
|
104
|
+
/**
|
105
|
+
* Removes all break statements from the given scope
|
106
|
+
* @param scope - The scope from which the break statements will be removed
|
107
|
+
*/
|
108
|
+
private static removeBreakStmts;
|
109
|
+
/**
|
110
|
+
* Removes all case statements from the given scope
|
111
|
+
* @param scope - The scope from which the case statements will be removed
|
112
|
+
*/
|
113
|
+
private static removeCases;
|
114
|
+
/**
|
115
|
+
* Groups case statements into consecutive blocks, ensuring the block with the default case is last
|
116
|
+
*
|
117
|
+
* @param switchStmt - The switch statement
|
118
|
+
* @returns The grouped case statements
|
119
|
+
*/
|
120
|
+
private static consecutiveCases;
|
121
|
+
/**
|
122
|
+
* Organizes case groups such that the group with default case is placed last.
|
123
|
+
*
|
124
|
+
* @param caseGroups - The groups of case statements
|
125
|
+
* @returns The organized case groups
|
126
|
+
*/
|
127
|
+
private static organizeCaseGroups;
|
128
|
+
}
|
129
|
+
//# sourceMappingURL=MISRA.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MISRA.d.ts","sourceRoot":"","sources":["../src/MISRA.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,EAAE,EAAE,SAAS,EAAS,SAAS,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAIjI,oBAAY,uBAAuB;IAC/B,QAAQ,IAAA;IACR,gBAAgB,IAAA;IAChB,WAAW,IAAA;IACX,OAAO,IAAA;CACV;AAED;;GAEG;AACH,qBAAa,UAAU;IACnB;;OAEG;IACI,MAAM,EAAE,MAAM,CAAC;IACtB;;OAEG;IACI,GAAG,EAAE,SAAS,CAAC;IACtB;;OAEG;IACI,OAAO,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;gBACS,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM;IAM3D;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO;CAKrC;AAED;;;;GAIG;AACH,qBAAa,yBAAyB;IAClC;;OAEG;IACH,IAAI,EAAE,uBAAuB,CAAC;IAC9B;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB;;;;OAIG;gBACS,IAAI,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,SAAS;CAOjE;AAED;;;;GAIG;AACH,qBAAa,oBAAoB;IAC7B;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAQzD;;;;;OAKG;IACH,MAAM,CAAC,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IA6B3E;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,EAAE;IAuBpD;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAahC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAgBlC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAK/B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAK1B;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAiB/B;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;CAQpC"}
|
package/dist/MISRA.js
ADDED
@@ -0,0 +1,245 @@
|
|
1
|
+
import { Break, Case } from "@specs-feup/clava/api/Joinpoints.js";
|
2
|
+
import { getNumOfSwitchClauses, isCommentStmt } from "./utils/utils.js";
|
3
|
+
import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js";
|
4
|
+
export var MISRATransformationType;
|
5
|
+
(function (MISRATransformationType) {
|
6
|
+
MISRATransformationType[MISRATransformationType["NoChange"] = 0] = "NoChange";
|
7
|
+
MISRATransformationType[MISRATransformationType["DescendantChange"] = 1] = "DescendantChange";
|
8
|
+
MISRATransformationType[MISRATransformationType["Replacement"] = 2] = "Replacement";
|
9
|
+
MISRATransformationType[MISRATransformationType["Removal"] = 3] = "Removal";
|
10
|
+
})(MISRATransformationType || (MISRATransformationType = {}));
|
11
|
+
/**
|
12
|
+
* Represents an error in MISRA compliance, including the rule ID, the joinpoint where the violation occurred, and a descriptive message.
|
13
|
+
*/
|
14
|
+
export class MISRAError {
|
15
|
+
/**
|
16
|
+
* Represents the specific MISRA rule that was violated
|
17
|
+
*/
|
18
|
+
ruleID;
|
19
|
+
/**
|
20
|
+
* The joinpoint where the error was detected
|
21
|
+
*/
|
22
|
+
$jp;
|
23
|
+
/**
|
24
|
+
* Explanation of the violation
|
25
|
+
*/
|
26
|
+
message;
|
27
|
+
/**
|
28
|
+
*
|
29
|
+
* @param ruleID - specific MISRA rule that was violated
|
30
|
+
* @param $jp - joinpoint where the error was detected
|
31
|
+
* @param message - description of the error
|
32
|
+
*/
|
33
|
+
constructor(ruleID, $jp, message) {
|
34
|
+
this.ruleID = ruleID;
|
35
|
+
this.$jp = $jp;
|
36
|
+
this.message = message;
|
37
|
+
}
|
38
|
+
/**
|
39
|
+
* Checks if two instances of MISRAError are equal based on all properties
|
40
|
+
* @param other
|
41
|
+
* @returns Returns `true` if the errors are the same, `false` otherwise
|
42
|
+
*/
|
43
|
+
equals(other) {
|
44
|
+
return this.ruleID === other.ruleID &&
|
45
|
+
this.$jp.astId === other.$jp.astId &&
|
46
|
+
this.message === other.message;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
/**
|
50
|
+
* A report of a MISRA transformation, including the transformation type and an optional new joinpoint node.
|
51
|
+
*
|
52
|
+
* If the transformation type is `Replacement`, the `newNode` must be provided to indicate the new joinpoint.
|
53
|
+
*/
|
54
|
+
export class MISRATransformationReport {
|
55
|
+
/**
|
56
|
+
* The type of the MISRA transformation
|
57
|
+
*/
|
58
|
+
type;
|
59
|
+
/**
|
60
|
+
* An optional new joinpoint node, provided if the transformation involves a replacement
|
61
|
+
*/
|
62
|
+
newNode;
|
63
|
+
/**
|
64
|
+
*
|
65
|
+
* @param type The type of the MISRA transformation
|
66
|
+
* @param newNode The new joinpoint node resulting from the transformation. Required if the transformation type is `Replacement`.
|
67
|
+
*/
|
68
|
+
constructor(type, newNode) {
|
69
|
+
this.type = type;
|
70
|
+
if (type === MISRATransformationType.Replacement && !newNode) {
|
71
|
+
throw new Error("newNode must be provided when a 'Replacement' transformation is performed");
|
72
|
+
}
|
73
|
+
this.newNode = newNode;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
/**
|
77
|
+
* Converts a switch statement into either consecutive statements or if statements
|
78
|
+
* - If the switch has only one clause and a default case, it is converted to consecutive statements
|
79
|
+
* - Otherwise, it is converted to if statements
|
80
|
+
*/
|
81
|
+
export class MISRASwitchConverter {
|
82
|
+
/**
|
83
|
+
* Converts a switch statement to consecutive statements or if statements
|
84
|
+
*
|
85
|
+
* @param switchStmt - The switch statement to convert
|
86
|
+
* @returns The converted statements or `undefined` if no statements remain
|
87
|
+
*/
|
88
|
+
static convert(switchStmt) {
|
89
|
+
if (switchStmt.hasDefaultCase && getNumOfSwitchClauses(switchStmt) < 2) { // The statements will always be executed
|
90
|
+
return this.convertToConsecutiveStmts(switchStmt);
|
91
|
+
}
|
92
|
+
else {
|
93
|
+
return this.convertToIfStatements(switchStmt);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
/**
|
97
|
+
* Converts a switch with only one clause and a default case into consecutive statements
|
98
|
+
*
|
99
|
+
* @param switchStmt - The switch statement to convert
|
100
|
+
* @returns The first statement or `undefined` if no statements remain
|
101
|
+
*/
|
102
|
+
static convertToConsecutiveStmts(switchStmt) {
|
103
|
+
const scope = switchStmt.children[1];
|
104
|
+
this.removeBreakStmts(scope);
|
105
|
+
this.removeCases(scope);
|
106
|
+
// If there are no statements except break and comments, the switch can be removed
|
107
|
+
if (scope.children.length === 0 || scope.children.every(stmt => isCommentStmt(stmt))) {
|
108
|
+
switchStmt.detach();
|
109
|
+
return undefined;
|
110
|
+
}
|
111
|
+
let firstStmt, lastStmt;
|
112
|
+
const stmts = scope.children;
|
113
|
+
for (let i = 0; i < stmts.length; i++) {
|
114
|
+
const stmt = stmts[i];
|
115
|
+
stmt.detach();
|
116
|
+
if (!firstStmt) {
|
117
|
+
firstStmt = stmt;
|
118
|
+
switchStmt.replaceWith(firstStmt);
|
119
|
+
lastStmt = stmt;
|
120
|
+
continue;
|
121
|
+
}
|
122
|
+
lastStmt.insertAfter(stmt);
|
123
|
+
lastStmt = stmt;
|
124
|
+
}
|
125
|
+
return firstStmt;
|
126
|
+
}
|
127
|
+
/**
|
128
|
+
* Converts a switch statement into a series of if statements
|
129
|
+
*
|
130
|
+
* @param switchStmt - The switch statement to convert
|
131
|
+
* @returns The first if statement created
|
132
|
+
*/
|
133
|
+
static convertToIfStatements(switchStmt) {
|
134
|
+
const scope = switchStmt.children[1];
|
135
|
+
const consecutiveCases = this.consecutiveCases(switchStmt);
|
136
|
+
this.removeBreakStmts(scope);
|
137
|
+
let ifStmt;
|
138
|
+
let lastIfStmt;
|
139
|
+
for (let i = 0; i < consecutiveCases.length; i++) {
|
140
|
+
const cases = consecutiveCases[i];
|
141
|
+
if (cases.some(caseStmt => caseStmt.isDefault)) { // Has default case
|
142
|
+
lastIfStmt.setElse(ClavaJoinPoints.scope(...cases[cases.length - 1].instructions));
|
143
|
+
}
|
144
|
+
else {
|
145
|
+
lastIfStmt = this.createIfStatement(switchStmt.condition, cases, i, lastIfStmt);
|
146
|
+
if (i === 0) {
|
147
|
+
ifStmt = lastIfStmt;
|
148
|
+
}
|
149
|
+
}
|
150
|
+
}
|
151
|
+
switchStmt.replaceWith(ifStmt);
|
152
|
+
return ifStmt;
|
153
|
+
}
|
154
|
+
/**
|
155
|
+
* Creates an if statement for the given consecutive cases
|
156
|
+
*
|
157
|
+
* @param condition - The switch condition
|
158
|
+
* @param cases - A list of consecutive cases
|
159
|
+
* @param index - The index of the current case group
|
160
|
+
* @param lastIfStmt - The last if statement, used to chain else
|
161
|
+
* @returns The new if statement
|
162
|
+
*/
|
163
|
+
static createIfStatement(condition, cases, index, lastIfStmt) {
|
164
|
+
const conditionExpr = this.equivalentCondition(condition, cases);
|
165
|
+
const thenBody = ClavaJoinPoints.scope(...cases[cases.length - 1].instructions);
|
166
|
+
const newIfStmt = ClavaJoinPoints.ifStmt(conditionExpr, thenBody);
|
167
|
+
if (index === 0) {
|
168
|
+
return newIfStmt;
|
169
|
+
}
|
170
|
+
else {
|
171
|
+
lastIfStmt.setElse(newIfStmt);
|
172
|
+
return newIfStmt;
|
173
|
+
}
|
174
|
+
}
|
175
|
+
/**
|
176
|
+
* Creates the equivalent condition for an if statement based on the case values
|
177
|
+
*
|
178
|
+
* @param condition - The switch condition
|
179
|
+
* @param cases - A list of case` statements
|
180
|
+
* @returns The combined condition
|
181
|
+
*/
|
182
|
+
static equivalentCondition(condition, cases) {
|
183
|
+
let lastBinaryOp;
|
184
|
+
for (let i = 0; i < cases.length; i++) {
|
185
|
+
const caseStmt = cases[i];
|
186
|
+
const newBinaryOp = ClavaJoinPoints.binaryOp("==", condition, caseStmt.values[0]);
|
187
|
+
if (i === 0) {
|
188
|
+
lastBinaryOp = newBinaryOp;
|
189
|
+
continue;
|
190
|
+
}
|
191
|
+
lastBinaryOp = ClavaJoinPoints.binaryOp("||", lastBinaryOp, newBinaryOp);
|
192
|
+
}
|
193
|
+
return lastBinaryOp;
|
194
|
+
}
|
195
|
+
/**
|
196
|
+
* Removes all break statements from the given scope
|
197
|
+
* @param scope - The scope from which the break statements will be removed
|
198
|
+
*/
|
199
|
+
static removeBreakStmts(scope) {
|
200
|
+
const breakStmts = scope.children.filter(child => child instanceof Break);
|
201
|
+
breakStmts.forEach(stmt => stmt.detach());
|
202
|
+
}
|
203
|
+
/**
|
204
|
+
* Removes all case statements from the given scope
|
205
|
+
* @param scope - The scope from which the case statements will be removed
|
206
|
+
*/
|
207
|
+
static removeCases(scope) {
|
208
|
+
const cases = scope.children.filter(child => child instanceof Case);
|
209
|
+
cases.forEach(caseStmt => caseStmt.detach());
|
210
|
+
}
|
211
|
+
/**
|
212
|
+
* Groups case statements into consecutive blocks, ensuring the block with the default case is last
|
213
|
+
*
|
214
|
+
* @param switchStmt - The switch statement
|
215
|
+
* @returns The grouped case statements
|
216
|
+
*/
|
217
|
+
static consecutiveCases(switchStmt) {
|
218
|
+
let caseGroups = [];
|
219
|
+
let currentList = [];
|
220
|
+
for (const caseStmt of switchStmt.cases) {
|
221
|
+
currentList.push(caseStmt);
|
222
|
+
if (caseStmt.instructions.length !== 0) { // Has no consecutive case
|
223
|
+
caseGroups.push(currentList);
|
224
|
+
currentList = [];
|
225
|
+
}
|
226
|
+
}
|
227
|
+
// Ensure the block containing the default case is placed at the last position
|
228
|
+
return this.organizeCaseGroups(caseGroups);
|
229
|
+
}
|
230
|
+
/**
|
231
|
+
* Organizes case groups such that the group with default case is placed last.
|
232
|
+
*
|
233
|
+
* @param caseGroups - The groups of case statements
|
234
|
+
* @returns The organized case groups
|
235
|
+
*/
|
236
|
+
static organizeCaseGroups(caseGroups) {
|
237
|
+
const nonDefaultGroups = caseGroups.filter(block => !block.some(caseStmt => caseStmt.isDefault));
|
238
|
+
const defaultBlock = caseGroups.find(block => block.some(caseStmt => caseStmt.isDefault));
|
239
|
+
if (defaultBlock) {
|
240
|
+
nonDefaultGroups.push(defaultBlock);
|
241
|
+
}
|
242
|
+
return nonDefaultGroups;
|
243
|
+
}
|
244
|
+
}
|
245
|
+
//# sourceMappingURL=MISRA.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MISRA.js","sourceRoot":"","sources":["../src/MISRA.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,EAAE,IAAI,EAAuD,MAAM,qCAAqC,CAAC;AACjI,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,eAAe,MAAM,gDAAgD,CAAC;AAE7E,MAAM,CAAN,IAAY,uBAKX;AALD,WAAY,uBAAuB;IAC/B,6EAAQ,CAAA;IACR,6FAAgB,CAAA;IAChB,mFAAW,CAAA;IACX,2EAAO,CAAA;AACX,CAAC,EALW,uBAAuB,KAAvB,uBAAuB,QAKlC;AAED;;GAEG;AACH,MAAM,OAAO,UAAU;IACnB;;OAEG;IACI,MAAM,CAAS;IACtB;;OAEG;IACI,GAAG,CAAY;IACtB;;OAEG;IACI,OAAO,CAAS;IAEvB;;;;;OAKG;IACH,YAAY,MAAc,EAAE,GAAc,EAAE,OAAe;QACvD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC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AC9B,IAAI,WAAW,GAAW,EAAE,CAAC;QAE7B,KAAK,MAAM,QAAQ,IAAI,UAAU,CAAC,KAAK,EAAE,CAAC;YACtC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAE3B,IAAI,QAAQ,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC,CAAC,0BAA0B;gBAChE,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBAC7B,WAAW,GAAG,EAAE,CAAC;YACrB,CAAC;QACL,CAAC;QAED,8EAA8E;QAC9E,OAAO,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;OAKG;IACK,MAAM,CAAC,kBAAkB,CAAC,UAAoB;QAClD,MAAM,gBAAgB,GAAG,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;QACjG,MAAM,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;QAC1F,IAAI,YAAY,EAAE,CAAC;YACf,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACxC,CAAC;QACD,OAAO,gBAAgB,CAAC;IAC5B,CAAC;CACJ"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { Joinpoint } from "@specs-feup/clava/api/Joinpoints.js";
|
2
|
+
import { MISRAError } from "./MISRA.js";
|
3
|
+
/**
|
4
|
+
* Tracks MISRA errors and warnings during the analysis and/or transformation of the code.
|
5
|
+
* Also generated unique variable and function names.
|
6
|
+
*/
|
7
|
+
export default class MISRAContext {
|
8
|
+
#private;
|
9
|
+
get errors(): MISRAError[];
|
10
|
+
get warnings(): MISRAError[];
|
11
|
+
get config(): Map<string, any> | undefined;
|
12
|
+
set config(configFilePath: string);
|
13
|
+
generateVarName(): string;
|
14
|
+
generateFuncName(): string;
|
15
|
+
generateHeaderFilename(): string;
|
16
|
+
addMISRAError(ruleID: string, $jp: Joinpoint, message: string): void;
|
17
|
+
addMISRAWarning(ruleID: string, $jp: Joinpoint, message: string): void;
|
18
|
+
printErrors(): void;
|
19
|
+
printWarnings(): void;
|
20
|
+
}
|
21
|
+
//# sourceMappingURL=MISRAContext.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MISRAContext.d.ts","sourceRoot":"","sources":["../src/MISRAContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,YAAY;;IAuB7B,IAAI,MAAM,IAAI,UAAU,EAAE,CAEzB;IAED,IAAI,QAAQ,IAAI,UAAU,EAAE,CAE3B;IAED,IAAI,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAEzC;IAED,IAAI,MAAM,CAAC,cAAc,EAAE,MAAM,EAQhC;IAED,eAAe;IAIf,gBAAgB;IAIhB,sBAAsB;IAItB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM;IAQ7D,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM;IAQ/D,WAAW;IAKX,aAAa;CAIhB"}
|