@specs-feup/clava-misra 1.0.0 → 1.0.1
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 +40 -8
- package/src/MISRA.ts +266 -0
- package/src/MISRAContext.ts +91 -0
- package/src/MISRARule.ts +77 -0
- package/src/MISRATool.ts +96 -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 +40 -0
- package/src/rules/Section16_SwitchStatements/Rule_16_3_UnconditionalBreak.ts +69 -0
- package/src/rules/Section16_SwitchStatements/Rule_16_4_SwitchHasDefault.ts +46 -0
- package/src/rules/Section16_SwitchStatements/Rule_16_5_DefaultFirstOrLast.ts +113 -0
- package/src/rules/Section16_SwitchStatements/Rule_16_6_SwitchMinTwoClauses.ts +57 -0
- package/src/rules/Section16_SwitchStatements/Rule_16_7_NonBooleanSwitchCondition.ts +56 -0
- package/src/rules/Section17_Functions/Rule_17_4_NonVoidReturn.ts +78 -0
- package/src/rules/Section17_Functions/Rule_17_6_StaticArraySizeParam.ts +68 -0
- package/src/rules/Section17_Functions/Rule_17_7_UnusedReturnValue.ts +47 -0
- package/src/rules/Section20-PreprocessingDirectives/Rule_20_2_InvalidHeaderFileName.ts +120 -0
- package/src/rules/Section2_UnusedCode/Rule_2_3_UnusedTypeDecl.ts +75 -0
- package/src/rules/Section2_UnusedCode/Rule_2_4_UnusedTagDecl.ts +60 -0
- package/src/rules/Section2_UnusedCode/Rule_2_6_UnusedLabels.ts +46 -0
- package/src/rules/Section2_UnusedCode/Rule_2_7_UnusedParameters.ts +65 -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 +40 -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_4_NonVoidReturn.test.ts +85 -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 +10 -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 +39 -0
- package/src/utils/utils.ts +221 -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
@@ -1,46 +0,0 @@
|
|
1
|
-
import MISRAReporter from "../MISRAReporter.js";
|
2
|
-
import S17_FunctionPass from "../passes/S17_FunctionPass.js";
|
3
|
-
import Query from "@specs-feup/lara/api/weaver/Query.js";
|
4
|
-
import { FileJp, Joinpoint } from "@specs-feup/clava/api/Joinpoints.js";
|
5
|
-
import { expectNumberOfErrors, registerSourceCode, TestFile } from "./utils.js";
|
6
|
-
|
7
|
-
const passingCode = `int g() {
|
8
|
-
return 5;
|
9
|
-
}
|
10
|
-
|
11
|
-
int main(int argc, char *argv[]) {
|
12
|
-
(void)g();
|
13
|
-
|
14
|
-
return 0;
|
15
|
-
}`;
|
16
|
-
|
17
|
-
const failingCode = `#include <stdarg.h>
|
18
|
-
|
19
|
-
int f() {
|
20
|
-
return 5;
|
21
|
-
}
|
22
|
-
|
23
|
-
int test(int argc, char *argv[]) {
|
24
|
-
f();
|
25
|
-
|
26
|
-
return 0;
|
27
|
-
}`;
|
28
|
-
|
29
|
-
const files: TestFile[] = [
|
30
|
-
{name: "bad.cpp", code: failingCode},
|
31
|
-
{name: "good.cpp", code: passingCode}
|
32
|
-
]
|
33
|
-
|
34
|
-
describe("Expressions", () => {
|
35
|
-
const reporter = new MISRAReporter();
|
36
|
-
const pass = new S17_FunctionPass(true, [1, 7]);
|
37
|
-
registerSourceCode(files);
|
38
|
-
|
39
|
-
it("should pass", () => {
|
40
|
-
expectNumberOfErrors(reporter, pass, 0, Query.search(FileJp, {name: "good.cpp"}).first() as Joinpoint);
|
41
|
-
});
|
42
|
-
|
43
|
-
it("should fail", () => {
|
44
|
-
expectNumberOfErrors(reporter, pass, 2, Query.search(FileJp, {name: "bad.cpp"}).first() as Joinpoint);
|
45
|
-
});
|
46
|
-
});
|
@@ -1,167 +0,0 @@
|
|
1
|
-
import MISRAReporter from "../MISRAReporter.js";
|
2
|
-
import S18_PointersArraysPass from "../passes/S18_PointersArraysPass.js";
|
3
|
-
import Query from "@specs-feup/lara/api/weaver/Query.js";
|
4
|
-
import { FileJp, Joinpoint } from "@specs-feup/clava/api/Joinpoints.js";
|
5
|
-
import { expectNumberOfErrors, registerSourceCode, TestFile } from "./utils.js";
|
6
|
-
|
7
|
-
const passingArithmetic = `void fn1 ( void )
|
8
|
-
{
|
9
|
-
int a[ 10 ];
|
10
|
-
int *ptr;
|
11
|
-
int index = 0U;
|
12
|
-
index = index + 1U; /* Compliant - rule only applies to pointers */
|
13
|
-
a[ index ] = 0U; /* Compliant */
|
14
|
-
ptr = &a[ 5 ]; /* Compliant */
|
15
|
-
ptr = a;
|
16
|
-
ptr++; /* Compliant - increment operator not + */
|
17
|
-
//*( ptr + 5 ) = 0U; /* Non-compliant */
|
18
|
-
ptr[ 5 ] = 0U; /* Compliant */
|
19
|
-
}
|
20
|
-
|
21
|
-
void fn3 ( int *p1, int p2[ ] )
|
22
|
-
{
|
23
|
-
p1++; /* Compliant */
|
24
|
-
//p1 = p1 + 5; /* Non-compliant */
|
25
|
-
p1[ 5 ] = 0U; /* Compliant */
|
26
|
-
p2++; /* Compliant */
|
27
|
-
//p2 = p2 + 3; /* Non-compliant */
|
28
|
-
p2[ 3 ] = 0U; /* Compliant */
|
29
|
-
}`;
|
30
|
-
|
31
|
-
const failingArithmetic = `void fn1 ( void )
|
32
|
-
{
|
33
|
-
int a[ 10 ];
|
34
|
-
int *ptr;
|
35
|
-
int index = 0U;
|
36
|
-
index = index + 1U; /* Compliant - rule only applies to pointers */
|
37
|
-
a[ index ] = 0U; /* Compliant */
|
38
|
-
ptr = &a[ 5 ]; /* Compliant */
|
39
|
-
ptr = a;
|
40
|
-
ptr++; /* Compliant - increment operator not + */
|
41
|
-
*( ptr + 5 ) = 0U; /* Non-compliant */
|
42
|
-
ptr[ 5 ] = 0U; /* Compliant */
|
43
|
-
}
|
44
|
-
|
45
|
-
void fn3 ( int *p1, int p2[ ] )
|
46
|
-
{
|
47
|
-
p1++; /* Compliant */
|
48
|
-
p1 = p1 + 5; /* Non-compliant */
|
49
|
-
p1[ 5 ] = 0U; /* Compliant */
|
50
|
-
p2++; /* Compliant */
|
51
|
-
p2 = p2 + 3; /* Non-compliant */
|
52
|
-
p2[ 3 ] = 0U; /* Compliant */
|
53
|
-
}`;
|
54
|
-
|
55
|
-
const passingDepth = ``;
|
56
|
-
|
57
|
-
const failingDepth = `typedef int * INTPTR;
|
58
|
-
void function ( int ** arrPar[ ] ) /* Non-compliant */
|
59
|
-
{
|
60
|
-
int ** obj2; /* Compliant */
|
61
|
-
int *** obj3; /* Non-compliant */
|
62
|
-
INTPTR * obj4; /* Compliant */
|
63
|
-
INTPTR * const * const obj5 = 0; /* Non-compliant */
|
64
|
-
int ** arr[ 10 ]; /* Compliant */
|
65
|
-
int ** ( *parr )[ 10 ]; /* Compliant */
|
66
|
-
int * ( **pparr )[ 10 ]; /* Compliant */
|
67
|
-
}
|
68
|
-
struct s
|
69
|
-
{
|
70
|
-
int * s1; /* Compliant */
|
71
|
-
int ** s2; /* Compliant */
|
72
|
-
int *** s3; /* Non-compliant */
|
73
|
-
};
|
74
|
-
struct s * ps1; /* Compliant */
|
75
|
-
struct s ** ps2; /* Compliant */
|
76
|
-
struct s *** ps3; /* Non-compliant */
|
77
|
-
int ** ( *pfunc1 )( void ); /* Compliant */
|
78
|
-
int ** ( **pfunc2 )( void ); /* Compliant */
|
79
|
-
int ** ( ***pfunc3 )( void ); /* Non-compliant */
|
80
|
-
int *** ( **pfunc4 )( void ); /* Non-compliant */`;
|
81
|
-
|
82
|
-
const failingSizes = `struct s
|
83
|
-
{
|
84
|
-
unsigned short len;
|
85
|
-
unsigned int data[ ]; /* Non-compliant - flexible array member */
|
86
|
-
} str;
|
87
|
-
|
88
|
-
void f ( void )
|
89
|
-
{
|
90
|
-
int n = 5;
|
91
|
-
typedef int Vector[ n ]; /* An array type with 5 elements */
|
92
|
-
n = 7;
|
93
|
-
Vector a1; /* An array type with 5 elements */
|
94
|
-
int a2[ n ]; /* An array type with 7 elements */
|
95
|
-
}`;
|
96
|
-
|
97
|
-
const passingSizes = `struct s
|
98
|
-
{
|
99
|
-
unsigned short len;
|
100
|
-
unsigned int data[ 6 ];
|
101
|
-
} str;
|
102
|
-
|
103
|
-
void f ( void )
|
104
|
-
{
|
105
|
-
int n = 5;
|
106
|
-
typedef int Vector[ 5 ]; /* An array type with 5 elements */
|
107
|
-
n = 7;
|
108
|
-
Vector a1; /* An array type with 5 elements */
|
109
|
-
int a2[ 7 ]; /* An array type with 7 elements */
|
110
|
-
}`;
|
111
|
-
|
112
|
-
const arithmeticFiles: TestFile[] = [
|
113
|
-
{name: "badarithmetic.cpp", code: failingArithmetic},
|
114
|
-
{name: "goodarithmetic.cpp", code: passingArithmetic}
|
115
|
-
];
|
116
|
-
|
117
|
-
const depthFiles: TestFile[] = [
|
118
|
-
{name: "baddepth.cpp", code: failingDepth},
|
119
|
-
{name: "gooddepth.cpp", code: passingDepth}
|
120
|
-
];
|
121
|
-
|
122
|
-
const sizeFiles: TestFile[] = [
|
123
|
-
{name: "goodsizes.cpp", code: passingSizes},
|
124
|
-
{name: "badsizes.cpp", code: failingSizes}
|
125
|
-
];
|
126
|
-
|
127
|
-
describe("Pointers and arrays: arithmetic", () => {
|
128
|
-
const reporter = new MISRAReporter();
|
129
|
-
const pass = new S18_PointersArraysPass(true, [4]);
|
130
|
-
registerSourceCode(arithmeticFiles);
|
131
|
-
|
132
|
-
it("should pass", () => {
|
133
|
-
expectNumberOfErrors(reporter, pass, 0, Query.search(FileJp, {name: "goodarithmetic.cpp"}).first() as Joinpoint);
|
134
|
-
});
|
135
|
-
|
136
|
-
it("should fail", () => {
|
137
|
-
expectNumberOfErrors(reporter, pass, 3, Query.search(FileJp, {name: "badarithmetic.cpp"}).first() as Joinpoint);
|
138
|
-
});
|
139
|
-
});
|
140
|
-
|
141
|
-
describe("Pointers and arrays: declaration depth", () => {
|
142
|
-
const reporter = new MISRAReporter();
|
143
|
-
const pass = new S18_PointersArraysPass(true, [5]);
|
144
|
-
registerSourceCode(depthFiles);
|
145
|
-
|
146
|
-
it("should pass", () => {
|
147
|
-
expectNumberOfErrors(reporter, pass, 0, Query.search(FileJp, {name: "gooddepth.cpp"}).first() as Joinpoint);
|
148
|
-
});
|
149
|
-
|
150
|
-
it("should fail", () => {
|
151
|
-
expectNumberOfErrors(reporter, pass, 7, Query.search(FileJp, {name: "baddepth.cpp"}).first() as Joinpoint);
|
152
|
-
});
|
153
|
-
});
|
154
|
-
|
155
|
-
describe("Pointers and arrays: variable size", () => {
|
156
|
-
const reporter = new MISRAReporter();
|
157
|
-
const pass = new S18_PointersArraysPass(true, [7,8]);
|
158
|
-
registerSourceCode(sizeFiles);
|
159
|
-
|
160
|
-
it("should pass", () => {
|
161
|
-
expectNumberOfErrors(reporter, pass, 0, Query.search(FileJp, {name: "goodsizes.cpp"}).first() as Joinpoint);
|
162
|
-
});
|
163
|
-
|
164
|
-
it("should fail", () => {
|
165
|
-
expectNumberOfErrors(reporter, pass, 3, Query.search(FileJp, {name: "badsizes.cpp"}).first() as Joinpoint);
|
166
|
-
});
|
167
|
-
});
|
@@ -1,38 +0,0 @@
|
|
1
|
-
import MISRAReporter from "../MISRAReporter.js";
|
2
|
-
import S19_OverlappingStoragePass from "../passes/S19_OverlappingStoragePass.js";
|
3
|
-
import Query from "@specs-feup/lara/api/weaver/Query.js";
|
4
|
-
import { FileJp, Joinpoint } from "@specs-feup/clava/api/Joinpoints.js";
|
5
|
-
import { expectNumberOfErrors, registerSourceCode, TestFile } from "./utils.js";
|
6
|
-
|
7
|
-
const passingCode = `struct a {
|
8
|
-
int a;
|
9
|
-
int b;
|
10
|
-
};
|
11
|
-
|
12
|
-
int main(int argc, char *argv[]) {
|
13
|
-
return 0;
|
14
|
-
}`;
|
15
|
-
|
16
|
-
const failingCode = `union a {
|
17
|
-
int a;
|
18
|
-
int b;
|
19
|
-
};`;
|
20
|
-
|
21
|
-
const files: TestFile[] = [
|
22
|
-
{name: "bad.cpp", code: failingCode},
|
23
|
-
{name: "good.cpp", code: passingCode}
|
24
|
-
]
|
25
|
-
|
26
|
-
describe("Expressions", () => {
|
27
|
-
const reporter = new MISRAReporter();
|
28
|
-
const pass = new S19_OverlappingStoragePass(true, [2]);
|
29
|
-
registerSourceCode(files);
|
30
|
-
|
31
|
-
it("should pass", () => {
|
32
|
-
expectNumberOfErrors(reporter, pass, 0, Query.search(FileJp, {name: "good.cpp"}).first() as Joinpoint);
|
33
|
-
});
|
34
|
-
|
35
|
-
it("should fail", () => {
|
36
|
-
expectNumberOfErrors(reporter, pass, 1, Query.search(FileJp, {name: "bad.cpp"}).first() as Joinpoint);
|
37
|
-
});
|
38
|
-
});
|
@@ -1,36 +0,0 @@
|
|
1
|
-
import MISRAReporter from "../MISRAReporter.js";
|
2
|
-
import S3_CommentPass from "../passes/S3_CommentPass.js";
|
3
|
-
import Query from "@specs-feup/lara/api/weaver/Query.js";
|
4
|
-
import { FileJp, Joinpoint } from "@specs-feup/clava/api/Joinpoints.js";
|
5
|
-
import { expectNumberOfErrors, registerSourceCode, TestFile } from "./utils.js";
|
6
|
-
|
7
|
-
const passingCode = `int main(int argc, char *argv[]) {
|
8
|
-
int x, y, z;//good inline comment
|
9
|
-
//good comment
|
10
|
-
return 0;
|
11
|
-
}`;
|
12
|
-
|
13
|
-
const failingCode = `int test(int argc, char *argv[]) {
|
14
|
-
int x, y, z; //bad inl//ine comment
|
15
|
-
//bad /*comment
|
16
|
-
return 0;
|
17
|
-
}`;
|
18
|
-
|
19
|
-
const files: TestFile[] = [
|
20
|
-
{name: "bad.cpp", code: failingCode},
|
21
|
-
{name: "good.cpp", code: passingCode}
|
22
|
-
]
|
23
|
-
|
24
|
-
describe("Expressions", () => {
|
25
|
-
const reporter = new MISRAReporter();
|
26
|
-
const pass = new S3_CommentPass(true, [3]);
|
27
|
-
registerSourceCode(files);
|
28
|
-
|
29
|
-
it("should pass", () => {
|
30
|
-
expectNumberOfErrors(reporter, pass, 0, Query.search(FileJp, {name: "good.cpp"}).first() as Joinpoint);
|
31
|
-
});
|
32
|
-
|
33
|
-
it("should fail", () => {
|
34
|
-
expectNumberOfErrors(reporter, pass, 2, Query.search(FileJp, {name: "bad.cpp"}).first() as Joinpoint);
|
35
|
-
});
|
36
|
-
});
|
@@ -1,36 +0,0 @@
|
|
1
|
-
import MISRAReporter from "../MISRAReporter.js";
|
2
|
-
import S6_TypePass from "../passes/S6_TypePass.js";
|
3
|
-
import Query from "@specs-feup/lara/api/weaver/Query.js";
|
4
|
-
import { FileJp, Joinpoint } from "@specs-feup/clava/api/Joinpoints.js";
|
5
|
-
import { expectNumberOfErrors, registerSourceCode, TestFile } from "./utils.js";
|
6
|
-
|
7
|
-
const passingCode = `struct good {
|
8
|
-
int a:4;
|
9
|
-
int:1;
|
10
|
-
unsigned int b:8;
|
11
|
-
};`;
|
12
|
-
|
13
|
-
const failingCode = `struct good {
|
14
|
-
int a:4;
|
15
|
-
int c:1;
|
16
|
-
unsigned int b:8;
|
17
|
-
};`;
|
18
|
-
|
19
|
-
const files: TestFile[] = [
|
20
|
-
{name: "bad.cpp", code: failingCode},
|
21
|
-
{name: "good.cpp", code: passingCode}
|
22
|
-
]
|
23
|
-
|
24
|
-
describe("Expressions", () => {
|
25
|
-
const reporter = new MISRAReporter();
|
26
|
-
const pass = new S6_TypePass(true, [2]);
|
27
|
-
registerSourceCode(files);
|
28
|
-
|
29
|
-
it("should pass", () => {
|
30
|
-
expectNumberOfErrors(reporter, pass, 0, Query.search(FileJp, {name: "good.cpp"}).first() as Joinpoint);
|
31
|
-
});
|
32
|
-
|
33
|
-
it("should fail", () => {
|
34
|
-
expectNumberOfErrors(reporter, pass, 1, Query.search(FileJp, {name: "bad.cpp"}).first() as Joinpoint);
|
35
|
-
});
|
36
|
-
});
|
@@ -1,48 +0,0 @@
|
|
1
|
-
import MISRAReporter from "../MISRAReporter.js";
|
2
|
-
import S7_LiteralsConstantsPass from "../passes/S7_LiteralsConstantsPass.js";
|
3
|
-
import Query from "@specs-feup/lara/api/weaver/Query.js";
|
4
|
-
import { FileJp, Joinpoint } from "@specs-feup/clava/api/Joinpoints.js";
|
5
|
-
import { expectNumberOfErrors, registerSourceCode, TestFile } from "./utils.js";
|
6
|
-
|
7
|
-
const passingCode = `void bar(const char* s) {
|
8
|
-
return;
|
9
|
-
}
|
10
|
-
|
11
|
-
const char* foo() {
|
12
|
-
const char* s = "hello world";
|
13
|
-
int a = 12;
|
14
|
-
long b = 42L;
|
15
|
-
bar("bad call");
|
16
|
-
return "bye world";
|
17
|
-
}`;
|
18
|
-
|
19
|
-
const failingCode = `void bar(char* s) {
|
20
|
-
return;
|
21
|
-
}
|
22
|
-
|
23
|
-
char* foo() {
|
24
|
-
char* s = "hello world";
|
25
|
-
int a = 014;
|
26
|
-
long b = 42l;
|
27
|
-
bar("bad call");
|
28
|
-
return "bye world";
|
29
|
-
}`;
|
30
|
-
|
31
|
-
const files: TestFile[] = [
|
32
|
-
{name: "bad.cpp", code: failingCode},
|
33
|
-
{name: "good.cpp", code: passingCode}
|
34
|
-
]
|
35
|
-
|
36
|
-
describe("Expressions", () => {
|
37
|
-
const reporter = new MISRAReporter();
|
38
|
-
const pass = new S7_LiteralsConstantsPass(true, [1, 3, 4]);
|
39
|
-
registerSourceCode(files);
|
40
|
-
|
41
|
-
it("should pass", () => {
|
42
|
-
expectNumberOfErrors(reporter, pass, 0, Query.search(FileJp, {name: "good.cpp"}).first() as Joinpoint);
|
43
|
-
});
|
44
|
-
|
45
|
-
it("should fail", () => {
|
46
|
-
expectNumberOfErrors(reporter, pass, 5, Query.search(FileJp, {name: "bad.cpp"}).first() as Joinpoint);
|
47
|
-
});
|
48
|
-
});
|
package/src/misra/tests/utils.ts
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
import AggregatePassResult from "@specs-feup/lara/api/lara/pass/results/AggregatePassResult.js";
|
2
|
-
import MISRAPassResult from "../MISRAPassResult.js";
|
3
|
-
import MISRAReporter from "../MISRAReporter.js";
|
4
|
-
import MISRAPass from "../MISRAPass.js";
|
5
|
-
import { Joinpoint } from "@specs-feup/clava/api/Joinpoints.js";
|
6
|
-
import Clava from "@specs-feup/clava/api/clava/Clava.js";
|
7
|
-
import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js";
|
8
|
-
|
9
|
-
function countErrors($passResult: AggregatePassResult): number {
|
10
|
-
let count = 0;
|
11
|
-
$passResult.results.forEach(res => {
|
12
|
-
const misraRes = res as MISRAPassResult;
|
13
|
-
count += misraRes.reports.length;
|
14
|
-
});
|
15
|
-
|
16
|
-
return count;
|
17
|
-
}
|
18
|
-
|
19
|
-
export function expectNumberOfErrors($reporter: MISRAReporter, $pass: MISRAPass, $errors: number, $jp: Joinpoint) {
|
20
|
-
const result = $reporter.applyPass($pass, $jp);
|
21
|
-
if (!result) {
|
22
|
-
expect($errors).toBe(0);
|
23
|
-
return;
|
24
|
-
}
|
25
|
-
expect(countErrors(result)).toBe($errors);
|
26
|
-
}
|
27
|
-
|
28
|
-
export interface TestFile {
|
29
|
-
name: string,
|
30
|
-
code: string
|
31
|
-
}
|
32
|
-
|
33
|
-
export function registerSourceCode(files: TestFile[]): void {
|
34
|
-
beforeAll(() => {
|
35
|
-
Clava.getProgram().push();
|
36
|
-
const program = Clava.getProgram();
|
37
|
-
files.forEach(file => {
|
38
|
-
const sourceFile = ClavaJoinPoints.fileWithSource(file.name, file.code);
|
39
|
-
program.addFile(sourceFile);
|
40
|
-
});
|
41
|
-
program.rebuild();
|
42
|
-
});
|
43
|
-
|
44
|
-
afterAll(() => {
|
45
|
-
Clava.getProgram().pop();
|
46
|
-
});
|
47
|
-
}
|
package/types_with_templates.txt
DELETED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|