• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nshkrdotcom / ElixirScope / e3c85b2dec2a55971a334d0061997410177723b4

28 May 2025 09:47AM UTC coverage: 59.568% (-4.1%) from 63.697%
e3c85b2dec2a55971a334d0061997410177723b4

push

github

NSHkr
Add new AST enhanced features with tests. 892 tests, 0 failures, 76 excluded

1752 of 3271 new or added lines in 17 files covered. (53.56%)

3 existing lines in 1 file now uncovered.

4797 of 8053 relevant lines covered (59.57%)

3798.33 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/lib/elixir_scope/ast_repository/enhanced/shared_data_structures.ex
1
defmodule ElixirScope.ASTRepository.Enhanced.SharedDataStructures do
2
  @moduledoc """
3
  Shared data structures used across CFG, DFG, and CPG components.
4
  
5
  This module contains common structures to avoid duplication and ensure consistency.
6
  """
7

8
  # Re-export all shared structures
NEW
9
  defdelegate scope_types(), to: ScopeInfo
×
NEW
10
  defdelegate complexity_metrics_fields(), to: ComplexityMetrics
×
11
end
12

13
defmodule ElixirScope.ASTRepository.Enhanced.ScopeInfo do
14
  @moduledoc """
15
  Information about variable scopes in Elixir.
16
  Shared between CFG and DFG analysis.
17
  """
18

19
  defstruct [
20
    :id,                    # Unique scope identifier
21
    :type,                  # Scope type (see @scope_types)
22
    :parent_scope,          # Parent scope ID
23
    :child_scopes,          # [scope_id] - Child scopes
24
    :variables,             # [variable_name] - Variables in scope (CFG) or [VariableVersion.t()] (DFG)
25
    :ast_node_id,           # AST node that creates this scope
26
    :entry_points,          # [ast_node_id] - Ways to enter scope
27
    :exit_points,           # [ast_node_id] - Ways to exit scope
28
    :metadata               # Additional metadata
29
  ]
30

31
  @type t :: %__MODULE__{
32
    id: String.t(),
33
    type: atom(),
34
    parent_scope: String.t() | nil,
35
    child_scopes: [String.t()],
36
    variables: [String.t()] | [term()], # Flexible to handle both CFG and DFG usage
37
    ast_node_id: String.t(),
38
    entry_points: [String.t()],
39
    exit_points: [String.t()],
40
    metadata: map()
41
  }
42

43
  @scope_types [
44
    :function,              # Function scope
45
    :case_clause,           # Case clause scope
46
    :if_branch,             # If/else branch scope
47
    :try_block,             # Try block scope
48
    :catch_clause,          # Catch/rescue clause scope
49
    :comprehension,         # Comprehension scope
50
    :receive_clause,        # Receive clause scope
51
    :anonymous_function,    # Anonymous function scope
52
    :module                 # Module scope
53
  ]
54

NEW
55
  def scope_types, do: @scope_types
×
56
end
57

58
# ComplexityMetrics is defined in complexity_metrics.ex
59
# We just re-export it here for convenience
60
alias ElixirScope.ASTRepository.Enhanced.ComplexityMetrics 
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc