@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.
Files changed (352) hide show
  1. package/.gitignore +117 -0
  2. package/README.md +70 -15
  3. package/dist/MISRA.d.ts +129 -0
  4. package/dist/MISRA.d.ts.map +1 -0
  5. package/dist/MISRA.js +245 -0
  6. package/dist/MISRA.js.map +1 -0
  7. package/dist/MISRAContext.d.ts +21 -0
  8. package/dist/MISRAContext.d.ts.map +1 -0
  9. package/dist/MISRAContext.js +75 -0
  10. package/dist/MISRAContext.js.map +1 -0
  11. package/dist/MISRARule.d.ts +56 -0
  12. package/dist/MISRARule.d.ts.map +1 -0
  13. package/dist/MISRARule.js +45 -0
  14. package/dist/MISRARule.js.map +1 -0
  15. package/dist/MISRATool.d.ts +12 -0
  16. package/dist/MISRATool.d.ts.map +1 -0
  17. package/dist/MISRATool.js +84 -0
  18. package/dist/MISRATool.js.map +1 -0
  19. package/dist/foo.d.ts +2 -0
  20. package/dist/foo.d.ts.map +1 -0
  21. package/{src/foo.ts → dist/foo.js} +3 -2
  22. package/dist/foo.js.map +1 -0
  23. package/dist/main.d.ts +2 -0
  24. package/dist/main.d.ts.map +1 -0
  25. package/dist/main.js +5 -0
  26. package/dist/main.js.map +1 -0
  27. package/dist/misra/MISRAAnalyser.d.ts +14 -0
  28. package/dist/misra/MISRAAnalyser.d.ts.map +1 -0
  29. package/{src/misra/MISRAAnalyser.ts → dist/misra/MISRAAnalyser.js} +13 -23
  30. package/dist/misra/MISRAAnalyser.js.map +1 -0
  31. package/dist/misra/MISRAPass.d.ts +27 -0
  32. package/dist/misra/MISRAPass.d.ts.map +1 -0
  33. package/dist/misra/MISRAPass.js +60 -0
  34. package/dist/misra/MISRAPass.js.map +1 -0
  35. package/dist/misra/MISRAPassResult.d.ts +13 -0
  36. package/dist/misra/MISRAPassResult.d.ts.map +1 -0
  37. package/dist/misra/MISRAPassResult.js +11 -0
  38. package/dist/misra/MISRAPassResult.js.map +1 -0
  39. package/dist/misra/MISRAReporter.d.ts +20 -0
  40. package/dist/misra/MISRAReporter.d.ts.map +1 -0
  41. package/dist/misra/MISRAReporter.js +43 -0
  42. package/dist/misra/MISRAReporter.js.map +1 -0
  43. package/dist/misra/passes/S10_EssentialTypePass.d.ts +42 -0
  44. package/dist/misra/passes/S10_EssentialTypePass.d.ts.map +1 -0
  45. package/dist/misra/passes/S10_EssentialTypePass.js +370 -0
  46. package/dist/misra/passes/S10_EssentialTypePass.js.map +1 -0
  47. package/dist/misra/passes/S12_ExpressionPass.d.ts +18 -0
  48. package/dist/misra/passes/S12_ExpressionPass.d.ts.map +1 -0
  49. package/dist/misra/passes/S12_ExpressionPass.js +72 -0
  50. package/dist/misra/passes/S12_ExpressionPass.js.map +1 -0
  51. package/dist/misra/passes/S13_SideEffectPass.d.ts +18 -0
  52. package/dist/misra/passes/S13_SideEffectPass.d.ts.map +1 -0
  53. package/dist/misra/passes/S13_SideEffectPass.js +105 -0
  54. package/dist/misra/passes/S13_SideEffectPass.js.map +1 -0
  55. package/dist/misra/passes/S15_ControlFlowPass.d.ts +19 -0
  56. package/dist/misra/passes/S15_ControlFlowPass.d.ts.map +1 -0
  57. package/dist/misra/passes/S15_ControlFlowPass.js +94 -0
  58. package/dist/misra/passes/S15_ControlFlowPass.js.map +1 -0
  59. package/dist/misra/passes/S16_SwitchStatementPass.d.ts +17 -0
  60. package/dist/misra/passes/S16_SwitchStatementPass.d.ts.map +1 -0
  61. package/dist/misra/passes/S16_SwitchStatementPass.js +152 -0
  62. package/dist/misra/passes/S16_SwitchStatementPass.js.map +1 -0
  63. package/dist/misra/passes/S17_FunctionPass.d.ts +12 -0
  64. package/dist/misra/passes/S17_FunctionPass.d.ts.map +1 -0
  65. package/dist/misra/passes/S17_FunctionPass.js +38 -0
  66. package/dist/misra/passes/S17_FunctionPass.js.map +1 -0
  67. package/dist/misra/passes/S18_PointersArraysPass.d.ts +17 -0
  68. package/dist/misra/passes/S18_PointersArraysPass.d.ts.map +1 -0
  69. package/dist/misra/passes/S18_PointersArraysPass.js +115 -0
  70. package/dist/misra/passes/S18_PointersArraysPass.js.map +1 -0
  71. package/dist/misra/passes/S19_OverlappingStoragePass.d.ts +11 -0
  72. package/dist/misra/passes/S19_OverlappingStoragePass.d.ts.map +1 -0
  73. package/dist/misra/passes/S19_OverlappingStoragePass.js +20 -0
  74. package/dist/misra/passes/S19_OverlappingStoragePass.js.map +1 -0
  75. package/dist/misra/passes/S21_StandardLibPass.d.ts +20 -0
  76. package/dist/misra/passes/S21_StandardLibPass.d.ts.map +1 -0
  77. package/dist/misra/passes/S21_StandardLibPass.js +77 -0
  78. package/dist/misra/passes/S21_StandardLibPass.js.map +1 -0
  79. package/dist/misra/passes/S3_CommentPass.d.ts +12 -0
  80. package/dist/misra/passes/S3_CommentPass.d.ts.map +1 -0
  81. package/dist/misra/passes/S3_CommentPass.js +27 -0
  82. package/dist/misra/passes/S3_CommentPass.js.map +1 -0
  83. package/dist/misra/passes/S5_IdentifierPass.d.ts +13 -0
  84. package/dist/misra/passes/S5_IdentifierPass.d.ts.map +1 -0
  85. package/dist/misra/passes/S5_IdentifierPass.js +60 -0
  86. package/dist/misra/passes/S5_IdentifierPass.js.map +1 -0
  87. package/dist/misra/passes/S6_TypePass.d.ts +11 -0
  88. package/dist/misra/passes/S6_TypePass.d.ts.map +1 -0
  89. package/dist/misra/passes/S6_TypePass.js +25 -0
  90. package/dist/misra/passes/S6_TypePass.js.map +1 -0
  91. package/dist/misra/passes/S7_LiteralsConstantsPass.d.ts +14 -0
  92. package/dist/misra/passes/S7_LiteralsConstantsPass.d.ts.map +1 -0
  93. package/dist/misra/passes/S7_LiteralsConstantsPass.js +71 -0
  94. package/dist/misra/passes/S7_LiteralsConstantsPass.js.map +1 -0
  95. package/dist/misra/passes/S8_DeclDefPass.d.ts +18 -0
  96. package/dist/misra/passes/S8_DeclDefPass.d.ts.map +1 -0
  97. package/dist/misra/passes/S8_DeclDefPass.js +127 -0
  98. package/dist/misra/passes/S8_DeclDefPass.js.map +1 -0
  99. package/dist/misra/sections/Section10_EssentialTypeModel.d.ts +33 -0
  100. package/dist/misra/sections/Section10_EssentialTypeModel.d.ts.map +1 -0
  101. package/{src/misra/sections/Section10_EssentialTypeModel.ts → dist/misra/sections/Section10_EssentialTypeModel.js} +58 -73
  102. package/dist/misra/sections/Section10_EssentialTypeModel.js.map +1 -0
  103. package/dist/misra/sections/Section11_PointerTypeConversions.d.ts +12 -0
  104. package/dist/misra/sections/Section11_PointerTypeConversions.d.ts.map +1 -0
  105. package/{src/misra/sections/Section11_PointerTypeConversions.ts → dist/misra/sections/Section11_PointerTypeConversions.js} +16 -27
  106. package/dist/misra/sections/Section11_PointerTypeConversions.js.map +1 -0
  107. package/dist/misra/sections/Section12_Expressions.d.ts +15 -0
  108. package/dist/misra/sections/Section12_Expressions.d.ts.map +1 -0
  109. package/dist/misra/sections/Section12_Expressions.js +70 -0
  110. package/dist/misra/sections/Section12_Expressions.js.map +1 -0
  111. package/dist/misra/sections/Section13_SideEffects.d.ts +14 -0
  112. package/dist/misra/sections/Section13_SideEffects.d.ts.map +1 -0
  113. package/dist/misra/sections/Section13_SideEffects.js +90 -0
  114. package/dist/misra/sections/Section13_SideEffects.js.map +1 -0
  115. package/dist/misra/sections/Section14_ControlStmtExprs.d.ts +8 -0
  116. package/dist/misra/sections/Section14_ControlStmtExprs.d.ts.map +1 -0
  117. package/{src/misra/sections/Section14_ControlStmtExprs.ts → dist/misra/sections/Section14_ControlStmtExprs.js} +8 -10
  118. package/dist/misra/sections/Section14_ControlStmtExprs.js.map +1 -0
  119. package/dist/misra/sections/Section15_ControlFlow.d.ts +14 -0
  120. package/dist/misra/sections/Section15_ControlFlow.d.ts.map +1 -0
  121. package/dist/misra/sections/Section15_ControlFlow.js +97 -0
  122. package/dist/misra/sections/Section15_ControlFlow.js.map +1 -0
  123. package/dist/misra/sections/Section16_SwitchStatements.d.ts +13 -0
  124. package/dist/misra/sections/Section16_SwitchStatements.d.ts.map +1 -0
  125. package/{src/misra/sections/Section16_SwitchStatements.ts → dist/misra/sections/Section16_SwitchStatements.js} +49 -74
  126. package/dist/misra/sections/Section16_SwitchStatements.js.map +1 -0
  127. package/dist/misra/sections/Section17_Functions.d.ts +9 -0
  128. package/dist/misra/sections/Section17_Functions.d.ts.map +1 -0
  129. package/{src/misra/sections/Section17_Functions.ts → dist/misra/sections/Section17_Functions.js} +10 -13
  130. package/dist/misra/sections/Section17_Functions.js.map +1 -0
  131. package/dist/misra/sections/Section18_PointersAndArrays.d.ts +13 -0
  132. package/dist/misra/sections/Section18_PointersAndArrays.d.ts.map +1 -0
  133. package/{src/misra/sections/Section18_PointersAndArrays.ts → dist/misra/sections/Section18_PointersAndArrays.js} +36 -40
  134. package/dist/misra/sections/Section18_PointersAndArrays.js.map +1 -0
  135. package/dist/misra/sections/Section19_OverlappingStorage.d.ts +8 -0
  136. package/dist/misra/sections/Section19_OverlappingStorage.d.ts.map +1 -0
  137. package/dist/misra/sections/Section19_OverlappingStorage.js +16 -0
  138. package/dist/misra/sections/Section19_OverlappingStorage.js.map +1 -0
  139. package/dist/misra/sections/Section20_PreprocessingDirectives.d.ts +8 -0
  140. package/dist/misra/sections/Section20_PreprocessingDirectives.d.ts.map +1 -0
  141. package/{src/misra/sections/Section20_PreprocessingDirectives.ts → dist/misra/sections/Section20_PreprocessingDirectives.js} +7 -9
  142. package/dist/misra/sections/Section20_PreprocessingDirectives.js.map +1 -0
  143. package/dist/misra/sections/Section21_StandardLibraries.d.ts +17 -0
  144. package/dist/misra/sections/Section21_StandardLibraries.d.ts.map +1 -0
  145. package/dist/misra/sections/Section21_StandardLibraries.js +54 -0
  146. package/dist/misra/sections/Section21_StandardLibraries.js.map +1 -0
  147. package/dist/misra/sections/Section2_UnusedCode.d.ts +9 -0
  148. package/dist/misra/sections/Section2_UnusedCode.d.ts.map +1 -0
  149. package/{src/misra/sections/Section2_UnusedCode.ts → dist/misra/sections/Section2_UnusedCode.js} +11 -16
  150. package/dist/misra/sections/Section2_UnusedCode.js.map +1 -0
  151. package/dist/misra/sections/Section3_Comments.d.ts +9 -0
  152. package/dist/misra/sections/Section3_Comments.d.ts.map +1 -0
  153. package/{src/misra/sections/Section3_Comments.ts → dist/misra/sections/Section3_Comments.js} +7 -10
  154. package/dist/misra/sections/Section3_Comments.js.map +1 -0
  155. package/dist/misra/sections/Section5_Identifiers.d.ts +12 -0
  156. package/dist/misra/sections/Section5_Identifiers.d.ts.map +1 -0
  157. package/dist/misra/sections/Section5_Identifiers.js +139 -0
  158. package/dist/misra/sections/Section5_Identifiers.js.map +1 -0
  159. package/dist/misra/sections/Section6_Types.d.ts +8 -0
  160. package/dist/misra/sections/Section6_Types.d.ts.map +1 -0
  161. package/dist/misra/sections/Section6_Types.js +23 -0
  162. package/dist/misra/sections/Section6_Types.js.map +1 -0
  163. package/dist/misra/sections/Section7_LiteralsConstants.d.ts +11 -0
  164. package/dist/misra/sections/Section7_LiteralsConstants.d.ts.map +1 -0
  165. package/{src/misra/sections/Section7_LiteralsConstants.ts → dist/misra/sections/Section7_LiteralsConstants.js} +18 -25
  166. package/dist/misra/sections/Section7_LiteralsConstants.js.map +1 -0
  167. package/dist/misra/sections/Section8_DeclarationsDefinitions.d.ts +15 -0
  168. package/dist/misra/sections/Section8_DeclarationsDefinitions.d.ts.map +1 -0
  169. package/{src/misra/sections/Section8_DeclarationsDefinitions.ts → dist/misra/sections/Section8_DeclarationsDefinitions.js} +18 -33
  170. package/dist/misra/sections/Section8_DeclarationsDefinitions.js.map +1 -0
  171. package/dist/misra/tests/utils.d.ts +10 -0
  172. package/dist/misra/tests/utils.d.ts.map +1 -0
  173. package/dist/misra/tests/utils.js +33 -0
  174. package/dist/misra/tests/utils.js.map +1 -0
  175. package/dist/rules/Section16_SwitchStatements/Rule_16_2_TopLevelSwitch.d.ts +15 -0
  176. package/dist/rules/Section16_SwitchStatements/Rule_16_2_TopLevelSwitch.d.ts.map +1 -0
  177. package/dist/rules/Section16_SwitchStatements/Rule_16_2_TopLevelSwitch.js +33 -0
  178. package/dist/rules/Section16_SwitchStatements/Rule_16_2_TopLevelSwitch.js.map +1 -0
  179. package/dist/rules/Section16_SwitchStatements/Rule_16_3_UnconditionalBreak.d.ts +16 -0
  180. package/dist/rules/Section16_SwitchStatements/Rule_16_3_UnconditionalBreak.d.ts.map +1 -0
  181. package/dist/rules/Section16_SwitchStatements/Rule_16_3_UnconditionalBreak.js +60 -0
  182. package/dist/rules/Section16_SwitchStatements/Rule_16_3_UnconditionalBreak.js.map +1 -0
  183. package/dist/rules/Section16_SwitchStatements/Rule_16_4_SwitchHasDefault.d.ts +19 -0
  184. package/dist/rules/Section16_SwitchStatements/Rule_16_4_SwitchHasDefault.d.ts.map +1 -0
  185. package/dist/rules/Section16_SwitchStatements/Rule_16_4_SwitchHasDefault.js +42 -0
  186. package/dist/rules/Section16_SwitchStatements/Rule_16_4_SwitchHasDefault.js.map +1 -0
  187. package/dist/rules/Section16_SwitchStatements/Rule_16_5_DefaultFirstOrLast.d.ts +43 -0
  188. package/dist/rules/Section16_SwitchStatements/Rule_16_5_DefaultFirstOrLast.d.ts.map +1 -0
  189. package/dist/rules/Section16_SwitchStatements/Rule_16_5_DefaultFirstOrLast.js +103 -0
  190. package/dist/rules/Section16_SwitchStatements/Rule_16_5_DefaultFirstOrLast.js.map +1 -0
  191. package/dist/rules/Section16_SwitchStatements/Rule_16_6_SwitchMinTwoClauses.d.ts +26 -0
  192. package/dist/rules/Section16_SwitchStatements/Rule_16_6_SwitchMinTwoClauses.d.ts.map +1 -0
  193. package/dist/rules/Section16_SwitchStatements/Rule_16_6_SwitchMinTwoClauses.js +49 -0
  194. package/dist/rules/Section16_SwitchStatements/Rule_16_6_SwitchMinTwoClauses.js.map +1 -0
  195. package/dist/rules/Section16_SwitchStatements/Rule_16_7_NonBooleanSwitchCondition.d.ts +26 -0
  196. package/dist/rules/Section16_SwitchStatements/Rule_16_7_NonBooleanSwitchCondition.d.ts.map +1 -0
  197. package/dist/rules/Section16_SwitchStatements/Rule_16_7_NonBooleanSwitchCondition.js +49 -0
  198. package/dist/rules/Section16_SwitchStatements/Rule_16_7_NonBooleanSwitchCondition.js.map +1 -0
  199. package/dist/rules/Section17_Functions/Rule_17_4_NonVoidReturn.d.ts +31 -0
  200. package/dist/rules/Section17_Functions/Rule_17_4_NonVoidReturn.d.ts.map +1 -0
  201. package/dist/rules/Section17_Functions/Rule_17_4_NonVoidReturn.js +71 -0
  202. package/dist/rules/Section17_Functions/Rule_17_4_NonVoidReturn.js.map +1 -0
  203. package/dist/rules/Section17_Functions/Rule_17_6_StaticArraySizeParam.d.ts +27 -0
  204. package/dist/rules/Section17_Functions/Rule_17_6_StaticArraySizeParam.d.ts.map +1 -0
  205. package/dist/rules/Section17_Functions/Rule_17_6_StaticArraySizeParam.js +58 -0
  206. package/dist/rules/Section17_Functions/Rule_17_6_StaticArraySizeParam.js.map +1 -0
  207. package/dist/rules/Section17_Functions/Rule_17_7_UnusedReturnValue.d.ts +28 -0
  208. package/dist/rules/Section17_Functions/Rule_17_7_UnusedReturnValue.d.ts.map +1 -0
  209. package/dist/rules/Section17_Functions/Rule_17_7_UnusedReturnValue.js +44 -0
  210. package/dist/rules/Section17_Functions/Rule_17_7_UnusedReturnValue.js.map +1 -0
  211. package/dist/rules/Section20-PreprocessingDirectives/Rule_20_2_InvalidHeaderFileName.d.ts +55 -0
  212. package/dist/rules/Section20-PreprocessingDirectives/Rule_20_2_InvalidHeaderFileName.d.ts.map +1 -0
  213. package/dist/rules/Section20-PreprocessingDirectives/Rule_20_2_InvalidHeaderFileName.js +108 -0
  214. package/dist/rules/Section20-PreprocessingDirectives/Rule_20_2_InvalidHeaderFileName.js.map +1 -0
  215. package/dist/rules/Section2_UnusedCode/Rule_2_3_UnusedTypeDecl.d.ts +43 -0
  216. package/dist/rules/Section2_UnusedCode/Rule_2_3_UnusedTypeDecl.d.ts.map +1 -0
  217. package/dist/rules/Section2_UnusedCode/Rule_2_3_UnusedTypeDecl.js +68 -0
  218. package/dist/rules/Section2_UnusedCode/Rule_2_3_UnusedTypeDecl.js.map +1 -0
  219. package/dist/rules/Section2_UnusedCode/Rule_2_4_UnusedTagDecl.d.ts +29 -0
  220. package/dist/rules/Section2_UnusedCode/Rule_2_4_UnusedTagDecl.d.ts.map +1 -0
  221. package/dist/rules/Section2_UnusedCode/Rule_2_4_UnusedTagDecl.js +53 -0
  222. package/dist/rules/Section2_UnusedCode/Rule_2_4_UnusedTagDecl.js.map +1 -0
  223. package/dist/rules/Section2_UnusedCode/Rule_2_6_UnusedLabels.d.ts +15 -0
  224. package/dist/rules/Section2_UnusedCode/Rule_2_6_UnusedLabels.d.ts.map +1 -0
  225. package/dist/rules/Section2_UnusedCode/Rule_2_6_UnusedLabels.js +35 -0
  226. package/dist/rules/Section2_UnusedCode/Rule_2_6_UnusedLabels.js.map +1 -0
  227. package/dist/rules/Section2_UnusedCode/Rule_2_7_UnusedParameters.d.ts +13 -0
  228. package/dist/rules/Section2_UnusedCode/Rule_2_7_UnusedParameters.d.ts.map +1 -0
  229. package/dist/rules/Section2_UnusedCode/Rule_2_7_UnusedParameters.js +53 -0
  230. package/dist/rules/Section2_UnusedCode/Rule_2_7_UnusedParameters.js.map +1 -0
  231. package/dist/rules/Section3_Comments/Rule_3_1_CommentSequences.d.ts +13 -0
  232. package/dist/rules/Section3_Comments/Rule_3_1_CommentSequences.d.ts.map +1 -0
  233. package/dist/rules/Section3_Comments/Rule_3_1_CommentSequences.js +32 -0
  234. package/dist/rules/Section3_Comments/Rule_3_1_CommentSequences.js.map +1 -0
  235. package/dist/rules/Section3_Comments/Rule_3_2_LineSplicing.d.ts +10 -0
  236. package/dist/rules/Section3_Comments/Rule_3_2_LineSplicing.d.ts.map +1 -0
  237. package/dist/rules/Section3_Comments/Rule_3_2_LineSplicing.js +26 -0
  238. package/dist/rules/Section3_Comments/Rule_3_2_LineSplicing.js.map +1 -0
  239. package/dist/rules/index.d.ts +20 -0
  240. package/dist/rules/index.d.ts.map +1 -0
  241. package/dist/rules/index.js +38 -0
  242. package/dist/rules/index.js.map +1 -0
  243. package/dist/tests/Section17_Functions/misra_config.json +10 -0
  244. package/dist/tests/utils.d.ts +10 -0
  245. package/dist/tests/utils.d.ts.map +1 -0
  246. package/dist/tests/utils.js +29 -0
  247. package/dist/tests/utils.js.map +1 -0
  248. package/dist/utils/utils.d.ts +102 -0
  249. package/dist/utils/utils.d.ts.map +1 -0
  250. package/dist/utils/utils.js +202 -0
  251. package/dist/utils/utils.js.map +1 -0
  252. package/jest.config.js +6 -6
  253. package/package.json +44 -8
  254. package/src/MISRA.ts +276 -0
  255. package/src/MISRAContext.ts +84 -0
  256. package/src/MISRARule.ts +64 -0
  257. package/src/MISRATool.ts +95 -0
  258. package/src/main.ts +4 -33
  259. package/src/misra-old/MISRAAnalyser.ts +60 -0
  260. package/src/misra-old/MISRAAnalyserResult.ts +16 -0
  261. package/src/misra-old/sections/Section10_EssentialTypeModel.ts +377 -0
  262. package/src/misra-old/sections/Section11_PointerTypeConversions.ts +104 -0
  263. package/src/{misra → misra-old}/sections/Section12_Expressions.ts +7 -7
  264. package/src/{misra → misra-old}/sections/Section13_SideEffects.ts +15 -15
  265. package/src/misra-old/sections/Section14_ControlStmtExprs.ts +27 -0
  266. package/src/{misra → misra-old}/sections/Section15_ControlFlow.ts +10 -10
  267. package/src/misra-old/sections/Section18_PointersAndArrays.ts +108 -0
  268. package/src/{misra → misra-old}/sections/Section19_OverlappingStorage.ts +4 -4
  269. package/src/misra-old/sections/Section20_PreprocessingDirectives.ts +22 -0
  270. package/src/misra-old/sections/Section21_StandardLibraries.ts +99 -0
  271. package/src/{misra → misra-old}/sections/Section5_Identifiers.ts +16 -15
  272. package/src/{misra → misra-old}/sections/Section6_Types.ts +4 -4
  273. package/src/misra-old/sections/Section7_LiteralsConstants.ts +76 -0
  274. package/src/misra-old/sections/Section8_DeclarationsDefinitions.ts +133 -0
  275. package/src/rules/Section16_SwitchStatements/Rule_16_2_TopLevelSwitch.ts +41 -0
  276. package/src/rules/Section16_SwitchStatements/Rule_16_3_UnconditionalBreak.ts +70 -0
  277. package/src/rules/Section16_SwitchStatements/Rule_16_4_SwitchHasDefault.ts +41 -0
  278. package/src/rules/Section16_SwitchStatements/Rule_16_5_DefaultFirstOrLast.ts +113 -0
  279. package/src/rules/Section16_SwitchStatements/Rule_16_6_SwitchMinTwoClauses.ts +61 -0
  280. package/src/rules/Section16_SwitchStatements/Rule_16_7_NonBooleanSwitchCondition.ts +57 -0
  281. package/src/rules/Section17_Functions/Rule_17_3_ImplicitFunction.ts +180 -0
  282. package/src/rules/Section17_Functions/Rule_17_4_NonVoidReturn.ts +91 -0
  283. package/src/rules/Section17_Functions/Rule_17_6_StaticArraySizeParam.ts +68 -0
  284. package/src/rules/Section17_Functions/Rule_17_7_UnusedReturnValue.ts +49 -0
  285. package/src/rules/Section20-PreprocessingDirectives/Rule_20_2_InvalidHeaderFileName.ts +120 -0
  286. package/src/rules/Section2_UnusedCode/Rule_2_3_UnusedTypeDecl.ts +78 -0
  287. package/src/rules/Section2_UnusedCode/Rule_2_4_UnusedTagDecl.ts +61 -0
  288. package/src/rules/Section2_UnusedCode/Rule_2_6_UnusedLabels.ts +47 -0
  289. package/src/rules/Section2_UnusedCode/Rule_2_7_UnusedParameters.ts +67 -0
  290. package/src/rules/Section3_Comments/Rule_3_1_CommentSequences.ts +41 -0
  291. package/src/rules/Section3_Comments/Rule_3_2_LineSplicing.ts +36 -0
  292. package/src/rules/index.ts +44 -0
  293. package/src/tests/Section16_SwitchStatements/Rule_16_2_TopLevelSwitch.test.ts +55 -0
  294. package/src/tests/Section16_SwitchStatements/Rule_16_3_UnconditionalBreak.test.ts +70 -0
  295. package/src/tests/Section16_SwitchStatements/Rule_16_4_SwitchHasDefault.test.ts +128 -0
  296. package/src/tests/Section16_SwitchStatements/Rule_16_5_DefaultFirstOrLast.test.ts +132 -0
  297. package/src/tests/Section16_SwitchStatements/Rule_16_6_SwitchMinTwoClauses.test.ts +146 -0
  298. package/src/tests/Section16_SwitchStatements/Rule_16_7_NonBooleanSwitchCondition.test.ts +102 -0
  299. package/src/tests/Section17_Functions/Rule_17_3_ImplicitFunctions.test.ts +79 -0
  300. package/src/tests/Section17_Functions/Rule_17_4_NonVoidReturn.test.ts +98 -0
  301. package/src/tests/Section17_Functions/Rule_17_4_NonVoidReturn_MissingConfig.test.ts +77 -0
  302. package/src/tests/Section17_Functions/Rule_17_6_StaticArraySizeParam.test.ts +36 -0
  303. package/src/tests/Section17_Functions/Rule_17_7_UnusedReturnValue.test.ts +44 -0
  304. package/src/tests/Section17_Functions/misra_config.json +19 -0
  305. package/src/tests/Section2_UnusedCode/Rule_2_3_UnusedTypeDecl.test.ts +175 -0
  306. package/src/tests/Section2_UnusedCode/Rule_2_4_UnusedTagDecl.test.ts +219 -0
  307. package/src/tests/Section2_UnusedCode/Rule_2_6_UnusedLabels.test.ts +49 -0
  308. package/src/tests/Section2_UnusedCode/Rule_2_7_UnusedParameters.test.ts +55 -0
  309. package/src/tests/Section3_Comments/Rule_3_1_CommentSequences.test.ts +37 -0
  310. package/src/tests/utils.ts +51 -0
  311. package/src/utils/utils.ts +280 -0
  312. package/tsconfig.json +4 -3
  313. package/typedoc.config.js +1 -1
  314. package/CxxSources/lib.cpp +0 -3
  315. package/CxxSources/lib.h +0 -8
  316. package/CxxSources/main.cpp +0 -40
  317. package/TODO.md +0 -1
  318. package/consumer_order.txt +0 -2
  319. package/enum_integer_type.txt +0 -0
  320. package/is_temporary.txt +0 -0
  321. package/omp.txt +0 -0
  322. package/src/misra/passes/S16_SwitchStatementPass.ts +0 -168
  323. package/src/misra/passes/S3_CommentPass.ts +0 -40
  324. package/src/misra/sections/Section21_StandardLibraries.ts +0 -65
  325. package/src/misra/tests/S10_EssentialTypes.test.ts +0 -253
  326. package/src/misra/tests/S12_Expressions.test.ts +0 -43
  327. package/src/misra/tests/S13_SideEffects.test.ts +0 -77
  328. package/src/misra/tests/S15_ControlFlow.test.ts +0 -144
  329. package/src/misra/tests/S16_SwitchStatements.test.ts +0 -164
  330. package/src/misra/tests/S17_Functions.test.ts +0 -46
  331. package/src/misra/tests/S18_PointersArrays.test.ts +0 -167
  332. package/src/misra/tests/S19_OverlappingStorage.test.ts +0 -38
  333. package/src/misra/tests/S3_Comments.test.ts +0 -36
  334. package/src/misra/tests/S6_Types.test.ts +0 -36
  335. package/src/misra/tests/S7_LiteralsConstants.test.ts +0 -48
  336. package/src/misra/tests/utils.ts +0 -47
  337. package/types_with_templates.txt +0 -0
  338. /package/src/{misra → misra-old}/MISRAPass.ts +0 -0
  339. /package/src/{misra → misra-old}/MISRAPassResult.ts +0 -0
  340. /package/src/{misra → misra-old}/MISRAReporter.ts +0 -0
  341. /package/src/{misra → misra-old}/passes/S10_EssentialTypePass.ts +0 -0
  342. /package/src/{misra → misra-old}/passes/S12_ExpressionPass.ts +0 -0
  343. /package/src/{misra → misra-old}/passes/S13_SideEffectPass.ts +0 -0
  344. /package/src/{misra → misra-old}/passes/S15_ControlFlowPass.ts +0 -0
  345. /package/src/{misra → misra-old}/passes/S17_FunctionPass.ts +0 -0
  346. /package/src/{misra → misra-old}/passes/S18_PointersArraysPass.ts +0 -0
  347. /package/src/{misra → misra-old}/passes/S19_OverlappingStoragePass.ts +0 -0
  348. /package/src/{misra → misra-old}/passes/S21_StandardLibPass.ts +0 -0
  349. /package/src/{misra → misra-old}/passes/S5_IdentifierPass.ts +0 -0
  350. /package/src/{misra → misra-old}/passes/S6_TypePass.ts +0 -0
  351. /package/src/{misra → misra-old}/passes/S7_LiteralsConstantsPass.ts +0 -0
  352. /package/src/{misra → misra-old}/passes/S8_DeclDefPass.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Rule_3_2_LineSplicing.js","sourceRoot":"","sources":["../../../src/rules/Section3_Comments/Rule_3_2_LineSplicing.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAE3C,OAA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 +1,20 @@
