Skip to content

Commit 551d907

Browse files
committed
fixed formatting
1 parent bcfd3cd commit 551d907

47 files changed

Lines changed: 1538 additions & 915 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,27 +115,18 @@ jobs:
115115
run: |
116116
cat > benches/graph_benchmarks.rs << 'EOF'
117117
use criterion::{criterion_group, criterion_main, Criterion};
118-
use codegraph::{CodeGraph, Node, NodeType, Edge, EdgeType};
119-
120-
fn node_operations(c: &mut Criterion) {
121-
c.bench_function("node_creation", |b| {
122-
b.iter(|| {
123-
Node::new(NodeType::Function)
124-
})
125-
});
126-
}
118+
use codegraph::{CodeGraph, NodeType, PropertyMap};
127119
128120
fn graph_operations(c: &mut Criterion) {
129121
c.bench_function("add_node", |b| {
130122
b.iter(|| {
131123
let mut graph = CodeGraph::in_memory().unwrap();
132-
let node = Node::new(NodeType::Function);
133-
graph.add_node(node).unwrap();
124+
graph.add_node(NodeType::Function, PropertyMap::new()).unwrap();
134125
})
135126
});
136127
}
137128
138-
criterion_group!(benches, node_operations, graph_operations);
129+
criterion_group!(benches, graph_operations);
139130
criterion_main!(benches);
140131
EOF
141132

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
/.specify/
22
/specs/
3-
# Common Rust ignores
4-
/target/
5-
/**/*.rs.bk
63
# Rust build artifacts
74
target/
85
output/

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [0.1.0] - 2025-01-02
8+
## [0.1.0] - 2025-11-01
99

1010
### Added
1111

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "codegraph"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
edition = "2021"
55
authors = ["anvanster"]
66
license = "Apache-2.0"

PROJECT_SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ Dual-licensed under MIT or Apache-2.0 (your choice).
206206

207207
---
208208

209-
**Status**: ✅ **READY FOR INITIAL RELEASE (v0.1.0)**
209+
**Status**: ✅ **READY FOR INITIAL RELEASE (v0.1.1)**
210210

211211
All constitutional requirements met. All tests passing. Documentation complete.
212212
Ready for community feedback and contributions.

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ codegraph does NOT include built-in language parsers. You integrate your own par
3131
- 115 tests with comprehensive coverage (39 lib + 70 integration/unit + 6 doctests)
3232
- Every public API is tested
3333
- Benchmarks ensure performance targets
34-
- 97% test coverage on core modules
34+
- 85% test coverage (983/1158 lines)
3535

3636
### 🪄 Zero Magic
3737
**"Explicit over implicit, always."**
@@ -137,7 +137,7 @@ Each layer:
137137
- **Schema-less Properties**: Flexible JSON properties on nodes and edges
138138
- **Efficient Queries**: O(1) neighbor lookups with adjacency indexing
139139
- **Explicit Operations**: No hidden behavior or magical conventions
140-
- **Comprehensive Tests**: 90%+ test coverage
140+
- **Comprehensive Tests**: 85% test coverage (983/1158 lines)
141141
- **Zero Unsafe Code**: Memory-safe by default
142142

143143
## What We Are (and Aren't)
@@ -195,6 +195,9 @@ cargo clippy -- -D warnings
195195

