rubydex 0.2.9 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +110 -6
- data/THIRD_PARTY_LICENSES.html +271 -2
- data/exe/rdx +2 -73
- data/ext/rubydex/config.c +140 -0
- data/ext/rubydex/config.h +16 -0
- data/ext/rubydex/declaration.c +1 -1
- data/ext/rubydex/definition.c +32 -4
- data/ext/rubydex/diagnostic.c +75 -1
- data/ext/rubydex/diagnostic.h +2 -0
- data/ext/rubydex/graph.c +27 -48
- data/ext/rubydex/graph.h +6 -0
- data/ext/rubydex/query.c +487 -0
- data/ext/rubydex/query.h +8 -0
- data/ext/rubydex/reference.c +60 -0
- data/ext/rubydex/rubydex.c +4 -0
- data/ext/rubydex/utils.c +23 -4
- data/ext/rubydex/utils.h +5 -0
- data/lib/ruby_lsp/rubydex/addon.rb +211 -0
- data/lib/rubydex/cli/command/console.rb +55 -0
- data/lib/rubydex/cli/command/lint/explain.rb +74 -0
- data/lib/rubydex/cli/command/lint.rb +202 -0
- data/lib/rubydex/cli/command/mcp.rb +30 -0
- data/lib/rubydex/cli/command/query.rb +70 -0
- data/lib/rubydex/cli/command/skill.rb +69 -0
- data/lib/rubydex/cli/command.rb +168 -0
- data/lib/rubydex/cli.rb +93 -0
- data/lib/rubydex/config.rb +59 -0
- data/lib/rubydex/diagnostic.rb +12 -3
- data/lib/rubydex/errors.rb +42 -1
- data/lib/rubydex/graph.rb +10 -3
- data/lib/rubydex/linter/custom_rule.rb +97 -0
- data/lib/rubydex/linter/helpers/path_helpers.rb +78 -0
- data/lib/rubydex/linter/helpers/source_access_helpers.rb +31 -0
- data/lib/rubydex/linter/rule_loader.rb +36 -0
- data/lib/rubydex/linter/rule_test_case.rb +343 -0
- data/lib/rubydex/linter/runner.rb +56 -0
- data/lib/rubydex/linter.rb +19 -0
- data/lib/rubydex/location.rb +3 -0
- data/lib/rubydex/mcp_server.rb +1 -2
- data/lib/rubydex/related_information.rb +17 -0
- data/lib/rubydex/rule.rb +33 -0
- data/lib/rubydex/severity.rb +70 -0
- data/lib/rubydex/skill.rb +88 -0
- data/lib/rubydex/skill_registry.rb +62 -0
- data/lib/rubydex/version.rb +1 -1
- data/lib/rubydex.rb +6 -0
- data/lib/rubydex_linter/rules/rule_structure.rb +125 -0
- data/rbi/rubydex.rbi +578 -15
- data/rust/Cargo.lock +7 -0
- data/rust/rubydex/Cargo.toml +1 -0
- data/rust/rubydex/benches/graph_memory.rs +20 -4
- data/rust/rubydex/src/compile_assertions.rs +15 -0
- data/rust/rubydex/src/config.rs +538 -157
- data/rust/rubydex/src/diagnostic.rs +66 -40
- data/rust/rubydex/src/errors.rs +0 -1
- data/rust/rubydex/src/indexing/local_graph.rs +6 -5
- data/rust/rubydex/src/indexing/rbs_indexer.rs +284 -8
- data/rust/rubydex/src/indexing/ruby_indexer.rs +59 -70
- data/rust/rubydex/src/indexing/ruby_indexer_tests.rs +195 -86
- data/rust/rubydex/src/lib.rs +1 -0
- data/rust/rubydex/src/listing.rs +26 -1
- data/rust/rubydex/src/main.rs +9 -128
- data/rust/rubydex/src/model/declaration.rs +301 -229
- data/rust/rubydex/src/model/definitions.rs +27 -26
- data/rust/rubydex/src/model/document.rs +43 -7
- data/rust/rubydex/src/model/graph.rs +67 -68
- data/rust/rubydex/src/model/id.rs +55 -0
- data/rust/rubydex/src/model/ids.rs +21 -9
- data/rust/rubydex/src/model/name.rs +88 -19
- data/rust/rubydex/src/model/references.rs +16 -13
- data/rust/rubydex/src/operation/ruby_builder.rs +78 -104
- data/rust/rubydex/src/path_helpers.rs +77 -0
- data/rust/rubydex/src/query/cypher/schema.rs +853 -0
- data/rust/rubydex/src/query/cypher/schema_info.rs +161 -0
- data/rust/rubydex/src/query/cypher/tests.rs +253 -0
- data/rust/rubydex/src/query/cypher.rs +54 -0
- data/rust/rubydex/src/query.rs +125 -43
- data/rust/rubydex/src/resolution.rs +368 -395
- data/rust/rubydex/src/resolution_tests.rs +504 -78
- data/rust/rubydex/src/test_utils/context.rs +2 -1
- data/rust/rubydex/src/test_utils/graph_test.rs +26 -12
- data/rust/rubydex/src/test_utils/local_graph_test.rs +19 -0
- data/rust/rubydex/tests/cli.rs +4 -4
- data/rust/rubydex-sys/src/config_api.rs +205 -0
- data/rust/rubydex-sys/src/cypher_api.rs +791 -0
- data/rust/rubydex-sys/src/declaration_api.rs +6 -3
- data/rust/rubydex-sys/src/definition_api.rs +27 -7
- data/rust/rubydex-sys/src/diagnostic_api.rs +77 -8
- data/rust/rubydex-sys/src/graph_api.rs +31 -68
- data/rust/rubydex-sys/src/lib.rs +2 -0
- data/rust/rubydex-sys/src/name_api.rs +2 -6
- data/rust/rubydex-sys/src/reference_api.rs +58 -12
- data/rust/rubydex-sys/src/utils.rs +37 -0
- data/skills/send-private-method/SKILL.md +133 -0
- metadata +37 -2
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#[cfg(all(feature = "jemalloc", not(target_os = "windows")))]
|
|
2
2
|
mod imp {
|
|
3
|
-
use std::
|
|
3
|
+
use std::time::Instant;
|
|
4
4
|
|
|
5
5
|
use rubydex::{
|
|
6
|
+
config::Config,
|
|
6
7
|
indexing::{self, IndexerBackend},
|
|
7
8
|
listing,
|
|
8
9
|
model::graph::Graph,
|
|
@@ -18,13 +19,28 @@ mod imp {
|
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
pub fn run() {
|
|
21
|
-
let
|
|
22
|
-
|
|
23
|
-
let
|
|
22
|
+
let mut args = std::env::args().skip(1);
|
|
23
|
+
|
|
24
|
+
let workspace = args
|
|
25
|
+
.next()
|
|
26
|
+
.expect("incorrect usage of cargo bench --bench graph_memory. Please use `utils/bench-graph-memory` instead of invoking this benchmark directly.");
|
|
27
|
+
let workspace_path = std::fs::canonicalize(&workspace).expect("the workspace path must exist");
|
|
28
|
+
assert!(workspace_path.is_dir(), "the workspace path must be a directory");
|
|
24
29
|
|
|
25
30
|
let mut graph = Graph::new();
|
|
31
|
+
let config = Config::load(&workspace_path).expect("the workspace configuration must be valid");
|
|
32
|
+
graph.load_config(&config);
|
|
33
|
+
|
|
34
|
+
let time = Instant::now();
|
|
35
|
+
|
|
36
|
+
let (file_paths, _) = listing::collect_file_paths(args.collect(), &graph.excluded_patterns());
|
|
37
|
+
println!("Listing {:.2}s", time.elapsed().as_secs_f64());
|
|
38
|
+
|
|
26
39
|
let _ = indexing::index_files(&mut graph, file_paths, IndexerBackend::RubyIndexer);
|
|
40
|
+
println!("Indexing {:.2}s", time.elapsed().as_secs_f64());
|
|
41
|
+
|
|
27
42
|
Resolver::new(&mut graph).resolve();
|
|
43
|
+
println!("Resolution {:.2}s", time.elapsed().as_secs_f64());
|
|
28
44
|
|
|
29
45
|
// Compare the total memory used in the allocator before and after dropping the graph
|
|
30
46
|
let before_drop = allocated_bytes();
|
|
@@ -11,3 +11,18 @@ macro_rules! assert_mem_size {
|
|
|
11
11
|
const _: [(); $size] = [(); std::mem::size_of::<$struct>()];
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
/// Asserts at compile time that a type is `Send + Sync`.
|
|
16
|
+
///
|
|
17
|
+
/// The `Graph` is shared across Ractors/threads behind a `RwLock`, so it must stay
|
|
18
|
+
/// `Send + Sync`. This assertion fails the build if a field that breaks either trait
|
|
19
|
+
/// is ever added.
|
|
20
|
+
#[macro_export]
|
|
21
|
+
macro_rules! assert_send_sync {
|
|
22
|
+
($struct:ident) => {
|
|
23
|
+
const _: fn() = || {
|
|
24
|
+
fn assert_send_sync<T: ?Sized + Send + Sync>() {}
|
|
25
|
+
assert_send_sync::<$struct>();
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
}
|