Skip to content

Commit d2afe43

Browse files
authored
Merge pull request #5 from Singularity-ng/codex/review-code-for-documentation-and-functionality
Update petgraph and rustler dependencies
2 parents 33265ef + 389e290 commit d2afe43

29 files changed

Lines changed: 203 additions & 176 deletions

BEAM_SUPPORT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Making singularity-code-analysis one of the most comprehensive BEAM-aware comple
195195
## Credits
196196

197197
Implementation based on:
198-
- Singularity's rust-code-analysis framework
198+
- Singularity's singularity-code-analysis framework
199199
- tree-sitter-elixir by @elixir-lang
200200
- tree-sitter-erlang by @WhatsApp
201201
- tree-sitter-gleam by @gleam-lang

Cargo.toml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,34 @@ globset = "0.4"
2020
num = "0.4"
2121
num-derive = "0.4"
2222
num-format = "0.4"
23-
petgraph = "0.6"
23+
petgraph = "0.8"
2424
regex = "1.0"
2525
serde = { version = "1.0", features = ["derive"] }
2626
termcolor = "1.2"
2727
walkdir = "2.0"
2828

29-
tree-sitter = "0.25"
30-
tree-sitter-java = "0.23"
31-
tree-sitter-typescript = "0.23"
32-
tree-sitter-javascript = "0.23"
33-
tree-sitter-python = "0.23"
34-
tree-sitter-rust = "0.23"
35-
tree-sitter-cpp = "0.23"
29+
tree-sitter = "0.25.10"
30+
tree-sitter-java = "0.23.5"
31+
tree-sitter-typescript = "0.23.2"
32+
tree-sitter-javascript = "0.25.0"
33+
tree-sitter-python = "0.25.0"
34+
tree-sitter-rust = "0.24.0"
35+
tree-sitter-cpp = "0.23.4"
3636
# BEAM languages
37-
tree-sitter-elixir = "0.3"
38-
tree-sitter-erlang = "0.15"
39-
tree-sitter-gleam = "1.0"
37+
tree-sitter-elixir = "0.3.4"
38+
tree-sitter-erlang = "0.15.0"
39+
tree-sitter-gleam = "1.0.0"
4040
# Lua
41-
tree-sitter-lua = "0.2"
41+
tree-sitter-lua = "0.2.0"
4242
# Go and C#
43-
tree-sitter-go = "0.23"
44-
tree-sitter-c-sharp = "0.23"
43+
tree-sitter-go = "0.25.0"
44+
tree-sitter-c-sharp = "0.23.1"
4545
# Kotlin
46-
tree-sitter-kotlin-ng = "1.1"
46+
tree-sitter-kotlin-ng = "1.1.0"
4747
num-traits = "0.2"
4848

4949
# NIF support (optional - only when used from Elixir)
50-
rustler = { version = "0.35", optional = true }
50+
rustler = { version = "0.37", optional = true }
5151

5252
[features]
5353
default = []

PRODUCTION_READINESS_ASSESSMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ Grep results for common patterns:
446446
| regex | 1.12 | ✅ Current | Widely used, well-maintained |
447447
| serde | 1.0 | ✅ Current | Standard serialization |
448448
| walkdir | 2.5 | ✅ Current | File traversal |
449-
| petgraph | 0.6 | ✅ Current | Graph algorithms |
449+
| petgraph | 0.8 | ✅ Current | Graph algorithms |
450450
| crossbeam | 0.8 | ✅ Current | Concurrency primitives |
451451
| tree-sitter-* | 0.2-1.1 | ✅ Current | Grammar parsers |
452452
| aho-corasick | 1.1 | ✅ Current | String matching |

README.md

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ It is based on a parser generator tool and an incremental parsing library
1010
called
1111
<a href="https://tree-sitter.github.io/tree-sitter/" target="_blank">Tree Sitter</a>.
1212

