{"id":13961536,"url":"https://github.com/borkdude/analyze-reify","last_synced_at":"2025-05-06T18:49:04.473Z","repository":{"id":142283175,"uuid":"246349462","full_name":"borkdude/analyze-reify","owner":"borkdude","description":"Analyze occurrences of reify in Clojure code. Implemented using tree-sitter-clojure and Rust.","archived":false,"fork":false,"pushed_at":"2020-03-20T10:39:48.000Z","size":30,"stargazers_count":18,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T01:51:16.403Z","etag":null,"topics":["clojure","rust","tree-sitter"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/borkdude.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}},"created_at":"2020-03-10T16:16:32.000Z","updated_at":"2025-02-20T20:50:37.000Z","dependencies_parsed_at":"2024-01-15T03:59:43.215Z","dependency_job_id":"a1f6a5df-97ab-4281-9c49-075f797dba2c","html_url":"https://github.com/borkdude/analyze-reify","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/borkdude%2Fanalyze-reify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borkdude%2Fanalyze-reify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borkdude%2Fanalyze-reify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borkdude%2Fanalyze-reify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/borkdude","download_url":"https://codeload.github.com/borkdude/analyze-reify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252749777,"owners_count":21798595,"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":["clojure","rust","tree-sitter"],"created_at":"2024-08-08T17:01:14.332Z","updated_at":"2025-05-06T18:49:04.448Z","avatar_url":"https://github.com/borkdude.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# analyze-reify\n\nThis project analyzes [Clojure](http://clojure.org/) code for occurrences of\n`reify` and lists the reified interfaces and protocols. It is implemented using\n[tree-sitter-clojure](https://github.com/sogaiu/tree-sitter-clojure) and\n[Rust](https://www.rust-lang.org/).\n\n## Rationale\n\nThis is more a proof of concept than a public facing tool, although it does\nsolve a real problem for me. I wanted to know the most popular reified\ninterfaces so I could decide if it made sense supporting `reify` in\n[babashka](https://github.com/borkdude/babashka/). Also I am curious about both\n[Rust](https://www.rust-lang.org/) and\n[tree-sitter](https://github.com/tree-sitter/) so this seemed like a nice\noppurtunity to combine the two.\n\n## Results\n\nFor simple analyses like this it seems a tree-sitter based approach is\nfeasible. Performance is better than parsing Clojure code into reified data\nstructures. For comparison, walking over the ASTs in `clojure/core.clj` takes\nonly around 50ms whereas in a tools.reader based solution it takes around\n200ms. This is by no means a scientific benchmark. More research needed.\n\n```\nProcessed 829 files in 731ms. 😎\n```\n\n## Build\n\nClone the repo including the submodule:\n\n```\n$ git clone https://github.com/borkdude/analyze-reify --recursive\n$ cd analyze-reify\n```\n\nThen build the `tree-sitter-clojure` source. Note: this script\nrequires `npm`.\n\n```\n$ script/tree-sitter-clojure\n```\n\nThen build with the Rust build tool `cargo`:\n\n```\n$ cargo build --release\n```\n\nor install the tool on to your system:\n\n```\n$ cargo install --path .\n```\n\n## Usage\n\nProvide one or multiple paths (files, directories or .jar files) to\n`analyze-reify`. It will scan for `.clj` files and analyze them.\n\n```\n$ analyze-reify ~/git/clojure\nclojure.core.protocols/CollReduce\nclojure.core.ArrayManager\nclojure.lang.IDeref\n...\n\nProcessed 160 files in 111ms. 😎\n```\n\nTo get a sorted frequency list, you can combine this tool with\n[babashka](https://github.com/borkdude/babashka/):\n\n```\n$ analyze-reify ~/git/clojure | bb -io '(-\u003e\u003e *input* frequencies (sort-by second \u003e))'\nProcessed 160 files in 101ms. 😎\n[clojure.core.protocols/CollReduce 4]\n[clojure.lang.IDeref 4]\n[clojure.core.ArrayManager 2]\n[java.util.List 2]\n[java.util.Iterator 2]\n[Elusive 2]\n[java.util.ListIterator 2]\n[Object 1]\n[clojure.lang.ISeq 1]\n[clojure.lang.IReduceInit 1]\n[clojure.test_clojure.protocols.examples.ExampleInterface 1]\n```\n\n## Thanks\n\nThanks to [sogaiu](https://github.com/sogaiu/) for taking the time to implement\n[tree-sitter-clojure](https://github.com/sogaiu/tree-sitter-clojure).\n\n## License\n\nCopyright © 2020 Michiel Borkent\n\nDistributed under the MIT License. See LICENSE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborkdude%2Fanalyze-reify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fborkdude%2Fanalyze-reify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborkdude%2Fanalyze-reify/lists"}