1
+ import MISRAContext from "../MISRAContext.js";
2
+ import Rule_16_2_TopLevelSwitch from "./Section16_SwitchStatements/Rule_16_2_TopLevelSwitch.js";
3
+ import Rule_16_3_UnconditionalBreak from "./Section16_SwitchStatements/Rule_16_3_UnconditionalBreak.js";
4
+ import Rule_16_4_SwitchHasDefault from "./Section16_SwitchStatements/Rule_16_4_SwitchHasDefault.js";
5
+ import Rule_16_5_DefaultFirstOrLast from "./Section16_SwitchStatements/Rule_16_5_DefaultFirstOrLast.js";
6
+ import Rule_16_6_SwitchMinTwoClauses from "./Section16_SwitchStatements/Rule_16_6_SwitchMinTwoClauses.js";
7
+ import Rule_16_7_NonBooleanSwitchCondition from "./Section16_SwitchStatements/Rule_16_7_NonBooleanSwitchCondition.js";
8
+ import Rule_17_4_NonVoidReturn from "./Section17_Functions/Rule_17_4_NonVoidReturn.js";
9
+ import Rule_17_6_StaticArraySizeParam from "./Section17_Functions/Rule_17_6_StaticArraySizeParam.js";
10
+ import Rule_17_7_UnusedReturnValue from "./Section17_Functions/Rule_17_7_UnusedReturnValue.js";
11
+ import Rule_20_2_InvalidHeaderFileName from "./Section20-PreprocessingDirectives/Rule_20_2_InvalidHeaderFileName.js";
12
+ import Rule_2_3_UnusedTypeDecl from "./Section2_UnusedCode/Rule_2_3_UnusedTypeDecl.js";
13
+ import Rule_2_4_UnusedTagDecl from "./Section2_UnusedCode/Rule_2_4_UnusedTagDecl.js";
14
+ import Rule_2_6_UnusedLabels from "./Section2_UnusedCode/Rule_2_6_UnusedLabels.js";
15
+ import Rule_2_7_UnusedParameters from "./Section2_UnusedCode/Rule_2_7_UnusedParameters.js";
16
+ import Rule_3_1_CommentSequences from "./Section3_Comments/Rule_3_1_CommentSequences.js";
17
+ import Rule_3_2_CommentSequences from "./Section3_Comments/Rule_3_2_LineSplicing.js";
18
+ export declare function misraRules(context: MISRAContext): (Rule_16_2_TopLevelSwitch | Rule_16_3_UnconditionalBreak | Rule_16_4_SwitchHasDefault | Rule_16_5_DefaultFirstOrLast | Rule_16_6_SwitchMinTwoClauses | Rule_16_7_NonBooleanSwitchCondition | Rule_17_4_NonVoidReturn | Rule_17_6_StaticArraySizeParam | Rule_17_7_UnusedReturnValue | Rule_20_2_InvalidHeaderFileName | Rule_2_3_UnusedTypeDecl | Rule_2_4_UnusedTagDecl | Rule_2_6_UnusedLabels | Rule_2_7_UnusedParameters | Rule_3_1_CommentSequences | Rule_3_2_CommentSequences)[];
19
+ export default misraRules;
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAO,wBAAwB,MAAM,0DAA0D,CAAC;AAChG,OAAO,4BAA4B,MAAM,8DAA8D,CAAC;AACxG,OAAO,0BAA0B,MAAM,4DAA4D,CAAC;AACpG,OAAO,4BAA4B,MAAM,8DAA8D,CAAC;AACxG,OAAO,6BAA6B,MAAM,+DAA+D,CAAC;AAC1G,OAAO,mCAAmC,MAAM,qEAAqE,CAAC;AACtH,OAAO,uBAAuB,MAAM,kDAAkD,CAAC;AACvF,OAAO,8BAA8B,MAAM,yDAAyD,CAAC;AACrG,OAAO,2BAA2B,MAAM,sDAAsD,CAAC;AAC/F,OAAO,+BAA+B,MAAM,wEAAwE,CAAC;AACrH,OAAO,uBAAuB,MAAM,kDAAkD,CAAC;AACvF,OAAO,sBAAsB,MAAM,iDAAiD,CAAC;AACrF,OAAO,qBAAqB,MAAM,gDAAgD,CAAC;AACnF,OAAO,yBAAyB,MAAM,oDAAoD,CAAC;AAC3F,OAAO,yBAAyB,MAAM,kDAAkD,CAAC;AACzF,OAAO,yBAAyB,MAAM,8CAA8C,CAAC;AAErF,wBAAgB,UAAU,CAAC,OAAO,EAAE,YAAY,2dAmB/C;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,38 @@
1
+ import Rule_16_2_TopLevelSwitch from "./Section16_SwitchStatements/Rule_16_2_TopLevelSwitch.js";
2
+ import Rule_16_3_UnconditionalBreak from "./Section16_SwitchStatements/Rule_16_3_UnconditionalBreak.js";
3
+ import Rule_16_4_SwitchHasDefault from "./Section16_SwitchStatements/Rule_16_4_SwitchHasDefault.js";
4
+ import Rule_16_5_DefaultFirstOrLast from "./Section16_SwitchStatements/Rule_16_5_DefaultFirstOrLast.js";
5
+ import Rule_16_6_SwitchMinTwoClauses from "./Section16_SwitchStatements/Rule_16_6_SwitchMinTwoClauses.js";
6
+ import Rule_16_7_NonBooleanSwitchCondition from "./Section16_SwitchStatements/Rule_16_7_NonBooleanSwitchCondition.js";
7
+ import Rule_17_4_NonVoidReturn from "./Section17_Functions/Rule_17_4_NonVoidReturn.js";
8
+ import Rule_17_6_StaticArraySizeParam from "./Section17_Functions/Rule_17_6_StaticArraySizeParam.js";
9
+ import Rule_17_7_UnusedReturnValue from "./Section17_Functions/Rule_17_7_UnusedReturnValue.js";
10
+ import Rule_20_2_InvalidHeaderFileName from "./Section20-PreprocessingDirectives/Rule_20_2_InvalidHeaderFileName.js";
11
+ import Rule_2_3_UnusedTypeDecl from "./Section2_UnusedCode/Rule_2_3_UnusedTypeDecl.js";
12
+ import Rule_2_4_UnusedTagDecl from "./Section2_UnusedCode/Rule_2_4_UnusedTagDecl.js";
13
+ import Rule_2_6_UnusedLabels from "./Section2_UnusedCode/Rule_2_6_UnusedLabels.js";
14
+ import Rule_2_7_UnusedParameters from "./Section2_UnusedCode/Rule_2_7_UnusedParameters.js";
15
+ import Rule_3_1_CommentSequences from "./Section3_Comments/Rule_3_1_CommentSequences.js";
16
+ import Rule_3_2_CommentSequences from "./Section3_Comments/Rule_3_2_LineSplicing.js";
17
+ export function misraRules(context) {
18
+ return [
19
+ new Rule_2_3_UnusedTypeDecl(context),
20
+ new Rule_2_4_UnusedTagDecl(context),
21
+ new Rule_2_6_UnusedLabels(context),
22
+ new Rule_2_7_UnusedParameters(context),
23
+ new Rule_3_1_CommentSequences(context),
24
+ new Rule_3_2_CommentSequences(context),
25
+ new Rule_16_2_TopLevelSwitch(context),
26
+ new Rule_16_3_UnconditionalBreak(context),
27
+ new Rule_16_4_SwitchHasDefault(context),
28
+ new Rule_16_5_DefaultFirstOrLast(context),
29
+ new Rule_16_6_SwitchMinTwoClauses(context),
30
+ new Rule_16_7_NonBooleanSwitchCondition(context),
31
+ new Rule_17_4_NonVoidReturn(context),
32
+ new Rule_17_6_StaticArraySizeParam(context),
33
+ new Rule_17_7_UnusedReturnValue(context),
34
+ new Rule_20_2_InvalidHeaderFileName(context),
35
+ ];
36
+ }
37
+ export default misraRules;
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":"AACA,OAAO,wBAAwB,MAAM,0DAA0D,CAAC;AAChG,OAAO,4BAA4B,MAAM,8DAA8D,CAAC;AACxG,OAAO,0BAA0B,MAAM,4DAA4D,CAAC;AACpG,OAAO,4BAA4B,MAAM,8DAA8D,CAAC;AACxG,OAAO,6BAA6B,MAAM,+DAA+D,CAAC;AAC1G,OAAO,mCAAmC,MAAM,qEAAqE,CAAC;AACtH,OAAO,uBAAuB,MAAM,kDAAkD,CAAC;AACvF,OAAO,8BAA8B,MAAM,yDAAyD,CAAC;AACrG,OAAO,2BAA2B,MAAM,sDAAsD,CAAC;AAC/F,OAAO,+BAA+B,MAAM,wEAAwE,CAAC;AACrH,OAAO,uBAAuB,MAAM,kDAAkD,CAAC;AACvF,OAAO,sBAAsB,MAAM,iDAAiD,CAAC;AACrF,OAAO,qBAAqB,MAAM,gDAAgD,CAAC;AACnF,OAAO,yBAAyB,MAAM,oDAAoD,CAAC;AAC3F,OAAO,yBAAyB,MAAM,kDAAkD,CAAC;AACzF,OAAO,yBAAyB,MAAM,8CAA8C,CAAC;AAErF,MAAM,UAAU,UAAU,CAAC,OAAqB;IAC5C,OAAO;QACH,IAAI,uBAAuB,CAAC,OAAO,CAAC;QACpC,IAAI,sBAAsB,CAAC,OAAO,CAAC;QACnC,IAAI,qBAAqB,CAAC,OAAO,CAAC;QAClC,IAAI,yBAAyB,CAAC,OAAO,CAAC;QACtC,IAAI,yBAAyB,CAAC,OAAO,CAAC;QACtC,IAAI,yBAAyB,CAAC,OAAO,CAAC;QACtC,IAAI,wBAAwB,CAAC,OAAO,CAAC;QACrC,IAAI,4BAA4B,CAAC,OAAO,CAAC;QACzC,IAAI,0BAA0B,CAAC,OAAO,CAAC;QACvC,IAAI,4BAA4B,CAAC,OAAO,CAAC;QACzC,IAAI,6BAA6B,CAAC,OAAO,CAAC;QAC1C,IAAI,mCAAmC,CAAC,OAAO,CAAC;QAChD,IAAI,uBAAuB,CAAC,OAAO,CAAC;QACpC,IAAI,8BAA8B,CAAC,OAAO,CAAC;QAC3C,IAAI,2BAA2B,CAAC,OAAO,CAAC;QACxC,IAAI,+BAA+B,CAAC,OAAO,CAAC;KAC/C,CAAC;AACN,CAAC;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,10 @@
1
+ {
2
+ "defaultValues": {
3
+ "int": 0,
4
+ "unsigned int": 0,
5
+ "float": 0.0,
6
+ "enum Status": "SUCCESS",
7
+ "Color": "RED",
8
+ "my_int_type": 0
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ import { FileJp, Program } from "@specs-feup/clava/api/Joinpoints.js";
2
+ export declare function countMISRAErrors(startingPoint?: FileJp | Program): number;
3
+ export declare function countErrorsAfterCorrection(configPath?: string): number;
4
+ export interface TestFile {
5
+ name: string;
6
+ code: string;
7
+ path?: string;
8
+ }
9
+ export declare function registerSourceCode(files: TestFile[]): void;
10
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/tests/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAGtE,wBAAgB,gBAAgB,CAAC,aAAa,GAAE,MAAM,GAAG,OAAiC,GAAG,MAAM,CAGlG;AAED,wBAAgB,0BAA0B,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAGtE;AAED,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAgB1D"}
@@ -0,0 +1,29 @@
1
+ import MISRATool from "../MISRATool.js";
2
+ import Clava from "@specs-feup/clava/api/clava/Clava.js";
3
+ import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js";
4
+ import Query from "@specs-feup/lara/api/weaver/Query.js";
5
+ export function countMISRAErrors(startingPoint = Query.root()) {
6
+ MISRATool.checkCompliance(startingPoint);
7
+ return MISRATool.getMISRAErrors().length;
8
+ }
9
+ export function countErrorsAfterCorrection(configPath) {
10
+ MISRATool.applyCorrections(configPath);
11
+ return MISRATool.getMISRAErrors().length;
12
+ }
13
+ export function registerSourceCode(files) {
14
+ beforeEach(() => {
15
+ Clava.getData().setStandard(process.env.STD_VERSION);
16
+ Clava.getProgram().push();
17
+ const program = Clava.getProgram();
18
+ files.forEach(file => {
19
+ const sourceFile = ClavaJoinPoints.fileWithSource(file.name, file.code, file.path);
20
+ program.addFile(sourceFile);
21
+ });
22
+ program.rebuild();
23
+ });
24
+ afterEach(() => {
25
+ Clava.getProgram().rebuild();
26
+ Clava.getProgram().pop();
27
+ });
28
+ }
29
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/tests/utils.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,MAAM,sCAAsC,CAAC;AACzD,OAAO,eAAe,MAAM,g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numDecl, Switch, Param, Varref } from "@specs-feup/clava/api/Joinpoints.js";
2
+ /**
3
+ * Checks if the comment is an inline comment
4
+ * @param $comment - The comment to check
5
+ * @returns Returns true if it's an inline comment, otherwise returns false
6
+ */
7
+ export declare function isInlineComment($comment: Comment): boolean;
8
+ /**
9
+ * Retrieves all comments associated with a given joinpoint
10
+ * @param $jp - The joinpoint to retrieve comments from
11
+ * @returns Array of comments
12
+ */
13
+ export declare function getComments($jp: Joinpoint): Comment[];
14
+ /**
15
+ * Checks if a given join point is a comment statement
16
+ *
17
+ * @param $jp The join point to check
18
+ * @returns Returns true if the given join point is a comment statement, otherwise false
19
+ */
20
+ export declare function isCommentStmt($jp: Joinpoint): boolean;
21
+ export declare function getParamReferences($param: Param, $startingPoint: Joinpoint): Varref[];
22
+ /**
23
+ * Checks if a storage class has external linkage
24
+ * @param $class - The storage class to check
25
+ * @returns Returns true if the class has external linkage, otherwise returns false
26
+ */
27
+ export declare function hasExternalLinkage($class: StorageClass): $class is StorageClass.AUTO | StorageClass.NONE | StorageClass.PRIVATE_EXTERN | StorageClass.REGISTER;
28
+ /**
29
+ * Retrieves all variables and functions that can be externed from the files, i.e.,
30
+ * elements with storage classes that are not `STATIC` or `EXTERN`
31
+ * @returns Array of functions and variables that can be externed
32
+ */
33
+ export declare function getExternals(): (FunctionJp | Vardecl)[];
34
+ /**
35
+ * Checks if the provided node has a defined type
36
+ * @param $jp The joinpoint to check its type
37
+ * @returns true if the joinpoint has a defined type, otherwise false
38
+ */
39
+ export declare function hasDefinedType($jp: Joinpoint): boolean;
40
+ /**
41
+ * Retrieves the base type of the provided joinpoint.
42
+ * @param $jp The joinpoint to retrieve its type
43
+ * @returns The base type of the joinpoint, or undefined if the type is not defined
44
+ */
45
+ export declare function getBaseType($jp: Joinpoint): Type | undefined;
46
+ /**
47
+ * Retrieves the typedef declaration for the provided joinpoint, if available
48
+ * @param $jp The joinpoint to analyze
49
+ * @returns The typedef declaration if found, or undefined if not
50
+ */
51
+ export declare function getTypeDecl($jp: Joinpoint): TypedefDecl | undefined;
52
+ /**
53
+ * Checks if the provided joinpoint declares a type (typedef)
54
+ * @param $jp The joinpoint to check
55
+ * @returns Returns true if the joinpoint declares a typedef, otherwise false
56
+ */
57
+ export declare function hasTypeDecl($jp: Joinpoint): boolean;
58
+ /**
59
+ * Retrieves all joinpoints with a defined type
60
+ * @returns Array of joinpoints with a defined type
61
+ */
62
+ export declare function getTypedJps(startingPoint?: Joinpoint): Joinpoint[];
63
+ /**
64
+ * Checks if a given joinpoint uses the specified tag declaration
65
+ * @param $jp The joinpoint to analyze
66
+ * @param tag The tag to check against
67
+ * @returns Returns true if the joinpoint uses the given tag, false otherwise
68
+ */
69
+ export declare function isTagUsed($jp: Joinpoint, tag: RecordJp | EnumDecl): boolean;
70
+ /**
71
+ * Retrieves all joinpoints that use the specified tag declaration
72
+ *
73
+ * @param tag The tag to search for in the joinpoints
74
+ * @returns Array of joinpoints that use the specified tag declaration
75
+ */
76
+ export declare function getTagUses(tag: RecordJp | EnumDecl): Joinpoint[];
77
+ /**
78
+ * Retrieves the last statement of the given case
79
+ * @param $jp - The case to retrieve the last statement from
80
+ * @returns The last statement of the case or undefined if there are no statements or it has a consecutive case.
81
+ */
82
+ export declare function getLastStmtOfCase($jp: Case): Joinpoint | undefined;
83
+ /**
84
+ * Retrieves the number of switch clauses with instructions in the provided switch statement
85
+ * @param $jp - The switch statement to analyze
86
+ * @returns The number of switch clauses with instructions
87
+ */
88
+ export declare function getNumOfSwitchClauses($jp: Switch): number;
89
+ /**
90
+ * Checks if the provided switch statement has a Boolean condition
91
+ * @param switchStmt - The switch statement to check
92
+ * @returns
93
+ * Returns true if the switch statement has a Boolean condition, otherwise false
94
+ */
95
+ export declare function switchHasBooleanCondition(switchStmt: Switch): boolean;
96
+ /**
97
+ * Checks if the provided switch statement contains any conditional break
98
+ * @param switchStmt - The switch statement to analyze
99
+ * @returns Returns true if the switch statement contains a conditional break, otherwise false
100
+ */
101
+ export declare function switchHasConditionalBreak(switchStmt: Switch): boolean;
102
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAa,WAAW,EAA6B,YAAY,EAAE,UAAU,EAAE,OAAO,EAAU,QAAQ,EAAE,QAAQ,EAAe,MAAM,EAAoG,KAAK,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7U;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,EAAE,CAErD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAErD;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,SAAS,GAAG,MAAM,EAAE,CAQrF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,yGAEtD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,EAAE,CAWvD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,CAe5D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,CASnE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAEnD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,aAAa,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAQlE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAM3E;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,EAAE,CAEhE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,IAAI,GAAG,SAAS,GAAG,SAAS,CAalE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAUzD;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAMrE;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAErE"}
@@ -0,0 +1,202 @@
1
+ import Query from "@specs-feup/lara/api/weaver/Query.js";
2
+ import { Comment, Case, Joinpoint, ArrayType, TypedefDecl, DeclStmt, StorageClass, FunctionJp, Vardecl, FileJp, RecordJp, EnumDecl, PointerType, BuiltinType, BinaryOp, Break, WrapperStmt, ElaboratedType, TagType, Varref } from "@specs-feup/clava/api/Joinpoints.js";
3
+ /**
4
+ * Checks if the comment is an inline comment
5
+ * @param $comment - The comment to check
6
+ * @returns Returns true if it's an inline comment, otherwise returns false
7
+ */
8
+ export function isInlineComment($comment) {
9
+ return $comment.astName === "InlineComment";
10
+ }
11
+ /**
12
+ * Retrieves all comments associated with a given joinpoint
13
+ * @param $jp - The joinpoint to retrieve comments from
14
+ * @returns Array of comments
15
+ */
16
+ export function getComments($jp) {
17
+ return $jp instanceof Comment ? [$jp] : $jp.inlineComments;
18
+ }
19
+ /**
20
+ * Checks if a given join point is a comment statement
21
+ *
22
+ * @param $jp The join point to check
23
+ * @returns Returns true if the given join point is a comment statement, otherwise false
24
+ */
25
+ export function isCommentStmt($jp) {
26
+ return $jp instanceof WrapperStmt && $jp.kind === "comment";
27
+ }
28
+ export function getParamReferences($param, $startingPoint) {
29
+ return Query.searchFrom($startingPoint, Varref, (ref) => {
30
+ try {
31
+ return ref.decl && ref.decl.astId === $param.astId;
32
+ }
33
+ catch (error) {
34
+ return false;
35
+ }
36
+ }).get();
37
+ }
38
+ /**
39
+ * Checks if a storage class has external linkage
40
+ * @param $class - The storage class to check
41
+ * @returns Returns true if the class has external linkage, otherwise returns false
42
+ */
43
+ export function hasExternalLinkage($class) {
44
+ return $class !== StorageClass.STATIC && $class !== StorageClass.EXTERN;
45
+ }
46
+ /**
47
+ * Retrieves all variables and functions that can be externed from the files, i.e.,
48
+ * elements with storage classes that are not `STATIC` or `EXTERN`
49
+ * @returns Array of functions and variables that can be externed
50
+ */
51
+ export function getExternals() {
52
+ let result = [];
53
+ for (const file of Query.search(FileJp).get()) {
54
+ for (const child of file.children) {
55
+ if ((child instanceof Vardecl || child instanceof FunctionJp) && hasExternalLinkage(child.storageClass)) {
56
+ result.push(child);
57
+ }
58
+ }
59
+ }
60
+ return result;
61
+ }
62
+ /**
63
+ * Checks if the provided node has a defined type
64
+ * @param $jp The joinpoint to check its type
65
+ * @returns true if the joinpoint has a defined type, otherwise false
66
+ */
67
+ export function hasDefinedType($jp) {
68
+ return $jp.hasType && $jp.type !== null || $jp.type !== undefined;
69
+ }
70
+ /**
71
+ * Retrieves the base type of the provided joinpoint.
72
+ * @param $jp The joinpoint to retrieve its type
73
+ * @returns The base type of the joinpoint, or undefined if the type is not defined
74
+ */
75
+ export function getBaseType($jp) {
76
+ if (!hasDefinedType($jp))
77
+ return undefined;
78
+ let jpType;
79
+ if ($jp.type instanceof PointerType) {
80
+ jpType = $jp.type.pointee;
81
+ while (jpType instanceof PointerType) {
82
+ jpType = jpType.pointee;
83
+ }
84
+ }
85
+ else if ($jp.type instanceof ArrayType) {
86
+ jpType = $jp.type.elementType;
87
+ }
88
+ else {
89
+ jpType = $jp.type;
90
+ }
91
+ return jpType;
92
+ }
93
+ /**
94
+ * Retrieves the typedef declaration for the provided joinpoint, if available
95
+ * @param $jp The joinpoint to analyze
96
+ * @returns The typedef declaration if found, or undefined if not
97
+ */
98
+ export function getTypeDecl($jp) {
99
+ if ($jp instanceof DeclStmt && $jp.children.length === 1 && $jp.children[0] instanceof TypedefDecl)
100
+ return $jp.children[0];
101
+ if ($jp instanceof RecordJp || $jp instanceof EnumDecl) {
102
+ const typeDecls = Query.searchFrom($jp, TypedefDecl).get();
103
+ if (typeDecls.length === 1)
104
+ return typeDecls[0];
105
+ }
106
+ }
107
+ /**
108
+ * Checks if the provided joinpoint declares a type (typedef)
109
+ * @param $jp The joinpoint to check
110
+ * @returns Returns true if the joinpoint declares a typedef, otherwise false
111
+ */
112
+ export function hasTypeDecl($jp) {
113
+ return getTypeDecl($jp) !== undefined;
114
+ }
115
+ /**
116
+ * Retrieves all joinpoints with a defined type
117
+ * @returns Array of joinpoints with a defined type
118
+ */
119
+ export function getTypedJps(startingPoint) {
120
+ if (startingPoint) {
121
+ return Query.searchFrom(startingPoint, Joinpoint).get().filter(jp => jp.hasType && jp.type !== null && jp.type !== undefined);
122
+ }
123
+ return Query.search(Joinpoint).get().filter(jp => jp.hasType &&
124
+ jp.type !== null &&
125
+ jp.type !== undefined);
126
+ }
127
+ /**
128
+ * Checks if a given joinpoint uses the specified tag declaration
129
+ * @param $jp The joinpoint to analyze
130
+ * @param tag The tag to check against
131
+ * @returns Returns true if the joinpoint uses the given tag, false otherwise
132
+ */
133
+ export function isTagUsed($jp, tag) {
134
+ const jpType = getBaseType($jp);
135
+ return jpType instanceof ElaboratedType &&
136
+ jpType.namedType instanceof TagType &&
137
+ jpType.namedType.decl.astId === tag.astId &&
138
+ $jp.astId !== getTypeDecl(tag)?.astId;
139
+ }
140
+ /**
141
+ * Retrieves all joinpoints that use the specified tag declaration
142
+ *
143
+ * @param tag The tag to search for in the joinpoints
144
+ * @returns Array of joinpoints that use the specified tag declaration
145
+ */
146
+ export function getTagUses(tag) {
147
+ return getTypedJps().filter(jp => isTagUsed(jp, tag));
148
+ }
149
+ /**
150
+ * Retrieves the last statement of the given case
151
+ * @param $jp - The case to retrieve the last statement from
152
+ * @returns The last statement of the case or undefined if there are no statements or it has a consecutive case.
153
+ */
154
+ export function getLastStmtOfCase($jp) {
155
+ if ($jp.instructions.length === 0) { // Has a consecutive case
156
+ return undefined;
157
+ }
158
+ let lastStmt;
159
+ for (const stmt of $jp.siblingsRight) {
160
+ if (stmt instanceof Case) {
161
+ break;
162
+ }
163
+ lastStmt = stmt;
164
+ }
165
+ return lastStmt;
166
+ }
167
+ /**
168
+ * Retrieves the number of switch clauses with instructions in the provided switch statement
169
+ * @param $jp - The switch statement to analyze
170
+ * @returns The number of switch clauses with instructions
171
+ */
172
+ export function getNumOfSwitchClauses($jp) {
173
+ let firstStatements = [];
174
+ for (const caseLabel of $jp.cases) {
175
+ if (caseLabel.instructions.length === 0) { // Has a consecutive case
176
+ continue;
177
+ }
178
+ firstStatements.push(caseLabel.instructions[0]);
179
+ }
180
+ return firstStatements.length;
181
+ }
182
+ /**
183
+ * Checks if the provided switch statement has a Boolean condition
184
+ * @param switchStmt - The switch statement to check
185
+ * @returns
186
+ * Returns true if the switch statement has a Boolean condition, otherwise false
187
+ */
188
+ export function switchHasBooleanCondition(switchStmt) {
189
+ return switchStmt.condition instanceof BinaryOp ||
190
+ (hasDefinedType(switchStmt.condition) &&
191
+ switchStmt.condition.type instanceof BuiltinType &&
192
+ switchStmt.condition.type.builtinKind === "Bool");
193
+ }
194
+ /**
195
+ * Checks if the provided switch statement contains any conditional break
196
+ * @param switchStmt - The switch statement to analyze
197
+ * @returns Returns true if the switch statement contains a conditional break, otherwise false
198
+ */
199
+ export function switchHasConditionalBreak(switchStmt) {
200
+ return Query.searchFrom(switchStmt, Break, { currentRegion: region => region.astId !== switchStmt.astId, enclosingStmt: jp => jp.astId === switchStmt.astId }).get().length > 0;
201
+ }
202
+ //# sourceMappingURL=utils.js.map
@@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QACD,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAA;IACnD,CAAC;IACD,OAAO,eAAe,CAAC,MAAM,CAAC;AAClC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,UAAkB;IACxD,OAAO,UAAU,CAAC,SAAS,YAAY,QAAQ;QACvC,CAAC,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC;YACpC,UAAU,CAAC,SAAS,CAAC,IAAI,YAAY,WAAW;YAC/C,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,KAAK,MAAM,CACjD,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,UAAkB;IACxD,OAAO,KAAK,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,UAAU,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,KAAK,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;AACpL,CAAC"}
package/jest.config.js CHANGED
@@ -1,14 +1,14 @@
1
- import { weaverConfig } from "clava-js/code/WeaverConfiguration.js";
1
+ import { weaverConfig } from "@specs-feup/clava/code/WeaverConfiguration.js";
2
2
 
3
3
  const config = {
4
4
  preset: "ts-jest/presets/default-esm",
5
- testEnvironment: "lara-js/jest/jestEnvironment.js",
5
+ testEnvironment: "@specs-feup/lara/jest/jestEnvironment.js",
6
6
  testEnvironmentOptions: {
7
7
  weaverConfig,
8
8
  },
9
- globalSetup: "lara-js/jest/jestGlobalSetup.js",
10
- globalTeardown: "lara-js/jest/jestGlobalTeardown.js",
11
- setupFiles: ["lara-js/jest/setupFiles/sharedJavaModule.js"],
9
+ globalSetup: "@specs-feup/lara/jest/jestGlobalSetup.js",
10
+ globalTeardown: "@specs-feup/lara/jest/jestGlobalTeardown.js",
11
+ setupFiles: ["@specs-feup/lara/jest/setupFiles/sharedJavaModule.js"],
12
12
  //notify: true,
13
13
  //notifyMode: "always",
14
14
  //verbose: true,
@@ -22,4 +22,4 @@ const config = {
22
22
  }
23
23
  };
24
24
 
25
- export default config;
25
+ export default config;
package/package.json CHANGED
@@ -1,23 +1,59 @@
1
1
  {
2
2
  "name": "@specs-feup/clava-misra",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "author": "L. Sousa",
5
- "description": "A template for developing projects for Clava in Typescript",
5
+ "description": "Clava library to automatically detect and correct violations of the MISRA-C:2012 standard in C code",
6
6
  "type": "module",
7
+ "files": [
8
+ "dist",
9
+ "src",
10
+ "jest.config.js",
11
+ ".gitignore",
12
+ "package.json",
13
+ "README.md",
14
+ "tsconfig.jest.json",
15
+ "tsconfig.json",
16
+ "typedoc.config.js"
17
+ ],
7
18
  "scripts": {
8
- "run": "npx clava classic dist/main.js -p CxxSources/",
19
+ "run": "cross-env-shell \"if [ $(uname) = 'Darwin' ] || [ $(uname) = 'Linux' ]; then npm run run:macos-linux; else npm run run:windows; fi\"",
20
+ "run:windows": "cross-env STD_VERSION=%npm_config_std% npx clava classic dist/main.js -pi -std %npm_config_std% -p CxxSources/",
21
+ "run:macos-linux": "cross-env STD_VERSION=$npm_config_std npx clava classic dist/main.js -pi -std $npm_config_std -p CxxSources/",
9
22
  "build": "tsc",
10
23
  "build:watch": "tsc --watch",
11
24
  "lint": "eslint .",
12
25
  "docs": "typedoc",
13
- "test": "cross-env NODE_OPTIONS='$NODE_OPTIONS --experimental-vm-modules' jest --detectOpenHandles --forceExit src",
26
+ "test": "npm run test:c90 && npm run test:c99 && npm run test:c11",
27
+ "test:c90": "cross-env STD_VERSION=c90 NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --detectOpenHandles --forceExit src --std=c90",
28
+ "test:c99": "cross-env STD_VERSION=c99 NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --detectOpenHandles --forceExit src --std=c99",
29
+ "test:c11": "cross-env STD_VERSION=c11 NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --detectOpenHandles --forceExit src --std=c11",
14
30
  "test:cov": "npm run test -- --coverage",
15
31
  "test:watch": "npm run test -- --watch"
16
32
  },
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/specs-feup/clava-misra.git"
36
+ },
17
37
  "dependencies": {
18
- "@specs-feup/clava": "^3.0.5",
19
- "@specs-feup/clava-visualization": "^1.0.4",
20
- "@specs-feup/lara-visualization": "^1.0.3",
21
- "@specs-feup/lara": "^3.0.4"
38
+ "@specs-feup/clava": "^3.0.11",
39
+ "@specs-feup/clava-visualization": "^1.0.5",
40
+ "@specs-feup/lara": "^3.0.5"
41
+ },
42
+ "devDependencies": {
43
+ "@jest/globals": "^29.7.0",
44
+ "@specs-feup/clava": "^3.0.11",
45
+ "@specs-feup/lara": "^3.0.4",
46
+ "@types/jest": "^29.5.14",
47
+ "@typescript-eslint/eslint-plugin": "^7.16.0",
48
+ "@typescript-eslint/parser": "^7.16.0",
49
+ "cross-env": "^7.0.3",
50
+ "eslint": "^8.57.0",
51
+ "eslint-config-prettier": "^9.1.0",
52
+ "eslint-plugin-jest": "^28.6.0",
53
+ "eslint-plugin-tsdoc": "^0.2.17",
54
+ "jest": "^29.7.0",
55
+ "ts-jest": "^29.2.5",
56
+ "typedoc": "^0.26.4",
57
+ "typescript": "^5.5.3"
22
58
  }
23
59
  }