{"id":16847479,"url":"https://github.com/indygreg/clanalyze","last_synced_at":"2025-04-11T06:33:14.659Z","repository":{"id":2181763,"uuid":"3129114","full_name":"indygreg/clanalyze","owner":"indygreg","description":"C/C++ code analyzer framework built on top of Clang","archived":false,"fork":false,"pushed_at":"2012-01-11T06:47:55.000Z","size":108,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-03T17:11:18.475Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/indygreg.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-08T09:00:15.000Z","updated_at":"2024-06-04T00:48:27.000Z","dependencies_parsed_at":"2022-07-10T03:30:51.549Z","dependency_job_id":null,"html_url":"https://github.com/indygreg/clanalyze","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/indygreg%2Fclanalyze","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indygreg%2Fclanalyze/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indygreg%2Fclanalyze/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indygreg%2Fclanalyze/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indygreg","download_url":"https://codeload.github.com/indygreg/clanalyze/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239562183,"owners_count":19659602,"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-10-13T13:08:05.944Z","updated_at":"2025-02-18T22:31:19.949Z","avatar_url":"https://github.com/indygreg.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"=========\nClanalyze\n=========\n\nClanalyze is a C language analyzer. The goal of Clanalyze is to provide a\nframework by which people can easily consume parsed C language files, including\nC, C++, and Objective-C.\n\nUsing Clanalyze, it is possible to easily write tools that:\n\n* Check C/C++ style conventions\n* Perform compiler-like warnings\n* Build documentation from C/C++ source files\n* Perform static analysis\n\nClanalyze is built on top of Clang, the C language compiler that is part of the\nLLVM project. Clanalyze supplements the low-level Python bindings provided by\nClang with higher-level, easier-to-consume APIs for tool writers.\n\nClanalyze was originally authored by Gregory Szorc \u003cgregory.szorc@gmail.com\u003e.\n\nRequirements\n============\n\nClanalyze requires Clang and the Clang Python bindings.\n\nAs part of developing Clanalyze, the author of Clanalyze needed to add\nfunctionality to the Clang Python bindings. The state of those changes is\nas follows:\n\n* Support for C++ access specifiers - Patch not yet submitted.\n* Support for token access - Patch not yet submitted.\n\nUntil all the above changes are merged into Clang's source tree and released,\nyou probably don't have them available on your machine. Fortunately, the\nClang Python bindings are located in a self-contained .py file. So, all you\nneed to do is fetch an updated copy of that file and make it available in your\nPYTHONPATH.\n\nThe author of Clanalyze maintains a branch with all pending Clang Python\nbinding changes at https://github.com/indygreg/clang/tree/python_features.\nThe Python file you want can be downloaded directly from:\n\nhttps://raw.github.com/indygreg/clang/python_features/bindings/python/clang/cindex.py\n\nTechnical Overview\n==================\n\nClanalyze provides a basic observer framework for entities (i.e. Python classes)\nwishing to react to events/entities in parsed C-family source code.\n\nThe general usage looks something like the following:\n\n# Create a clanalyze.parser.Parser() instance\n# Register observers with the parser\n# Parse source code using Parser.parse()\n# (Observers get called for observed events, perform side-effects)\n# Profit\n\nWriting Observers\n-----------------\n\nTo do something useful with Clanalyze, you'll want to write an observer.\nWriting an observer is as simple as creating a Python class that uses one\nof the built-in abstract observer base classes as its parent.\n\nYou have the following choices for observers:\n\n* DefinitionObserver - Consumes high-level entity definitions, such as classes,\n  structs, and functions which are derived from the AST. Basically, Clanalyze\n  takes the low-level AST cursor stream and converts it into friendly Python\n  objects.  This is a real value-add of Clanalyze, as it saves you from having to\n  reimplement low-level logic interacting with the Clang parser.\n\n* CursorObserver - Consumes raw Clang AST cursor stream. This is very low-level\n  and very close to the Clang API. If you are using this API, Clanalyze doesn't\n  really provide much incremental benefit over consuming the Python Clang API\n  directly.\n\nWhen writing observers, it is important to conform to the API they have\nprovided. See the documentation in the base classes for details.\n\nLicensing\n=========\n\nClanalyze is currently licensed under version 2.0 of the Mozilla Public License.\nThe full license can be seen at https://www.mozilla.org/MPL/2.0/. If this\nlicense is not satisfactory, please contact the author for consideration on\nissuing a version with a different license.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findygreg%2Fclanalyze","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findygreg%2Fclanalyze","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findygreg%2Fclanalyze/lists"}