{"id":13506745,"url":"https://github.com/matzeschmid/Cppcheck-HIS-addon","last_synced_at":"2025-03-30T05:31:21.925Z","repository":{"id":53571610,"uuid":"225667023","full_name":"matzeschmid/Cppcheck-HIS-addon","owner":"matzeschmid","description":"HIS metric python addon for Cppcheck","archived":false,"fork":false,"pushed_at":"2025-03-12T10:14:52.000Z","size":85,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-12T11:24:58.594Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matzeschmid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-03T16:32:26.000Z","updated_at":"2025-03-12T10:14:55.000Z","dependencies_parsed_at":"2024-09-09T16:08:43.474Z","dependency_job_id":null,"html_url":"https://github.com/matzeschmid/Cppcheck-HIS-addon","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matzeschmid%2FCppcheck-HIS-addon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matzeschmid%2FCppcheck-HIS-addon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matzeschmid%2FCppcheck-HIS-addon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matzeschmid%2FCppcheck-HIS-addon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matzeschmid","download_url":"https://codeload.github.com/matzeschmid/Cppcheck-HIS-addon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246281099,"owners_count":20752203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T01:00:56.615Z","updated_at":"2025-03-30T05:31:21.919Z","avatar_url":"https://github.com/matzeschmid.png","language":"Python","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# Cppcheck-HIS-addon\nHIS metric python addon for Cppcheck.\n\nThis addon depends on functionality provided by `cppcheckdata.py` which is part of Cppcheck `addons` directory.\n\nThis addon has been tested \n  - with Cppcheck Release v1.84 up to v2.17.1\n  - using Python 2.7.x as well as 3.8.x\n  - using Python 3.10 (Windows 10 only)\n  - on a machine running 64-bit Ubuntu 20.10\n  - on a machine running 64-bit Windows 10\n\n**NOTE:** Since Cppcheck v2.8 there is a `pathlib` module dependency. This module has been introduced with Python 3.4 . For earlier Python versions use `pip` to install it.\n\n# Supported HIS metric checks\nThe following metrics are checked according to document `HIS source code metrics v1.3.1` .\n\n| Metric | Description | Range | Note |\n| ------ | ----------- |:-----:|:----:|\n| HIS-COMF | Relationship of comments to number of statements | \u003e 0.2 | |\n| HIS-PATH | Number of non cyclic remark paths | 1-80 | Experimental, not finished yet! |\n| HIS-GOTO | Number of goto statements | 0 | |\n| HIS-STCYC | Cyclomatic complexity v(G) of functions by McCabe | 1-10 | |\n| HIS-CALLING | Number of subfunctions calling a function | 0-5 | |\n| HIS-CALLS | Number of called functions excluding duplicates | 0-7 | |\n| HIS-PARAM | Number of function parameters | 0-5 | |\n| HIS-STMT | Number of statements per function | 1-50 | |\n| HIS-LEVEL | Depth of nesting of a function | 0-4 | |\n| HIS-RETURN | Number of return points within a function | 0-1 | |\n| HIS-VOCF | Language scope | 1-4 | Experimental, not finished yet! |\n| HIS-NRECUR | Number of recursions | 0 | |\n\n# Missing HIS metric checks\nThe following metrics part of document `HIS source code metrics v1.3.1` are not checked.\n\n| Metric | Description | Note |\n| ------ | ----------- |:-----:|\n| HIS-SI | Stability index | Not supported |\n| HIS-NOMV | Number of MISRA HIS Subset violations | Not supported |\n| HIS-NOMVPR | Number of MISRA HIS Subset violations per rule | Not supported |\n| HIS-SCHG | Number of changed statements | Not supported |\n| HIS-SDEL | Number of deleted statements | Not supported |\n| HIS-SNEW | Number of new statements | Not supported |\n\n\n# Installation\nDirectories are the same as for Cppcheck addons.\n  - Copy `his.py` to `addons` directory of Cppcheck installation.\n  - Optional: For test purposes copy test pattern files from `addons/test` to corresponding directory of Cppcheck installation.\n\n# Usage\nRun `python his.py -h` or `python his.py --help` to get help on how to use HIS metric addon and show which command line options are available.\n\nHIS metric addon uses first configuration of Cppcheck dump file(s) only. Thus create dump files for desired configuration using Cppcheck with command line options or project file.\n\n**Example how to use HIS addon with HIS metric test pattern files on a Linux machine.**\n\n1. Create a dump file for the source files which are desired to be checked.\n\n   `$\u003e ~/cppcheck/cppcheck --dump ~/cppcheck/cppcheck/addons/test/his-test.c ~/cppcheck/cppcheck/addons/test/his-test-calling.c`\n\n2. Run HIS metric checker using dump files created during previous step.\n\n   `$\u003e python ~/cppcheck/addons/his.py ~/cppcheck/cppcheck/addons/test/his-test.c.dump ~/cppcheck/cppcheck/addons/test/his-test-calling.c.dump`\n\n**Example how to call HIS addon from Cppcheck with HIS metric test pattern files on a Linux machine.**\n\nCall HIS addon for files `his-test.c` and `his-test-calling.c` and write result to `his.xml`.\n\n`$\u003e ~/cppcheck/cppcheck --addon=his --xml --output-file=his.xml ~/cppcheck/cppcheck/addons/test/his-test.c ~/cppcheck/cppcheck/addons/test/his-test-calling.c`\n\n**NOTE:** Calling HIS addon from Cppcheck using command line option --addon might suppress HIS-CALLING, HIS-NRECUR and HIS-VOCF violations depending on multiple files because addon is called for each dump file separatly.\n\n**NOTE:** Command line option --addon is available since Cppcheck v1.88 .\n\n**Example how to suppress metrics (e.g. HIS-GOTO and HIS-PARAM)**\n\n    `$\u003e python ~/cppcheck/addons/his.py --suppress-metrics GOTO,PARAM ~/cppcheck/cppcheck/addons/test/his-test.c.dump ~/cppcheck/cppcheck/addons/test/his-test-calling.c.dump`\n    \n**Example how to modify upper limit of metrics (e.g. HIS-RETURN and HIS-PARAM)**\n\n    `$\u003e python ~/cppcheck/addons/his.py --modify-metrics RETURN:2,PARAM:6 ~/cppcheck/cppcheck/addons/test/his-test.c.dump ~/cppcheck/cppcheck/addons/test/his-test-calling.c.dump`\n\n    Upper limit of following metrics could be modified: PATH, STCYC, CALLING, CALLS, PARAM, STMT, LEVEL, RETURN\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatzeschmid%2FCppcheck-HIS-addon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatzeschmid%2FCppcheck-HIS-addon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatzeschmid%2FCppcheck-HIS-addon/lists"}