{"id":15910510,"url":"https://github.com/rmuntani/trace2","last_synced_at":"2026-04-29T00:02:15.152Z","repository":{"id":59157880,"uuid":"237543511","full_name":"rmuntani/trace2","owner":"rmuntani","description":"Generate a graph of relationships between classes that are used during a runtime!","archived":false,"fork":false,"pushed_at":"2020-11-21T01:53:54.000Z","size":597,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-05T20:27:00.523Z","etag":null,"topics":["c","dependencies","dependency-graph","metadata","ruby","tracing"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rmuntani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-01T01:14:09.000Z","updated_at":"2020-11-21T01:53:57.000Z","dependencies_parsed_at":"2022-09-13T20:10:21.636Z","dependency_job_id":null,"html_url":"https://github.com/rmuntani/trace2","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rmuntani/trace2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmuntani%2Ftrace2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmuntani%2Ftrace2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmuntani%2Ftrace2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmuntani%2Ftrace2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rmuntani","download_url":"https://codeload.github.com/rmuntani/trace2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmuntani%2Ftrace2/sbom","scorecard":{"id":779186,"data":{"date":"2025-08-11","repo":{"name":"github.com/rmuntani/trace2","commit":"1aee140bb82fa3a89fbf9a94c95850c58037cf9d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"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":-1,"reason":"no workflows found","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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"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":-1,"reason":"no dependencies found","details":null,"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":"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":"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":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":"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":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"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"}}]},"last_synced_at":"2025-08-23T04:28:43.906Z","repository_id":59157880,"created_at":"2025-08-23T04:28:43.906Z","updated_at":"2025-08-23T04:28:43.906Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32404340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","dependencies","dependency-graph","metadata","ruby","tracing"],"created_at":"2024-10-06T15:07:30.250Z","updated_at":"2026-04-29T00:02:15.125Z","avatar_url":"https://github.com/rmuntani.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# trace2\n\n[![Build Status](https://travis-ci.com/rmuntani/trace2.svg?token=gGSbpzs6LoB4NK7r6mp6\u0026branch=master)](https://travis-ci.com/rmuntani/trace2)\n\nGenerate a graph of relationships between classes that are used during a runtime!\n\n## Installation\n\n```bash\ngem install trace2\n```\n\nIf you want to automatically generate a visual representation\nof your graph, install [graphviz](https://graphviz.org/download/).\n\n## Usage\n\n### On the command line\n\ntrace2's runner should be used with other Ruby executables:\n\n```bash\ntrace2 executable\n```\n\n```bash\ntrace2 rspec\ntrace2 rubocop -a  # executable's options are supported\ntrace2 my_script.rb  # ruby scripts are also supported\n```\n\nCheck [trace2-examples](https://github.com/rmuntani/trace2-examples) for detailed\nexamples.\n\n#### Options\n\n```bash\ntrace2 --help\nUsage: trace2 [options] RUBY_EXECUTABLE [executable options]\n    -h, --help                       Display help\n    -v, --version                    Show trace2 version\n        --filter FILTER_PATH         Specify a filter file. Defaults to .trace2.yml\n    -o, --output OUTPUT_PATH         Output path for the report file. Defaults to\n                                     ./trace2_report.yml\n    -t, --type TOOLS_TYPE            Type of the tools that will be used to generate the\n                                     relationship between classes. Possible values:\n                                     ruby or native. Defaults to native.\n        --format FORMAT              Format that will be used to render the relationship's\n                                     graph. Has no effect if the manual option is set.\n                                     Defaults to pdf.\n    -m, --manual                     Don't try to render the relationships graph automatically\n```\n\n```bash\ntrace2 --format png rspec spec/trace2/runner_spec.rb  # creates a .dot file and an image\ntrace2 --manual rspec spec/trace2/runner_spec.rb  # creates only a .dot file\n```\n\n### On an application\n\n```ruby\nrequire 'trace2'\n\nfilter = []\ntools = ReportingToolsFactory.new.build(filter)\ntools[:class_lister].enable\n... # code that will be analyzed\ntools[:class_lister].disable\ntools[:graph_generator].run('/path/to/file', tools[:class_lister]) # generate a .dot file\n                                                                   # with the relationships\n                                                                   # between classes\ntools[:class_lister].classes_uses # see what was registered\n```\n\n## Filters\n\n### Format\n\nThe filters are used to remove classes uses out of reports or lists that are\nregistered. A filter is an array of hashes, in which each hash can have up to\ntwo keys: `allow` and `reject`. An `allow` key will only let through classes uses\nthat match the filters that are values of the 'allow'. A `reject` filter will\nnot let through classes uses that match the values of the key.\n\n```ruby\n[{ reject: validations }, { allow: validations }]\n```\n\nEach validation is an array of hashes, in which eash validation represents\nan attribute that should be validated against a class use.\n\n```ruby\n[{ allow: [{ method: ['new'], name: ['MyName', 'YourName'] }] }] # checks if class has\n                                                                 # a methods named new and\n                                                                 # it's name is MyName or YourName\n```\n\nTo execute an OR statement:\n\n```ruby\n[{ allow: [{ method: ['new'] }, { name: ['MyName'] }] }] # class use has method\n                                                         # 'new' or name 'MyName'\n```\n\nTo execute an AND statement:\n```ruby\n# class use has method `new` and name `MyClass`\n[\n  { allow: [{ method: ['new'] } },\n  { allow: [{ name: ['MyClass'] }\n]\n```\n\n### Possible validations\n\nThe filters described bellow work both for Ruby and the extension.\n\n|validation name   | effect                                                                     | possible values  |\n|------------------|----------------------------------------------------------------------------|------------------|\n| name             | check if class name is equal to any of the possible values                 | array of Regex   |\n| method           | check if class method is equal to any of the possible values               | array of Regex   |\n| path             | check if class path is equal to any of the possible values                 | array of Regex   |\n| lineno           | check if the line number is equal to any of the possible values            | array of Integers|\n| top_of_stack     | check if class has callees and if the result is equal to the expected value| true or false    |\n| bottom_of_stack  | check if class has callers and if the result is equal to the expected value| true or false    |\n\n### Building a filter\n\nA filter that is on .trace2_filter.yml is loaded automatically and\nused with trace2's runner, but it can be quite troublesome to generate\na valid YAML file. The following snippet shows a simple procedure to create\nit's content:\n\n```ruby\n\u003e require 'yaml'\n\u003e filter = [{ allow: [{ name: ['Tests'] }]}, { allow: [{ name: [/Not/] }, { method: [/yes/, /no/] }] }]\n\n\u003e puts filter.to_yaml\n---\n- :allow:\n  - :name:\n    - Tests\n- :allow:\n  - :name:\n    - !ruby/regexp /Not/\n  - :method:\n    - !ruby/regexp /yes/\n    - !ruby/regexp /no/\n```\n\n## Native and Ruby code\n\nThe first few tests that involved Ruby code showed that it was too slow for\nthe main goal of this gem. Running rubocop on this project is enough to prove\nit:\n\n```ruby\ntrace2 rubocop --type ruby\n```\n\nDespite that, to allow users of this gem to extend it and have some understanding\nof how it works, some classes were written both in Ruby and in native code. The\nclasses that were implemented both in C and Ruby are EventProcessorC and EventProcessor,\nas well as GraphGenerator and GraphGeneratorC.\n\n## Development\n\n### Running ruby tests\n\n```bash\nscript/test_ruby.sh\n```\n\n### Running extension's tests\n\nMake sure that `munit.c` and `munit.h` are inside the `ext/test/munit` folder.\nBoth files can be found at [µnit](https://github.com/nemequ/munit). The\nfollowing script may also be used:\n\n```bash\nscripts/get_munit.sh\n```\n\nAfter that:\n\n```bash\nscripts/test_extension.sh\n```\n\n### Running Valgrind\n\nValgrind is a tool used to detect memory leaks and improper use of memory. To run\nit, first install Valgrind. After installing it:\n\n```bash\nscripts/run_valgrind.sh\n```\n\n### Build and install the gem\n\n```bash\nscripts/build_gem.sh\n```\n\n### Recompile extension\n\n```bash\nscripts/recompile_extension.sh\n```\n\n### Update gem's version from the command-line\n\n```bash\nscripts/update_version.sh\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmuntani%2Ftrace2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frmuntani%2Ftrace2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmuntani%2Ftrace2/lists"}