Repository Analysis

mangiucugna/json_repair

Repair malformed JSON from LLMs, APIs, logs, and user input in Python.

33.0 Strong AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of mangiucugna/json_repair, a Python project with 5,058 GitHub stars. SynthScan v2.0 examined 12,893 lines of code across 80 source files, recording 377 pattern matches distributed across 11 syntactic categories. The overall adjusted score of 33.0 places this repository in the Strong 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).

33.0
Adjusted Score
33.0
Raw Score
100%
Time Factor
2026-07-21
Last Push
5.1K
Stars
Python
Language
12.9K
Lines of Code
80
Files
377
Pattern Hits
2026-08-02
Scan Date
0.15
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 12MEDIUM 9LOW 356

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 377 distinct pattern matches across 11 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.

Hyper-Verbose Identifiers298 hits · 273 pts
SeverityFileLineSnippetContext
LOWtests/test_parse_comment.py24def test_line_comment_brackets_do_not_trigger_empty_object_array_fallback():CODE
LOWtests/test_parse_comment.py31def test_block_comment_brackets_do_not_trigger_empty_object_array_fallback():CODE
LOWtests/test_parse_comment.py38def test_line_comment_brackets_do_not_close_array_items():CODE
LOWtests/test_parse_comment.py63def test_parse_many_top_level_comments_without_recursion_error():STRING
LOWtests/test_docs_app_schema.py15def test_docs_api_without_schema_keeps_existing_behavior(client):CODE
LOWtests/test_docs_app_schema.py26def test_docs_api_schema_null_is_treated_as_missing(client):CODE
LOWtests/test_docs_app_schema.py37def test_docs_api_schema_guides_coercion(client):CODE
LOWtests/test_docs_app_schema.py58def test_docs_api_rejects_invalid_schema_type(client):CODE
LOWtests/test_docs_app_schema.py85def test_docs_api_rejects_circular_schema_ref(client):CODE
LOWtests/test_docs_app_schema.py103def test_docs_api_rejects_invalid_schema_repair_mode_type(client):CODE
LOWtests/test_docs_app_schema.py113def test_docs_api_rejects_invalid_schema_repair_mode_value(client):CODE
LOWtests/test_docs_app_schema.py123def test_docs_api_rejects_salvage_mode_without_schema(client):CODE
LOWtests/test_docs_app_schema.py133def test_docs_api_salvage_mode_drops_invalid_array_items(client):CODE
LOWtests/test_parse_number.py11def test_parse_number_edge_cases():CODE
LOWtests/test_json_repair.py28def test_valid_json_fast_path_does_not_initialize_repair_parser(monkeypatch):CODE
LOWtests/test_json_repair.py29 def fail_parser_initialization(*_args, **_kwargs):CODE
LOWtests/test_json_repair.py37def test_prefixed_valid_json_uses_value_fast_path_when_json_loads_is_skipped(monkeypatch):CODE
LOWtests/test_json_repair.py62def test_prefixed_valid_json_with_trailing_text_uses_value_fast_path(monkeypatch):CODE
LOWtests/test_json_repair.py73def test_prefixed_invalid_json_falls_back_to_repair_parser():CODE
LOWtests/test_json_repair.py92def test_top_level_separator_detects_pending_comma():CODE
LOWtests/test_json_repair.py98def test_parenthesized_prose_does_not_hijack_fenced_json():CODE
LOWtests/test_json_repair.py115def test_numbered_prose_line_does_not_hijack_fenced_json():CODE
LOWtests/test_json_repair.py132def test_parenthesized_tuple_still_parses_when_it_is_the_fenced_json_payload():CODE
LOWtests/test_json_repair.py145def test_repair_json_with_objects():CODE
LOWtests/test_json_repair.py235def test_repair_json_skip_json_loads():CODE
LOWtests/test_json_repair.py260def _find_real_recursion_payload() -> str:CODE
LOWtests/test_json_repair.py275def test_repair_json_normalizes_real_parser_recursion_error():CODE
LOWtests/test_repair_json_from_file.py9def test_load_repairs_from_current_file_position():CODE
LOWtests/test_repair_json_from_file.py20def test_repair_json_from_file():CODE
LOWtests/test_strict_mode.py6def test_strict_rejects_multiple_top_level_values():CODE
LOWtests/test_strict_mode.py11def test_strict_rejects_comma_separated_same_shape_top_level_objects():CODE
LOWtests/test_strict_mode.py16def test_strict_rejects_adjacent_same_shape_top_level_objects():CODE
LOWtests/test_strict_mode.py21def test_strict_rejects_adjacent_same_shape_top_level_arrays():CODE
LOWtests/test_strict_mode.py27def test_strict_rejects_falsy_top_level_values(payload):CODE
LOWtests/test_strict_mode.py32def test_strict_duplicate_keys_inside_array():CODE
LOWtests/test_strict_mode.py38def test_strict_rejects_empty_keys():CODE
LOWtests/test_strict_mode.py44def test_strict_requires_colon_between_key_and_value():CODE
LOWtests/test_strict_mode.py49def test_strict_rejects_empty_values():CODE
LOWtests/test_strict_mode.py55def test_strict_rejects_empty_object_with_extra_characters():CODE
LOWtests/test_strict_mode.py60def test_strict_rejects_empty_escaped_object_with_extra_characters():CODE
LOWtests/test_strict_mode.py65def test_strict_detects_immediate_doubled_quotes():CODE
LOWtests/test_strict_mode.py70def test_strict_detects_doubled_quotes_followed_by_string():CODE
LOWtests/test_parse_array.py12def test_parse_array_edge_cases():CODE
LOWtests/test_parse_array.py53def test_parse_array_python_tuple_literals():CODE
LOWtests/test_parse_array.py60def test_parse_array_parenthesized_scalar_keeps_scalar_shape():CODE
LOWtests/test_parse_array.py67def test_parse_array_mismatched_parenthesis_still_logs_missing_bracket():CODE
LOWtests/test_parse_array.py74def test_parenthesized_tuple_classifier_handles_nested_delimiters_and_missing_close():CODE
LOWtests/test_parse_array.py82def test_top_level_parenthesized_value_gate_rejects_prose_and_accepts_standalone_jsonish_values():CODE
LOWtests/test_parse_array.py96def test_parse_array_missing_quotes():CODE
LOWtests/test_schema_parser_paths.py37def parse_array_direct_with_mode(raw, schema, mode):CODE
LOWtests/test_schema_parser_paths.py45def test_parse_object_schema_true_false_and_non_object():CODE
LOWtests/test_schema_parser_paths.py52def test_parse_object_schema_property_fallbacks_and_stray_colon():CODE
LOWtests/test_schema_parser_paths.py62def test_parse_object_schema_invalid_property_schema_raises():CODE
LOWtests/test_schema_parser_paths.py68def test_parse_object_schema_invalid_pattern_schema_raises():CODE
LOWtests/test_schema_parser_paths.py74def test_parse_object_schema_invalid_pattern_extra_schema_raises():CODE
LOWtests/test_schema_parser_paths.py83def test_parse_array_schema_missing_object_brace():CODE
LOWtests/test_schema_parser_paths.py158def test_parse_object_schema_empty_object_falls_back_to_array():CODE
LOWtests/test_schema_parser_paths.py163def test_parse_object_schema_salvage_set_literal_keeps_non_string_members_as_array():CODE
LOWtests/test_schema_parser_paths.py168def test_parse_array_schema_true_false_and_non_array():CODE
LOWtests/test_schema_parser_paths.py175def test_parse_array_schema_items_and_additional_items():CODE
238 more matches not shown…
Cross-Language Confusion11 hits · 65 pts
SeverityFileLineSnippetContext
HIGHtests/test_json_repair.py149 assert repair_json('{"key": true, "key2": false, "key3": null}', return_objects=True) == {CODE
HIGHtests/test_json_repair.py237 repair_json('{"key": true, "key2": false, "key3": null}', skip_json_loads=True)CODE
HIGHtests/test_json_repair.py238 == '{"key": true, "key2": false, "key3": null}'CODE
HIGHtests/test_json_repair.py241 '{"key": true, "key2": false, "key3": null}',CODE
HIGHtests/test_parse_array.py21 assert repair_json("[true, false, null, ...]") == "[true, false, null]"CODE
HIGHtests/test_parse_object.py12 assert repair_json('{ "key": value, "key2": 1 "key3": null }', return_objects=True) == {CODE
HIGHtests/test_parse_string.py46 repair_json("{'key': 'string', 'key2': false, \"key3\": null, \"key4\": unquoted}")CODE
HIGHtests/test_parse_string.py47 == '{"key": "string", "key2": false, "key3": null, "key4": "unquoted"}'CODE
HIGHtests/test_parse_string.py386 assert repair_json(' {"key": true, "key2": false, "key3": null}') == '{"key": true, "key2": false, "key3": null}'STRING
HIGHtests/test_parse_string.py387 assert repair_json('{"key": TRUE, "key2": FALSE, "key3": Null} ') == '{"key": true, "key2": false, "key3": null}'STRING
HIGHtests/test_schema_guided_parse.py605 == '{"a": null, "b": null}'CODE
Unused Imports22 hits · 22 pts
SeverityFileLineSnippetContext
LOWexamples/pydantic_schema.py3CODE
LOWexamples/stream_stable.py3CODE
LOWexamples/repair_llm_output.py3CODE
LOWexamples/chinese_llm_output.py3CODE
LOWexamples/fastapi_app.py3CODE
LOWsrc/json_repair/parse_array.py9CODE
LOWsrc/json_repair/parse_comment.py7CODE
LOWsrc/json_repair/parser_parenthesized.py6CODE
LOWsrc/json_repair/schema_repair.py1CODE
LOWsrc/json_repair/parse_string.py11CODE
LOWsrc/json_repair/__init__.py1CODE
LOWsrc/json_repair/__init__.py1CODE
LOWsrc/json_repair/__init__.py1CODE
LOWsrc/json_repair/__init__.py1CODE
LOWsrc/json_repair/__init__.py2CODE
LOWsrc/json_repair/parse_object.py9CODE
LOWsrc/json_repair/parse_object.py10CODE
LOWsrc/json_repair/parse_number.py10CODE
LOWsrc/json_repair/parser_schema.py1CODE
LOW…on_repair/parse_string_helpers/parse_json_llm_block.py6CODE
LOW…on_repair/parse_string_helpers/object_value_context.py7CODE
LOW…n_repair/parse_string_helpers/parse_boolean_or_null.py4CODE
Deep Nesting23 hits · 21 pts
SeverityFileLineSnippetContext
LOWsrc/json_repair/parse_array.py12CODE
LOWsrc/json_repair/parse_array.py41CODE
LOWsrc/json_repair/parse_comment.py10CODE
LOWsrc/json_repair/parser_parenthesized.py9CODE
LOWsrc/json_repair/parser_parenthesized.py82CODE
LOWsrc/json_repair/schema_repair.py45CODE
LOWsrc/json_repair/schema_repair.py91CODE
LOWsrc/json_repair/schema_repair.py365CODE
LOWsrc/json_repair/parse_string.py56CODE
LOWsrc/json_repair/parse_string.py116CODE
LOWsrc/json_repair/parse_string.py143CODE
LOWsrc/json_repair/parse_string.py185CODE
LOWsrc/json_repair/parse_string.py433CODE
LOWsrc/json_repair/parse_string.py463CODE
LOWsrc/json_repair/parse_string.py535CODE
LOWsrc/json_repair/parse_string.py659CODE
LOWsrc/json_repair/json_repair.py100CODE
LOWsrc/json_repair/parse_object.py82CODE
LOWsrc/json_repair/parse_object.py132CODE
LOWsrc/json_repair/parse_object.py181CODE
LOWsrc/json_repair/parse_object.py379CODE
LOWsrc/json_repair/json_parser.py112CODE
LOWsrc/json_repair/utils/pattern_properties.py7CODE
Excessive Try-Catch Wrapping6 hits · 17 pts
SeverityFileLineSnippetContext
MEDIUMsrc/json_repair/json_repair.py425 print("Error: Inline mode requires a filename", file=sys.stderr)CODE
MEDIUMsrc/json_repair/json_repair.py429 print("Error: You cannot pass both --inline and --output", file=sys.stderr)CODE
MEDIUMsrc/json_repair/json_repair.py433 print("Error: You cannot pass both --schema and --schema-model", file=sys.stderr)CODE
MEDIUMsrc/json_repair/json_repair.py437 print("Error: --strict cannot be used with --schema or --schema-model", file=sys.stderr)CODE
MEDIUMsrc/json_repair/json_repair.py440 print("Error: --schema-repair-mode salvage requires --schema or --schema-model", file=sys.stderr)CODE
MEDIUMsrc/json_repair/json_repair.py477 print(f"Error: {e!s}", file=sys.stderr)CODE
Self-Referential Comments3 hits · 9 pts
SeverityFileLineSnippetContext
MEDIUMtests/test_repair_json_from_file.py429 # Create a temporary fileCOMMENT
MEDIUMtests/test_repair_json_from_file.py497 # Create a temporary fileCOMMENT
MEDIUMtests/test_repair_json_cli.py14 # Create a temporary fileCOMMENT
Fake / Example Data5 hits · 7 pts
SeverityFileLineSnippetContext
LOWtests/test_parse_array.py99 repair_json('{"bad_one":["Lorem Ipsum", "consectetur" comment" ], "good_one":[ "elit", "sed", "tempor"]}')CODE
LOWtests/test_parse_array.py100 == '{"bad_one": ["Lorem Ipsum", "consectetur", "comment"], "good_one": ["elit", "sed", "tempor"]}'CODE
LOWtests/test_parse_array.py103 repair_json('{"bad_one": ["Lorem Ipsum","consectetur" comment],"good_one": ["elit","sed","tempor"]}')CODE
LOWtests/test_parse_array.py104 == '{"bad_one": ["Lorem Ipsum", "consectetur", "comment"], "good_one": ["elit", "sed", "tempor"]}'CODE
LOWtests/test_parse_string.py82 repair_json('{"key": "lorem ipsum ... "sic " tamet. ...}') == '{"key": "lorem ipsum ... \\"sic \\" tamet. ..."}'CODE
Docstring Block Structure1 hit · 5 pts
SeverityFileLineSnippetContext
HIGHsrc/json_repair/json_repair.py339 Command-line interface for repairing and parsing JSON files. Args: inline_args (Optional[List[str]]): STRING
AI Structural Patterns5 hits · 5 pts
SeverityFileLineSnippetContext
LOWsrc/json_repair/json_repair.py37CODE
LOWsrc/json_repair/json_repair.py53CODE
LOWsrc/json_repair/json_repair.py69CODE
LOWsrc/json_repair/json_repair.py85CODE
LOWsrc/json_repair/json_repair.py100CODE
Over-Commented Block2 hits · 2 pts
SeverityFileLineSnippetContext
LOWpyproject.toml81where = ["src"]COMMENT
LOWpyproject.toml101# Flake8-implicit-str-concat - ISCCOMMENT
Modern Structural Boilerplate1 hit · 1 pts
SeverityFileLineSnippetContext
LOWsrc/json_repair/__init__.py4__all__ = ["JSONReturnType", "from_file", "load", "loads", "repair_json"]CODE