Rhai - An embedded scripting language for Rust.
This report presents the forensic synthetic code analysis of rhaiscript/rhai, a Rust project with 5,583 GitHub stars. SynthScan v2.0 examined 102,193 lines of code across 337 source files, recording 993 pattern matches distributed across 4 syntactic categories. The overall adjusted score of 8.5 places this repository in the Low AI signal band.
The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).
Longitudinal tracking requires multiple scan runs. Once this repository is re-scanned after new commits land, this chart will visualise how the synthetic code signal evolves over time — enabling you to detect whether AI authorship is growing, stabilising, or being actively corrected by human engineers.
Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.
This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.
The scanner identified 993 distinct pattern matches across 4 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.
Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tools/reserved.txt | 1 | // This file holds a list of reserved symbols for the Rhai language. | COMMENT |
| LOW | tools/keywords.txt | 1 | // This file holds a list of keywords/symbols for the Rhai language, with mapping to | COMMENT |
| LOW | tests/arrays.rs | 361 | " | COMMENT |
| LOW | tests/mod.rs | 1 | mod grain { | COMMENT |
| LOW | tests/mod.rs | 21 | // Both are about execution staying inside a bound, which `unchecked` | COMMENT |
| LOW | tests/grain/format.rs | 1 | //! An artifact must mean what the program it came from meant, and nothing a | COMMENT |
| LOW | tests/grain/format.rs | 161 | COMMENT | |
| LOW | tests/grain/format.rs | 421 | let program = Compiler::new().compile(&ast); | COMMENT |
| LOW | tests/grain/format.rs | 561 | /// | COMMENT |
| LOW | tests/grain/format.rs | 601 | /// The whole point of the split, end to end. | COMMENT |
| LOW | tests/grain/call_fn.rs | 1 | //! Calling one compiled function, with the environment and receiver rhai gives | COMMENT |
| LOW | tests/grain/call_fn.rs | 21 | } | COMMENT |
| LOW | tests/grain/limits.rs | 1 | //! Compiled code must still be stoppable. | COMMENT |
| LOW | tests/grain/limits.rs | 61 | COMMENT | |
| LOW | tests/grain/callback.rs | 61 | /// A bare function name is a function pointer, not a variable read. | COMMENT |
| LOW | tests/grain/callback.rs | 81 | #[test] | COMMENT |
| LOW | tests/grain/callback.rs | 101 | /// which reproduces it with no rhaigrain in the picture at all. | COMMENT |
| LOW | tests/grain/callback.rs | 161 | /// than reaching a script function does, so a callback nests less deeply before | COMMENT |
| LOW | tests/grain/scope.rs | 1 | //! Variables the caller already had, which no slot can name. | COMMENT |
| LOW | tests/grain/scope.rs | 301 | /// | COMMENT |
| LOW | tests/grain/scope.rs | 341 | /// `Scope::iter_raw`, which runs from the top down, and used the position as if | COMMENT |
| LOW | tests/grain/scope.rs | 401 | fn a_name_that_is_nowhere_is_reported_the_same_way() { | COMMENT |
| LOW | tests/grain/scope.rs | 461 | /// answered. That is a wrong result rather than a missing feature, which is the | COMMENT |
| LOW | tests/grain/scope.rs | 601 | let expected = engine.eval_ast_with_scope::<Dynamic>(&mut walked, &ast).expect("the walker must run it too"); | COMMENT |
| LOW | tests/grain/scope.rs | 641 | start(&mut run); | COMMENT |
| LOW | tests/grain/differential.rs | 1 | //! The VM must mean exactly what rhai means. | COMMENT |
| LOW | tests/grain/differential.rs | 141 | Ok(_) => None, | COMMENT |
| LOW | tests/grain/fuzz.rs | 1 | //! Randomised loading, on the assumption that an artifact is hostile. | COMMENT |
| LOW | tests/grain/fuzz.rs | 221 | /// them. The index is counted back from the end of the scope, so it now names | COMMENT |
| LOW | tests/grain/projection.rs | 1 | //! What would a lowering of this script actually weigh? | COMMENT |
| LOW | tests/grain/allocation.rs | 1 | //! What the AST costs, and what the VM costs instead. | COMMENT |
| LOW | tests/grain/corpus/generate.rs | 1 | // Random rhai scripts, for comparing the VM against the walker on programs | COMMENT |
| LOW | tests/grain/corpus/generate.rs | 21 | // argument order for captures, pinned in `tests/callback.rs`. Closures are | COMMENT |
| LOW | tests/grain/corpus/generate.rs | 101 | COMMENT | |
| LOW | tests/grain/corpus/generate.rs | 121 | /// which is worth generating rather than worth avoiding. | COMMENT |
| LOW | tests/grain/corpus/generate.rs | 141 | pub struct Generator { | COMMENT |
| LOW | tests/grain/corpus/generate.rs | 501 | 9 => self.map(), | COMMENT |
| LOW | tests/grain/corpus/generate.rs | 541 | // form is `fn` in disguise, so `no_function` takes it too. | COMMENT |
| LOW | tests/grain/corpus/mod.rs | 1 | //! Scripts the VM must agree with rhai on. | COMMENT |
| LOW | tests/grain/corpus/mod.rs | 21 | pub name: &'static str, | COMMENT |
| LOW | tests/grain/corpus/mod.rs | 61 | .register_fn("widget", |level: INT| Widget { level, cells: vec![10, 20, 30] }) | COMMENT |
| LOW | tests/grain/corpus/mod.rs | 101 | COMMENT | |
| LOW | tests/grain/corpus/mod.rs | 361 | // re-pushed each iteration (eval/stmt.rs:752); a VM that re-pushes would | COMMENT |
| LOW | tests/grain/corpus/mod.rs | 381 | // default, so both single-digit arms are needed to tell those apart. | COMMENT |
| LOW | tests/grain/corpus/mod.rs | 401 | // A shared value is not hashable either, so rhai skips the cases *and* the | COMMENT |
| LOW | tests/grain/corpus/mod.rs | 441 | // in debug builds than in release, and this case is about recursion working | COMMENT |
| LOW | tests/grain/corpus/mod.rs | 461 | // mutates the variable (`func/call.rs:1434`). These are the same calls the | COMMENT |
| LOW | tests/grain/corpus/mod.rs | 481 | // does not end up holding a pointer, which they render differently on | COMMENT |
| LOW | tests/grain/corpus/mod.rs | 501 | // The closure is kept inside a block in all of these. Not incidental: the | COMMENT |
| LOW | tests/grain/corpus/mod.rs | 521 | // rhai — a non-pointer target means the *argument* is the pointer and the | COMMENT |
| LOW | tests/grain/corpus/mod.rs | 561 | case("map_read_of_absent_key_does_not_create_it", "let m = #{ a: 1 }; let r = m.b; [m, r]"), | COMMENT |
| LOW | tests/grain/corpus/mod.rs | 601 | case("error_operator_undefined_for_types", "let a = 1.0; a + #{ b: 1 }"), | COMMENT |
| LOW | tests/grain/corpus/mod.rs | 621 | // Rhai rewinds a block whether it is left normally or by a throw, and | COMMENT |
| LOW | tests/grain/corpus/mod.rs | 661 | // `return` unwinds as an error but must pass straight through a catch. | COMMENT |
| LOW | tests/grain/corpus/mod.rs | 741 | // | COMMENT |
| LOW | codegen/src/lib.rs | 1 | //! This crate contains procedural macros to make creating Rhai plugin modules much easier. | COMMENT |
| LOW | codegen/src/lib.rs | 21 | //! let m = exported_module!(advanced_math); | COMMENT |
| LOW | codegen/src/lib.rs | 41 | mod function; | COMMENT |
| LOW | codegen/src/lib.rs | 61 | /// } | COMMENT |
| LOW | codegen/src/lib.rs | 81 | if let Err(e) = module_def.set_params(parsed_params) { | COMMENT |
| 914 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | src/types/dynamic.rs | 1374 | // Coded this way in order to maximally leverage potentials for dead-code removal. | COMMENT |
| MEDIUM | src/types/dynamic.rs | 1500 | // Coded this way in order to maximally leverage potentials for dead-code removal. | COMMENT |
| MEDIUM | src/types/dynamic.rs | 1860 | // Coded this way in order to maximally leverage potentials for dead-code removal. | COMMENT |
| MEDIUM | src/types/dynamic.rs | 1963 | // Coded this way in order to maximally leverage potentials for dead-code removal. | COMMENT |
| MEDIUM | src/module/mod.rs | 1563 | /// Essentially, this method is a shortcut for: | COMMENT |
| MEDIUM | src/api/custom_syntax.rs | 141 | // Coded this way in order to maximally leverage potentials for dead-code removal. | COMMENT |
| MEDIUM | src/api/events.rs | 23 | /// the current [`Scope`][crate::Scope]. Essentially the correct variable is at position | COMMENT |
| MEDIUM | src/func/call.rs | 1443 | // convert to method-call style in order to leverage potential &mut first argument | COMMENT |
| MEDIUM | src/func/call.rs | 1534 | // If so, convert to method-call style in order to leverage potential | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | src/api/custom_syntax.rs | 386 | /// ## Return value | COMMENT |
| LOW | src/api/custom_syntax.rs | 437 | /// ## Return value | COMMENT |
| LOW | src/api/events.rs | 28 | /// ## Return value | COMMENT |
| LOW | src/api/events.rs | 84 | /// ## Return value | COMMENT |
| LOW | src/api/events.rs | 203 | /// ## Return value | COMMENT |
| LOW | src/api/events.rs | 345 | /// ## Return value | COMMENT |
| LOW | src/api/events.rs | 424 | /// ## Return value | COMMENT |
| LOW | src/api/events.rs | 500 | /// ## Return value | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/parse_json.rs | 32 | assert_eq!(map["name"].clone().into_immutable_string().expect("name should exist"), "John Doe"); | CODE |
| LOW | tests/parse_json.rs | 156 | assert_eq!(map["name"].clone().into_immutable_string().expect("name should exist"), "John Doe"); | CODE |