Class: Solidstats::MyTodoService
- Inherits:
-
Object
- Object
- Solidstats::MyTodoService
- Defined in:
- app/services/solidstats/my_todo_service.rb
Overview
Enhanced TODO service for comprehensive project scanning
Constant Summary collapse
- CACHE_FILE =
Rails.root.join("solidstats", "todos.json")
- CACHE_DURATION =
24.hours
- TODO_PATTERNS =
[ /TODO:?\s*(.+)/i, /FIXME:?\s*(.+)/i, /HACK:?\s*(.+)/i, /NOTE:?\s*(.+)/i, /BUG:?\s*(.+)/i ].freeze
- SCAN_EXTENSIONS =
%w[.rb .js .html .erb .yml .yaml .json .css .scss .vue .jsx .tsx .ts].freeze
- EXCLUDE_DIRS =
%w[node_modules vendor tmp log public/assets .git coverage pkg app/assets/builds solidstats].freeze
Class Method Summary collapse
Class Method Details
.collect_todos(force_refresh: false) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'app/services/solidstats/my_todo_service.rb', line 23 def self.collect_todos(force_refresh: false) return cached_todos unless force_refresh || cache_expired? todos = scan_project_files cache_todos(todos) update_summary_json(todos) todos end |
.get_summary ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/services/solidstats/my_todo_service.rb', line 32 def self.get_summary todos = collect_todos { total_count: todos.length, by_type: todos.group_by { |t| t[:type] }.transform_values(&:count), by_file: todos.group_by { |t| t[:file] }.transform_values(&:count), top_files: todos.group_by { |t| t[:file] } .transform_values(&:count) .sort_by { |_, count| -count } .first(5) .to_h, status: determine_status(todos), last_updated: Time.current.iso8601 } end |