Repository Analysis

rhaiscript/rhai

Rhai - An embedded scripting language for Rust.

8.5 Low AI signal View on GitHub

Analysis Overview

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).

8.5
Adjusted Score
8.5
Raw Score
100%
Time Factor
2026-08-09
Last Push
5.6K
Stars
Rust
Language
102.2K
Lines of Code
337
Files
993
Pattern Hits
2026-08-09
Scan Date
0.00
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

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.

No multi-scan history yet — run the scanner again to build trend data.

Severity Breakdown

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.

CRITICAL 0HIGH 0MEDIUM 9LOW 984

Directory Score Breakdown

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.

Pattern Findings

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.

Over-Commented Block974 hits · 831 pts
SeverityFileLineSnippetContext
LOWtools/reserved.txt1// This file holds a list of reserved symbols for the Rhai language.COMMENT
LOWtools/keywords.txt1// This file holds a list of keywords/symbols for the Rhai language, with mapping toCOMMENT
LOWtests/arrays.rs361 "COMMENT
LOWtests/mod.rs1mod grain {COMMENT
LOWtests/mod.rs21 // Both are about execution staying inside a bound, which `unchecked`COMMENT
LOWtests/grain/format.rs1//! An artifact must mean what the program it came from meant, and nothing aCOMMENT
LOWtests/grain/format.rs161COMMENT
LOWtests/grain/format.rs421 let program = Compiler::new().compile(&ast);COMMENT
LOWtests/grain/format.rs561///COMMENT
LOWtests/grain/format.rs601/// The whole point of the split, end to end.COMMENT
LOWtests/grain/call_fn.rs1//! Calling one compiled function, with the environment and receiver rhai givesCOMMENT
LOWtests/grain/call_fn.rs21}COMMENT
LOWtests/grain/limits.rs1//! Compiled code must still be stoppable.COMMENT
LOWtests/grain/limits.rs61COMMENT
LOWtests/grain/callback.rs61/// A bare function name is a function pointer, not a variable read.COMMENT
LOWtests/grain/callback.rs81#[test]COMMENT
LOWtests/grain/callback.rs101/// which reproduces it with no rhaigrain in the picture at all.COMMENT
LOWtests/grain/callback.rs161/// than reaching a script function does, so a callback nests less deeply beforeCOMMENT
LOWtests/grain/scope.rs1//! Variables the caller already had, which no slot can name.COMMENT
LOWtests/grain/scope.rs301///COMMENT
LOWtests/grain/scope.rs341/// `Scope::iter_raw`, which runs from the top down, and used the position as ifCOMMENT
LOWtests/grain/scope.rs401fn a_name_that_is_nowhere_is_reported_the_same_way() {COMMENT
LOWtests/grain/scope.rs461/// answered. That is a wrong result rather than a missing feature, which is theCOMMENT
LOWtests/grain/scope.rs601 let expected = engine.eval_ast_with_scope::<Dynamic>(&mut walked, &ast).expect("the walker must run it too");COMMENT
LOWtests/grain/scope.rs641 start(&mut run);COMMENT
LOWtests/grain/differential.rs1//! The VM must mean exactly what rhai means.COMMENT
LOWtests/grain/differential.rs141 Ok(_) => None,COMMENT
LOWtests/grain/fuzz.rs1//! Randomised loading, on the assumption that an artifact is hostile.COMMENT
LOWtests/grain/fuzz.rs221/// them. The index is counted back from the end of the scope, so it now namesCOMMENT
LOWtests/grain/projection.rs1//! What would a lowering of this script actually weigh?COMMENT
LOWtests/grain/allocation.rs1//! What the AST costs, and what the VM costs instead.COMMENT
LOWtests/grain/corpus/generate.rs1// Random rhai scripts, for comparing the VM against the walker on programsCOMMENT
LOWtests/grain/corpus/generate.rs21// argument order for captures, pinned in `tests/callback.rs`. Closures areCOMMENT
LOWtests/grain/corpus/generate.rs101COMMENT
LOWtests/grain/corpus/generate.rs121/// which is worth generating rather than worth avoiding.COMMENT
LOWtests/grain/corpus/generate.rs141pub struct Generator {COMMENT
LOWtests/grain/corpus/generate.rs501 9 => self.map(),COMMENT
LOWtests/grain/corpus/generate.rs541 // form is `fn` in disguise, so `no_function` takes it too.COMMENT
LOWtests/grain/corpus/mod.rs1//! Scripts the VM must agree with rhai on.COMMENT
LOWtests/grain/corpus/mod.rs21 pub name: &'static str,COMMENT
LOWtests/grain/corpus/mod.rs61 .register_fn("widget", |level: INT| Widget { level, cells: vec![10, 20, 30] })COMMENT
LOWtests/grain/corpus/mod.rs101COMMENT
LOWtests/grain/corpus/mod.rs361 // re-pushed each iteration (eval/stmt.rs:752); a VM that re-pushes wouldCOMMENT
LOWtests/grain/corpus/mod.rs381 // default, so both single-digit arms are needed to tell those apart.COMMENT
LOWtests/grain/corpus/mod.rs401 // A shared value is not hashable either, so rhai skips the cases *and* theCOMMENT
LOWtests/grain/corpus/mod.rs441 // in debug builds than in release, and this case is about recursion workingCOMMENT
LOWtests/grain/corpus/mod.rs461 // mutates the variable (`func/call.rs:1434`). These are the same calls theCOMMENT
LOWtests/grain/corpus/mod.rs481 // does not end up holding a pointer, which they render differently onCOMMENT
LOWtests/grain/corpus/mod.rs501 // The closure is kept inside a block in all of these. Not incidental: theCOMMENT
LOWtests/grain/corpus/mod.rs521 // rhai — a non-pointer target means the *argument* is the pointer and theCOMMENT
LOWtests/grain/corpus/mod.rs561 case("map_read_of_absent_key_does_not_create_it", "let m = #{ a: 1 }; let r = m.b; [m, r]"),COMMENT
LOWtests/grain/corpus/mod.rs601 case("error_operator_undefined_for_types", "let a = 1.0; a + #{ b: 1 }"),COMMENT
LOWtests/grain/corpus/mod.rs621 // Rhai rewinds a block whether it is left normally or by a throw, andCOMMENT
LOWtests/grain/corpus/mod.rs661 // `return` unwinds as an error but must pass straight through a catch.COMMENT
LOWtests/grain/corpus/mod.rs741 //COMMENT
LOWcodegen/src/lib.rs1//! This crate contains procedural macros to make creating Rhai plugin modules much easier.COMMENT
LOWcodegen/src/lib.rs21//! let m = exported_module!(advanced_math);COMMENT
LOWcodegen/src/lib.rs41mod function;COMMENT
LOWcodegen/src/lib.rs61/// }COMMENT
LOWcodegen/src/lib.rs81 if let Err(e) = module_def.set_params(parsed_params) {COMMENT
914 more matches not shown…
AI Slop Vocabulary9 hits · 27 pts
SeverityFileLineSnippetContext
MEDIUMsrc/types/dynamic.rs1374 // Coded this way in order to maximally leverage potentials for dead-code removal.COMMENT
MEDIUMsrc/types/dynamic.rs1500 // Coded this way in order to maximally leverage potentials for dead-code removal.COMMENT
MEDIUMsrc/types/dynamic.rs1860 // Coded this way in order to maximally leverage potentials for dead-code removal.COMMENT
MEDIUMsrc/types/dynamic.rs1963 // Coded this way in order to maximally leverage potentials for dead-code removal.COMMENT
MEDIUMsrc/module/mod.rs1563 /// Essentially, this method is a shortcut for:COMMENT
MEDIUMsrc/api/custom_syntax.rs141 // Coded this way in order to maximally leverage potentials for dead-code removal.COMMENT
MEDIUMsrc/api/events.rs23 /// the current [`Scope`][crate::Scope]. Essentially the correct variable is at positionCOMMENT
MEDIUMsrc/func/call.rs1443 // convert to method-call style in order to leverage potential &mut first argumentCOMMENT
MEDIUMsrc/func/call.rs1534 // If so, convert to method-call style in order to leverage potentialCOMMENT
Redundant / Tautological Comments8 hits · 12 pts
SeverityFileLineSnippetContext
LOWsrc/api/custom_syntax.rs386 /// ## Return valueCOMMENT
LOWsrc/api/custom_syntax.rs437 /// ## Return valueCOMMENT
LOWsrc/api/events.rs28 /// ## Return valueCOMMENT
LOWsrc/api/events.rs84 /// ## Return valueCOMMENT
LOWsrc/api/events.rs203 /// ## Return valueCOMMENT
LOWsrc/api/events.rs345 /// ## Return valueCOMMENT
LOWsrc/api/events.rs424 /// ## Return valueCOMMENT
LOWsrc/api/events.rs500 /// ## Return valueCOMMENT
Fake / Example Data2 hits · 2 pts
SeverityFileLineSnippetContext
LOWtests/parse_json.rs32 assert_eq!(map["name"].clone().into_immutable_string().expect("name should exist"), "John Doe");CODE
LOWtests/parse_json.rs156 assert_eq!(map["name"].clone().into_immutable_string().expect("name should exist"), "John Doe");CODE