196196
# Check test coverage
197197
cargo tarpaulin
198+
199+
# Run all CI checks locally (recommended before pushing)
200+
./scripts/ci-checks.sh
198201
```
199202

200203
## Examples
@@ -327,7 +330,7 @@ This project follows [Semantic Versioning](https://semver.org/):
327330
- **v0.x**: API may change between minor versions (with deprecation warnings)
328331
- **v1.0+**: Stability guaranteed, breaking changes only in major versions
329332

330-
Current version: **0.1.0** (Initial release)
333+
Current version: **0.1.1** (Initial release + formatting fixes)
331334

332335
## Support
333336

benches/graph_operations.rs

Lines changed: 57 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,83 @@
1-
use criterion::{black_box, criterion_group, criterion_main, Criterion, BenchmarkId};
2-
use codegraph::{CodeGraph, NodeType, EdgeType};
1+
use codegraph::{CodeGraph, EdgeType, NodeType};
2+
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
33
use tempfile::TempDir;
44

55
fn bench_node_lookup(c: &mut Criterion) {
66
let mut group = c.benchmark_group("node_lookup");
7-
7+
88
for size in [1000, 10_000, 100_000].iter() {
99
let temp_dir = TempDir::new().unwrap();
1010
let db_path = temp_dir.path().join("bench.graph");
1111
let mut graph = CodeGraph::open(&db_path).unwrap();
12-
12+
1313
// Populate graph
1414
let node_ids: Vec<_> = (0..*size)
1515
.map(|i| {
16-
graph.add_node(NodeType::Function, vec![
17-
("name".to_string(), format!("func_{i}").into()),
18-
].into_iter().collect()).unwrap()
16+
graph
17+
.add_node(
18+
NodeType::Function,
19+
vec![("name".to_string(), format!("func_{i}").into())]
20+
.into_iter()
21+
.collect(),
22+
)
23+
.unwrap()
1924
})
2025
.collect();
21-
26+
2227
group.bench_with_input(BenchmarkId::new("lookup", size), size, |b, _| {
2328
let node_id = node_ids[node_ids.len() / 2];
2429
b.iter(|| {
2530
black_box(graph.get_node(node_id).unwrap());
2631
});
2732
});
2833
}
29-
34+
3035
group.finish();
3136
}
3237

3338
fn bench_neighbor_queries(c: &mut Criterion) {
3439
let mut group = c.benchmark_group("neighbor_queries");
35-
40+
3641
let temp_dir = TempDir::new().unwrap();
3742
let db_path = temp_dir.path().join("bench.graph");
3843
let mut graph = CodeGraph::open(&db_path).unwrap();
39-
44+
4045
// Create a node with varying numbers of neighbors
41-
let center_node = graph.add_node(NodeType::Function, Default::default()).unwrap();
42-
46+
let center_node = graph
47+
.add_node(NodeType::Function, Default::default())
48+
.unwrap();
49+
4350
for num_neighbors in [10, 100, 1000].iter() {
4451
for _i in 0..*num_neighbors {
45-
let neighbor = graph.add_node(NodeType::Function, Default::default()).unwrap();
46-
graph.add_edge(center_node, neighbor, EdgeType::Calls, Default::default()).unwrap();
52+
let neighbor = graph
53+
.add_node(NodeType::Function, Default::default())
54+
.unwrap();
55+
graph
56+
.add_edge(center_node, neighbor, EdgeType::Calls, Default::default())
57+
.unwrap();
4758
}
48-
49-
group.bench_with_input(BenchmarkId::new("get_neighbors", num_neighbors), num_neighbors, |b, _| {
50-
b.iter(|| {
51-
black_box(graph.get_neighbors(center_node, codegraph::Direction::Outgoing).unwrap());
52-
});
53-
});
59+
60+
group.bench_with_input(
61+
BenchmarkId::new("get_neighbors", num_neighbors),
62+
num_neighbors,
63+
|b, _| {
64+
b.iter(|| {
65+
black_box(
66+
graph
67+
.get_neighbors(center_node, codegraph::Direction::Outgoing)
68+
.unwrap(),
69+
);
70+
});
71+
},
72+
);
5473
}
55-
74+
5675
group.finish();
5776
}
5877

5978
fn bench_batch_insert(c: &mut Criterion) {
6079
let mut group = c.benchmark_group("batch_insert");
61-
80+
6281
for size in [100, 1000, 10_000].iter() {
6382
group.bench_with_input(BenchmarkId::new("nodes", size), size, |b, &size| {
6483
b.iter_with_setup(
@@ -70,18 +89,28 @@ fn bench_batch_insert(c: &mut Criterion) {
7089
},
7190
|(mut graph, _temp_dir)| {
7291
let nodes: Vec<_> = (0..size)
73-
.map(|i| (NodeType::Function, vec![
74-
("name".to_string(), format!("func_{i}").into()),
75-
].into_iter().collect()))
92+
.map(|i| {
93+
(
94+
NodeType::Function,
95+
vec![("name".to_string(), format!("func_{i}").into())]
96+
.into_iter()
97+
.collect(),
98+
)
99+
})
76100
.collect();
77101
black_box(graph.add_nodes_batch(nodes).unwrap());
78102
},
79103
);
80104
});
81105
}
82-
106+
83107
group.finish();
84108
}
85109

86-
criterion_group!(benches, bench_node_lookup, bench_neighbor_queries, bench_batch_insert);
110+
criterion_group!(
111+
benches,
112+
bench_node_lookup,
113+
bench_neighbor_queries,
114+
bench_batch_insert
115+
);
87116
criterion_main!(benches);

cobertura.xml

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

examples/basic_usage.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,16 @@ fn main() -> codegraph::Result<()> {
6464
println!("\n--- Querying the graph ---\n");
6565

6666
let file_node = graph.get_node(file_id)?;
67-
println!("File node: {}", file_node.properties.get_string("path").unwrap_or("unknown"));
67+
println!(
68+
"File node: {}",
69+
file_node.properties.get_string("path").unwrap_or("unknown")
70+
);
6871

6972
let neighbors = graph.get_neighbors(main_id, Direction::Outgoing)?;
70-
println!("\nMain function calls/references {} entities:", neighbors.len());
73+
println!(
74+
"\nMain function calls/references {} entities:",
75+
neighbors.len()
76+
);
7177
for neighbor_id in &neighbors {
7278
let neighbor = graph.get_node(*neighbor_id)?;
7379
if let Some(name) = neighbor.properties.get_string("name") {
@@ -77,7 +83,10 @@ fn main() -> codegraph::Result<()> {
7783

7884
// Get incoming edges (who calls main?)
7985
let callers = graph.get_neighbors(main_id, Direction::Incoming)?;
80-
println!("\nMain function is contained in {} entities:", callers.len());
86+
println!(
87+
"\nMain function is contained in {} entities:",
88+
callers.len()
89+
);
8190
for caller_id in &callers {
8291
let caller = graph.get_node(*caller_id)?;
8392
println!(" - {:?}", caller.node_type);
@@ -88,7 +97,11 @@ fn main() -> codegraph::Result<()> {
8897
println!("\nEdges from main to helper: {}", edges.len());
8998
for edge_id in &edges {
9099
let edge = graph.get_edge(*edge_id)?;
91-
println!(" - {} (line: {:?})", edge.edge_type, edge.properties.get_int("line"));
100+
println!(
101+
" - {} (line: {:?})",
102+
edge.edge_type,
103+
edge.properties.get_int("line")
104+
);
92105
}
93106

94107
// Graph statistics

0 commit comments

Comments
 (0)