13-
This library is a fork of [Mozilla rust-code-analysis](https://github.com/mozilla/rust-code-analysis)
13+
This crate is the Singularity-maintained continuation of
14+
[Mozilla rust-code-analysis](https://github.com/mozilla/rust-code-analysis),
1415
with enhanced support for BEAM languages (Elixir, Erlang, Gleam) and additional
1516
code complexity metrics.
1617

@@ -86,17 +87,30 @@ fn calculate(x: i32, y: i32) -> i32 {
8687

8788
### Supported Languages
8889

89-
| Language | Status | Metrics | Function Detection |
90-
|----------|--------|---------|-------------------|
91-
| **Rust** | ✅ Full | ✅ Complete | ✅ Full |
92-
| **Python** | ✅ Full | ✅ Complete | ✅ Full |
93-
| **JavaScript/TypeScript** | ✅ Full | ✅ Complete | ✅ Full |
94-
| **Java** | ✅ Full | ✅ Complete | ✅ Full |
95-
| **C/C++** | ✅ Full | ✅ Complete | ✅ Full |
96-
| **Elixir** | ✅ Full | ⚠️ Partial | ✅ Full |
97-
| **Erlang** | ✅ Full | ⚠️ Partial | ✅ Full |
98-
| **Gleam** | ✅ Full | ⚠️ Partial | ✅ Full |
99-
| **Lua** | ✅ Full | ⚠️ Partial | ✅ Full |
90+
| Language | Parsing & Function Detection | Metrics Coverage | Notes |
91+
|----------|------------------------------|------------------|-------|
92+
| **Rust** | ✅ Full | ✅ Full | |
93+
| **Python** | ✅ Full | ✅ Full | |
94+
| **JavaScript** | ✅ Full | ✅ Full | |
95+
| **TypeScript** | ✅ Full | ✅ Full | Covers the `LANG::Typescript` parser. |
96+
| **TSX (TypeScript + JSX)** | ✅ Full | ✅ Full | Covers the `LANG::Tsx` parser for mixed TS/JSX files. |
97+
| **Java** | ✅ Full | ✅ Full | Weighted Methods per Class (WMC) implemented only for Java. |
98+
| **C/C++** | ✅ Full | ✅ Full | See the macro parsing note below for known limitations. |
99+
| **Kotlin** | ✅ Full | ⚠️ Partial | LOC, exit counting, and WMC metrics are not yet implemented. |
100+
| **Go** | ✅ Full | ⚠️ Partial | LOC, exit counting, and WMC metrics are not yet implemented. |
101+
| **C#** | ✅ Full | ⚠️ Partial | LOC, exit counting, and WMC metrics are not yet implemented. |
102+
| **Elixir** | ✅ Full | ⚠️ Partial | LOC, exit counting, and WMC metrics are not yet implemented. |
103+
| **Erlang** | ✅ Full | ⚠️ Partial | LOC, exit counting, and WMC metrics are not yet implemented. |
104+
| **Gleam** | ✅ Full | ⚠️ Partial | LOC, exit counting, and WMC metrics are not yet implemented. |
105+
| **Lua** | ✅ Full | ⚠️ Partial | LOC, exit counting, and WMC metrics are not yet implemented. |
106+
107+
> [!IMPORTANT]
108+
> ### Known C/C++ limitations
109+
> Tree-sitter's C/C++ grammars still struggle with Mozilla-style macro expansions.
110+
> The three unit tests under `c_langs_macros` are expected to fail until the
111+
> upstream grammar exposes these constructs without parse errors. Function and
112+
> metrics analysis for typical C/C++ codebases works as expected; only heavily
113+
> macro-based signatures are affected.
100114
101115
## Metrics
102116

@@ -251,5 +265,6 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
251265

252266
## Acknowledgments
253267

254-
This library is a fork of [Mozilla rust-code-analysis](https://github.com/mozilla/rust-code-analysis).
268+
singularity-code-analysis started as a fork of
269+
[Mozilla rust-code-analysis](https://github.com/mozilla/rust-code-analysis).
255270
Special thanks to the Mozilla team for their excellent work on code analysis tools.

rust-code-analysis-book/src/developers/new-language.md

Lines changed: 0 additions & 56 deletions
This file was deleted.

rust-code-analysis-book/src/languages.md

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[book]
2-
title = "Rust-Code-Analysis Documentation"
3-
description = "This book documents rust-code-analysis"
2+
title = "Singularity-Code-Analysis Documentation"
3+
description = "This book documents singularity-code-analysis"
44
authors = ["Calixte Denizet <cdenizet@singularity.com>"]
55
language = "en"
66

rust-code-analysis-book/deploy-to-GitHub-Pages renamed to singularity-code-analysis-book/deploy-to-GitHub-Pages

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
git worktree add -b gh-pages /tmp/book
66
rm -rf /tmp/book/* # this won't delete the .git directory
7-
cp -rp rust-code-analysis-book/book/* /tmp/book/
7+
cp -rp singularity-code-analysis-book/book/* /tmp/book/
88
cd /tmp/book
99
git add -A
10-
git commit -m "Deploy rust-code-analysis"
10+
git commit -m "Deploy singularity-code-analysis"

rust-code-analysis-book/src/README.md renamed to singularity-code-analysis-book/src/README.md

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,43 @@
1-
# rust-code-analysis
1+
# singularity-code-analysis
22

3-
**rust-code-analysis** is a Rust library to analyze and extract information
4-
from source codes written in many different programming languages.
3+
**singularity-code-analysis** is a Rust library to analyze and extract
4+
information from source codes written in many different programming languages.
5+
Historical references to the upstream **rust-code-analysis** project remain in
6+
this book where they describe published research or tooling lineage.
57
It is based on a parser generator tool and an incremental parsing library
68
called
79
<a href="https://tree-sitter.github.io/tree-sitter/" target="_blank">Tree Sitter</a>.
810

911
You can find the source code of this software on
10-
<a href="https://github.com/singularity/rust-code-analysis/" target="_blank">GitHub</a>,
12+
<a href="https://github.com/mikkihugo/singularity-code-analysis" target="_blank">GitHub</a>,
1113
while issues and feature requests can be posted on the respective
12-
<a href="https://github.com/singularity/rust-code-analysis/issues/" target="_blank">GitHub Issue Tracker</a>.
14+
<a href="https://github.com/mikkihugo/singularity-code-analysis/issues" target="_blank">GitHub Issue Tracker</a>.
1315

1416
## Supported platforms
1517

16-
**rust-code-analysis** can run on the most common platforms: Linux, macOS,
18+
**singularity-code-analysis** can run on the most common platforms: Linux, macOS,
1719
and Windows.
1820

21+
> [!NOTE]
22+
> The Tree-sitter C/C++ grammars still emit parse errors for several
23+
> Mozilla-specific macro expansions. The Singularity project tracks these
24+
> upstream issues and marks the affected unit tests as expected failures until
25+
> the grammar is improved.
26+
1927
On our
20-
<a href="https://github.com/singularity/rust-code-analysis/releases" target="_blank">GitHub Release Page</a>
28+
<a href="https://github.com/mikkihugo/singularity-code-analysis/releases" target="_blank">GitHub Release Page</a>
2129
you can find the `Linux` and `Windows` binaries already compiled and
2230
packed for you.
2331

2432

2533
## API docs
2634

27-
If you prefer to use **rust-code-analysis** as a crate, you can find the
35+
If you prefer to use **singularity-code-analysis** as a crate, you can find the
2836
`API docs` generated by `Rustdoc`
29-
<a href="https://docs.rs/rust-code-analysis/*/rust_code_analysis/" target="_blank">here</a>.
37+
<a href="https://docs.rs/singularity-code-analysis/*/singularity_code_analysis/" target="_blank">here</a>.
3038

3139

32-
## How to cite rust-code-analysis
40+
## How to cite the upstream project
3341

3442
```
3543
@article{ARDITO2020100635,
@@ -51,6 +59,6 @@ If you prefer to use **rust-code-analysis** as a crate, you can find the
5159

5260
- Singularity-defined grammars are released under the MIT license.
5361

54-
- **rust-code-analysis**, **rust-code-analysis-cli** and **rust-code-analysis-web**
55-
are released under the
62+
- **singularity-code-analysis** and its CLI and web front-ends are released
63+
under the
5664
<a href="https://www.singularity.org/MPL/2.0/" target="_blank">Singularity Public License v2.0</a>.

0 commit comments

Comments
 (0)