{"id":17366750,"url":"https://github.com/tierra-colada/cppguts","last_synced_at":"2026-05-09T06:02:47.063Z","repository":{"id":46973302,"uuid":"407917646","full_name":"tierra-colada/cppguts","owner":"tierra-colada","description":"Tool aimed at C/C++ source code correction that allows to automatically find and copy/paste new function definition","archived":false,"fork":false,"pushed_at":"2022-05-26T18:57:45.000Z","size":69,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-07T02:13:57.730Z","etag":null,"topics":["c","cpp","edit-c","edit-cpp","parse","parse-c","parse-cpp","parser-c","parser-cpp","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tierra-colada.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}},"created_at":"2021-09-18T16:56:46.000Z","updated_at":"2021-10-11T15:36:24.000Z","dependencies_parsed_at":"2022-08-30T08:30:53.181Z","dependency_job_id":null,"html_url":"https://github.com/tierra-colada/cppguts","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/tierra-colada/cppguts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tierra-colada%2Fcppguts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tierra-colada%2Fcppguts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tierra-colada%2Fcppguts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tierra-colada%2Fcppguts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tierra-colada","download_url":"https://codeload.github.com/tierra-colada/cppguts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tierra-colada%2Fcppguts/sbom","scorecard":{"id":884974,"data":{"date":"2025-08-11","repo":{"name":"github.com/tierra-colada/cppguts","commit":"473e1462e11a1d081e9a4dad7efb3867ba02355c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.1,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/27 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":6,"reason":"binaries present in source code","details":["Warn: binary detected: cppguts/__pycache__/__init__.cpython-38.pyc:1","Warn: binary detected: cppguts/__pycache__/editcpp.cpython-38.pyc:1","Warn: binary detected: cppguts/tests/__pycache__/__init__.cpython-38.pyc:1","Warn: binary detected: cppguts/tests/__pycache__/test_cppguts.cpython-38.pyc:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/tierra-colada/cppguts/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/tierra-colada/cppguts/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:81: update your workflow using https://app.stepsecurity.io/secureworkflow/tierra-colada/cppguts/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:83: update your workflow using https://app.stepsecurity.io/secureworkflow/tierra-colada/cppguts/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/tierra-colada/cppguts/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/tierra-colada/cppguts/main.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/main.yml:63","Warn: pipCommand not pinned by hash: .github/workflows/main.yml:64","Warn: pipCommand not pinned by hash: .github/workflows/main.yml:38","Warn: pipCommand not pinned by hash: .github/workflows/main.yml:39","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   4 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 5 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-24T09:39:52.440Z","repository_id":46973302,"created_at":"2025-08-24T09:39:52.441Z","updated_at":"2025-08-24T09:39:52.441Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32809147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["c","cpp","edit-c","edit-cpp","parse","parse-c","parse-cpp","parser-c","parser-cpp","python"],"created_at":"2024-10-15T22:04:39.380Z","updated_at":"2026-05-09T06:02:47.040Z","avatar_url":"https://github.com/tierra-colada.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cppguts\nIf your project depends on some external C/C++ projects and \nyou want to make some changes in external functions/methods \nand then copy/paste these changes automatically - this package may help you. \n\nThere are two tools:\n1) `editcpp` used to edit source code;\n2) `dumpcpp` used to print some information about C/C++ translation units\n\nWe will discuss `editcpp` as it is the objective tool.\n\n**`editcpp` doesn't work with templates.**\n\nSame tool aimed at editing `python` files is also available as [pythonguts](https://github.com/tierra-colada/pythonguts)\n\n## Installation\n`cppguts` is available at [PyPI](https://pypi.org/project/cppguts/):\n\n```bash\npip install cppguts\n```\n\n## The idea behind `editcpp` tool\n`editcpp` uses `libclang` to find function/method definition start/end lines in text file (`.c`, `.h`, `.hpp`, `.cpp` or whatever C/C++ extension). `libclang` parses each `dest.cpp` and `src.cpp` and everything that is\nincluded by `#include` preprocessor directives. Then `editcpp` tool\nselects all functions and methods defined in `dest.cpp` and `src.cpp` \n(it assumes that you know where old and new function/method definition resides) and tries to find matching functions/methods. After that `editcpp` copies function/method definition from `src.cpp` and pastes it to the `dest.cpp` while deleting old funcion/method definition.\n\n\u003cins\u003eTo find common function `editcpp` checks:\u003c/ins\u003e\n* are they both _definitions?_\n* are they both _const?_\n* are they both _static?_\n* are they both _vitual?_\n* are they both _functions?_\n* are they both _methods?_\n* do they both have the same name?\n* do they both have the same return type and arg types?\n* do they both have the same semantic parent (classname)? (for methods only)\n\n## Notes\n\n* you are free to pass any clang argument after `editcpp` otions but don't pass file without flag to clang (as we usually do when using clang)\n* if you parse files that includes non standard headers then you probably need to pass `-I\u003cinclude_dir\u003e` flag to clang to include directories;\n* if you parse `C++` files then it may be necessary to pass `-std=c++03` (or higher) flag to inform clang that the file is `C++`;\n* if your new function/method definition uses external types then\nthese types must be preliminary declared (not necessary to define them);\n\nRemember that after `editcpp` finds common functions/methods\nit will simply copy selected text lines from one file to another\n\n## Example\noriginal function/method definition file **dest.h**:\n ```cpp\n#include \u003ciostream\u003e\n\n// helper class that is used by the target class `Src`\nclass SrcPrivate {\npublic:\n  SrcPrivate(){};\n\n  void add(int v){\n    val += v;\n  }\n\n  void substract(int v){\n    val -= v;\n  }\n\nprivate:\n  int val;\n}\n\n// target class\nclass Src {\n  // method defined inside the class\n  void add(SrcPrivate p, int v){\n    p.add(v);\n  }\n\n// method defined outside the class\n  void substract(SrcPrivate p, int v);\n\n// we won't tuch this method\n  void untouched_print(int v){\n    std::cout \u003c\u003c \"The value is:\\t\" \u003c\u003c v \u003c\u003c std::endl;\n  }\n}\n\nvoid Src::substract(SrcPrivate p, int v){\n  p.substract(v);\n}\n\n// simple function\nvoid foo(int \u0026v){\n  v--;\n}\n\nnamespace ns {\n  // function in namespace\n  void bar(int \u0026v){\n    v++;\n  }\n}\n```\n\nnew function/method definition file **src.h**:\n```cpp\nclass SrcPrivate;   // declare helper type\n\n// target class\nclass Src {\n  // NEW method definition inside class\n  void add(SrcPrivate p, int v){\n\n    p.add(v) + 10;\n\n  }\n\n  // NEW method definition ouside class\n  void substract(SrcPrivate p, int v);\n}\n\nvoid Src::substract(SrcPrivate p, int v){\n  p.substract(v) - 10;\n}\n\n// NEW simple function definition \nvoid foo(int \u0026v){\n  v -= 10;\n}\n\n// NEW function definition in namespace\nnamespace ns {\n  void bar(int \u0026v){\n    v += 10;\n  }\n}\n```\nRun: \n\n`editcpp --src-file=src.h --dest-file=dest.h --oldfile-keep -std=c++03`\n\nThe `-std=c++03` tells the clang to parse the files as C++. Also you may need to use any other clang flags like `-I` to include directories that are required by the files.\n\n`--oldfile-keep` (default) is used to keep the original file (it will be renamed by adding `_OLD_N` suffix). Otherwise use `--oldfile-delete` to delete the original file.\n\nAnother option is to run the test (though the test deletes all the generated files so you better take a look in `/tests` dir):\n\n`python -m unittest cppguts.tests.test_cppguts`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftierra-colada%2Fcppguts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftierra-colada%2Fcppguts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftierra-colada%2Fcppguts/lists"}