class

Tokei::Api::Models::Analysis

Inherits Reference < Object

Model class representing repository analysis results

Constants

EMPTY_RESULT_JSON = JSON.parse("{}")

Constructors

new(repo_url : String, result : String | JSON::Any)
Source

Class methods

cleanup_old_data

Delete analyses older than the retention period (default: 30 days) Can be configured via RETENTION_DAYS environment variable

Source
find(id : String) : Analysis | Nil

Search by ID

Source
find_by_repo_url(repo_url : String) : Array(Analysis)

Search by repository URL

Source
find_latest_by_repo_url(repo_url : String) : Analysis | Nil

Search latest analysis by repository URL without loading large result JSON. Useful for summary/badge flows where only precomputed stats are needed.

Source
find_latest_full_by_repo_url(repo_url : String) : Analysis | Nil

Search latest analysis by repository URL with the full result JSON. Useful for flows that need language breakdown data.

Source
find_summary_by_id(id : String) : Analysis | Nil

Search by ID without loading large result JSON. Useful for badge endpoint where only stats are required.

Source

Instance methods

analyzed_at
Source
analyzed_at=(analyzed_at : Time | Nil)
Source
code_comment_ratio
Source
code_comment_ratio=(code_comment_ratio : Float64 | Nil)
Source
id=(id : UUID | Nil)
Source
language_count
Source
language_count=(language_count : Int32 | Nil)
Source
repo_url
Source
repo_url=(repo_url : String)
Source
result
Source
result=(result : JSON::Any)
Source
save

Save to database

Source
top_language
Source
top_language=(top_language : String | Nil)
Source
top_language_lines
Source
top_language_lines=(top_language_lines : Int32 | Nil)
Source
total_blanks
Source
total_blanks=(total_blanks : Int32 | Nil)
Source
total_code
Source
total_code=(total_code : Int32 | Nil)
Source
total_comments
Source
total_comments=(total_comments : Int32 | Nil)
Source
total_lines

Badge statistics properties

Source
total_lines=(total_lines : Int32 | Nil)

Badge statistics properties

Source