class-metrix 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.prettierrc.json +41 -0
  3. data/.qlty/.gitignore +7 -0
  4. data/.qlty/configs/.yamllint.yaml +8 -0
  5. data/.qlty/qlty.toml +108 -0
  6. data/.rubocop.yml +31 -25
  7. data/.vscode/README.md +255 -47
  8. data/.vscode/extensions.json +8 -13
  9. data/.vscode/keybindings.json +0 -0
  10. data/.vscode/settings.json +81 -11
  11. data/.vscode/tasks.json +231 -0
  12. data/CHANGELOG.md +33 -1
  13. data/README.md +107 -23
  14. data/Rakefile +64 -1
  15. data/Steepfile +26 -0
  16. data/config/brakeman.yml +37 -0
  17. data/docs/ARCHITECTURE.md +90 -48
  18. data/docs/CHANGELOG_EVOLUTION_EXAMPLE.md +95 -0
  19. data/docs/QLTY_INTEGRATION.md +181 -0
  20. data/docs/RELEASE_GUIDE.md +318 -0
  21. data/docs/SLACK_INTEGRATION.md +227 -0
  22. data/examples/README.md +23 -17
  23. data/examples/basic_usage.rb +19 -19
  24. data/examples/debug_levels_demo.rb +15 -16
  25. data/examples/debug_mode_demo.rb +12 -13
  26. data/examples/inheritance_and_modules.rb +45 -45
  27. data/lib/class_metrix/extractor.rb +1 -1
  28. data/lib/class_metrix/extractors/constants_extractor.rb +1 -1
  29. data/lib/class_metrix/extractors/methods_extractor.rb +1 -1
  30. data/lib/class_metrix/extractors/multi_type_extractor.rb +2 -2
  31. data/lib/class_metrix/formatters/base/base_formatter.rb +3 -3
  32. data/lib/class_metrix/formatters/components/footer_component.rb +3 -3
  33. data/lib/class_metrix/formatters/components/generic_header_component.rb +2 -2
  34. data/lib/class_metrix/formatters/components/header_component.rb +4 -4
  35. data/lib/class_metrix/formatters/components/missing_behaviors_component.rb +7 -7
  36. data/lib/class_metrix/formatters/components/table_component/row_processor.rb +8 -5
  37. data/lib/class_metrix/formatters/components/table_component/table_data_extractor.rb +4 -1
  38. data/lib/class_metrix/formatters/components/table_component/table_renderer.rb +2 -2
  39. data/lib/class_metrix/formatters/components/table_component.rb +5 -4
  40. data/lib/class_metrix/formatters/csv_formatter.rb +3 -3
  41. data/lib/class_metrix/formatters/markdown_formatter.rb +3 -4
  42. data/lib/class_metrix/formatters/shared/markdown_table_builder.rb +2 -2
  43. data/lib/class_metrix/formatters/shared/table_builder.rb +8 -6
  44. data/lib/class_metrix/version.rb +1 -1
  45. data/sig/class_metrix.rbs +8 -0
  46. data/sig/extractor.rbs +54 -0
  47. data/sig/extractors.rbs +84 -0
  48. data/sig/formatters_base.rbs +59 -0
  49. data/sig/formatters_components.rbs +133 -0
  50. data/sig/formatters_main.rbs +20 -0
  51. data/sig/formatters_shared.rbs +102 -0
  52. data/sig/manifest.yaml +32 -0
  53. data/sig/utils.rbs +57 -0
  54. data/sig/value_processor.rbs +11 -0
  55. data/sig/version.rbs +4 -0
  56. metadata +94 -4
  57. data/RELEASE_GUIDE.md +0 -158
  58. data/sig/class/metrix.rbs +0 -6
data/sig/extractor.rbs ADDED
@@ -0,0 +1,54 @@
1
+ # Core extractor class that provides the fluent interface
2
+ module ClassMetrix
3
+ class Extractor
4
+ @types: Array[Symbol]
5
+ @classes: Array[Class]
6
+ @filters: Array[Regexp | String]
7
+ @expand_hashes: bool
8
+ @handle_errors: bool
9
+ @modules: Array[Module]
10
+ @include_inherited: bool
11
+ @include_modules: bool
12
+ @show_source: bool
13
+ @hide_main_row: bool
14
+ @hide_key_rows: bool
15
+ @debug_mode: bool
16
+ @debug_level: Symbol
17
+ @logger: ClassMetrix::Utils::DebugLogger?
18
+
19
+ def initialize: (*Symbol types) -> void
20
+
21
+ # Core configuration methods
22
+ def from: (Array[Class] classes) -> self
23
+ def filter: (Regexp | String pattern) -> self
24
+ def expand_hashes: () -> self
25
+ def debug: (?Symbol level) -> self
26
+ def handle_errors: () -> self
27
+ def modules: (Array[Module] module_list) -> self
28
+
29
+ # Inheritance and module inclusion options
30
+ def include_inherited: () -> self
31
+ def include_modules: () -> self
32
+ def show_source: () -> self
33
+ def include_all: () -> self
34
+
35
+ # Hash expansion display options
36
+ def show_only_main: () -> self
37
+ def show_only_keys: () -> self
38
+ def show_expanded_details: () -> self
39
+ def hide_main_row: () -> self
40
+ def hide_key_rows: () -> self
41
+
42
+ # Output methods
43
+ def to_markdown: (?String filename) -> String
44
+ def to_csv: (?String filename) -> String
45
+
46
+ private
47
+
48
+ def extract_all_data: () -> Hash[Symbol, untyped]
49
+ def extract_single_type: (Symbol type) -> Hash[Symbol, untyped]
50
+ def extract_multiple_types: () -> Hash[Symbol, untyped]
51
+ def get_extractor: (Symbol type) -> (ClassMetrix::ConstantsExtractor | ClassMetrix::MethodsExtractor)
52
+ def extraction_options: () -> Hash[Symbol, untyped]
53
+ end
54
+ end
@@ -0,0 +1,84 @@
1
+ # Specialized extractor classes
2
+ module ClassMetrix
3
+ class ConstantsExtractor
4
+ @classes: Array[Class]
5
+ @filters: Array[Regexp | String]
6
+ @handle_errors: bool
7
+ @options: Hash[Symbol, untyped]
8
+ @debug_level: Symbol
9
+ @logger: ClassMetrix::Utils::DebugLogger
10
+
11
+ def initialize: (Array[Class] classes, Array[Regexp | String] filters, bool handle_errors, ?Hash[Symbol, untyped] options) -> void
12
+ def extract: () -> Hash[Symbol, untyped]
13
+
14
+ private
15
+
16
+ def default_options: () -> Hash[Symbol, untyped]
17
+ def build_headers: () -> Array[String]
18
+ def build_rows: (Array[String] constant_names) -> Array[Array[untyped]]
19
+ def get_all_constant_names: () -> Array[String]
20
+ def inheritance_or_modules_enabled?: () -> bool
21
+ def get_comprehensive_constants: (Class klass) -> Array[Symbol]
22
+ def get_inherited_constants: (Class klass) -> Set[Symbol]
23
+ def get_module_constants: (Class klass) -> Set[Symbol]
24
+ def get_all_included_modules: (Class klass) -> Array[Module]
25
+ def core_class?: (untyped klass) -> bool
26
+ def apply_filters: (Array[String] constant_names) -> Array[String]
27
+ def extract_constant_value: (Class klass, String const_name) -> untyped
28
+ def find_constant_source: (Class klass, String const_name) -> Hash[Symbol, untyped]?
29
+ def find_inherited_constant: (Class klass, String const_name) -> Hash[Symbol, untyped]?
30
+ def find_module_constant: (Class klass, String const_name) -> Hash[Symbol, untyped]?
31
+ def build_constant_info: (untyped value, String source, Symbol type) -> Hash[Symbol, untyped]
32
+ def debug_log: (String message) -> void
33
+ end
34
+
35
+ class MethodsExtractor
36
+ @classes: Array[Class]
37
+ @filters: Array[Regexp | String]
38
+ @handle_errors: bool
39
+ @options: Hash[Symbol, untyped]
40
+
41
+ def initialize: (Array[Class] classes, Array[Regexp | String] filters, bool handle_errors, ?Hash[Symbol, untyped] options) -> void
42
+ def extract: () -> Hash[Symbol, untyped]
43
+
44
+ private
45
+
46
+ def default_options: () -> Hash[Symbol, untyped]
47
+ def build_headers: () -> Array[String]
48
+ def build_rows: (Array[String] method_names) -> Array[Array[untyped]]
49
+ def get_all_class_method_names: () -> Array[String]
50
+ def inheritance_or_modules_enabled?: () -> bool
51
+ def get_comprehensive_methods: (Class klass) -> Array[Symbol]
52
+ def get_inherited_methods: (Class klass) -> Set[Symbol]
53
+ def get_module_methods: (Class klass) -> Set[Symbol]
54
+ def excluded_module_method?: (String method_name) -> bool
55
+ def get_all_singleton_modules: (Class klass) -> Array[Module]
56
+ def core_class?: (untyped klass) -> bool
57
+ def core_module?: (untyped mod) -> bool
58
+ def apply_filters: (Array[String] method_names) -> Array[String]
59
+ def call_class_method: (Class klass, String method_name) -> untyped
60
+ def call_method: (Hash[Symbol, untyped] method_info, Class klass, String method_name) -> untyped
61
+ def find_method_source: (Class klass, String method_name) -> Hash[Symbol, untyped]?
62
+ def find_inherited_method: (Class klass, Symbol method_sym, String method_name) -> Hash[Symbol, untyped]?
63
+ def find_module_method: (Class klass, Symbol method_sym, String method_name) -> Hash[Symbol, untyped]?
64
+ def determine_module_source: (Class klass, Module mod) -> String
65
+ def build_method_info: (String source, Symbol type, Proc? callable) -> Hash[Symbol, untyped]
66
+ end
67
+
68
+ class MultiTypeExtractor
69
+ @classes: Array[Class]
70
+ @types: Array[Symbol]
71
+ @filters: Array[Regexp | String]
72
+ @modules: Array[Module]
73
+ @handle_errors: bool
74
+ @options: Hash[Symbol, untyped]
75
+
76
+ def initialize: (Array[Class] classes, Array[Symbol] types, Array[Regexp | String] filters, ?Hash[Symbol, untyped] extraction_config) -> void
77
+ def extract: () -> Hash[Symbol, untyped]
78
+
79
+ private
80
+
81
+ def extract_single_type: (Symbol type) -> Hash[Symbol, untyped]
82
+ def type_label: (Symbol type) -> String
83
+ end
84
+ end
@@ -0,0 +1,59 @@
1
+ # Base formatter classes
2
+ module ClassMetrix
3
+ module Formatters
4
+ module Base
5
+ class BaseFormatter
6
+ attr_reader data: Hash[Symbol, untyped]
7
+ attr_reader expand_hashes: bool
8
+ attr_reader options: Hash[Symbol, untyped]
9
+
10
+ def initialize: (Hash[Symbol, untyped] data, ?bool expand_hashes, ?Hash[Symbol, untyped] options) -> void
11
+ def format: () -> String
12
+
13
+ private
14
+
15
+ def default_options: () -> Hash[Symbol, untyped]
16
+ def has_type_column?: () -> bool
17
+ def behavior_column_index: () -> Integer
18
+ def value_start_index: () -> Integer
19
+ def class_headers: () -> Array[String]
20
+ def collect_all_hash_keys: (Array[Array[untyped]] rows, Array[String] _headers) -> Hash[String, Set[String]]
21
+ def determine_table_data: () -> Hash[Symbol, untyped]
22
+ def render_markdown_table: (Hash[Symbol, untyped] table_data) -> Array[String]
23
+ def render_csv_table: (Hash[Symbol, untyped] table_data) -> Array[String]
24
+ def calculate_column_widths: (Array[String] headers, Array[Array[untyped]] rows) -> Array[Integer]
25
+ def build_header_row: (Array[String] headers, Array[Integer] widths) -> String
26
+ def build_separator_row: (Array[Integer] widths) -> String
27
+ def build_data_rows: (Array[Array[untyped]] rows, Array[String] headers, Array[Integer] widths) -> Array[String]
28
+ def build_single_data_row: (Array[untyped] row, Array[String] headers, Array[Integer] widths) -> String
29
+ def pad_row_to_header_length: (Array[untyped] row, Integer header_length) -> Array[untyped]
30
+ def format_row_cells: (Array[untyped] row, Array[Integer] widths) -> Array[String]
31
+ def truncate_cell: (String cell, Integer max_width) -> String
32
+ def truncate_hash_representation: (String text, Integer max_width) -> String
33
+ def format_cell: (untyped cell) -> String
34
+ def format_csv_cell: (untyped cell) -> String
35
+ def process_value: (untyped value, ?Symbol format) -> String
36
+ def safe_hash_lookup: (Hash[untyped, untyped] hash, untyped key) -> untyped
37
+ def has_hash_key?: (Hash[untyped, untyped] hash, untyped key) -> bool
38
+ end
39
+
40
+ class BaseComponent
41
+ attr_reader data: Hash[Symbol, untyped]
42
+ attr_reader options: Hash[Symbol, untyped]
43
+ attr_reader value_processor: untyped
44
+
45
+ def initialize: (Hash[Symbol, untyped] data, ?Hash[Symbol, untyped] options) -> void
46
+ def generate: () -> Array[String]
47
+
48
+ private
49
+
50
+ def has_type_column?: () -> bool
51
+ def behavior_column_index: () -> Integer
52
+ def value_start_index: () -> Integer
53
+ def class_headers: () -> Array[String]
54
+ def extraction_types_description: () -> String
55
+ def format_timestamp: () -> String
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,133 @@
1
+ # Component classes for formatters
2
+ module ClassMetrix
3
+ module Formatters
4
+ module Components
5
+ class HeaderComponent < Base::BaseComponent
6
+ def generate: () -> Array[String]
7
+ def generate_title: () -> Array[String]
8
+
9
+ private
10
+
11
+ def generate_title_section: () -> Array[String]
12
+ def generate_classes_section: () -> Array[String]
13
+ def generate_extraction_info: () -> Array[String]
14
+ end
15
+
16
+ class TableComponent < Base::BaseComponent
17
+ def generate: () -> Array[String]
18
+
19
+ private
20
+
21
+ def process_table_data: () -> Hash[Symbol, untyped]
22
+ def build_table: (Hash[Symbol, untyped] processed_data) -> Array[String]
23
+
24
+ class TableDataExtractor
25
+ @headers: Array[String]
26
+
27
+ def initialize: (Array[String] headers) -> void
28
+ def behavior_column_index: () -> Integer
29
+ def value_start_index: () -> Integer
30
+ def class_headers: () -> Array[String]
31
+ def has_type_column?: () -> bool
32
+ def row_has_expandable_hash?: (Array[untyped] row) -> bool
33
+ def extract_row_data: (Array[untyped] row) -> Hash[Symbol, untyped]
34
+ def collect_hash_keys: (Array[untyped] values) -> Set[String]
35
+
36
+ private
37
+
38
+ def determine_hash_presence: (Array[untyped] row) -> bool
39
+ end
40
+
41
+ class RowProcessor
42
+ @data_extractor: TableDataExtractor
43
+ @hide_main_row: bool
44
+ @hide_key_rows: bool
45
+
46
+ def initialize: (TableDataExtractor data_extractor, ?Hash[Symbol, untyped] options) -> void
47
+ def process_simple_rows: (Array[Array[untyped]] rows) -> Array[Array[untyped]]
48
+ def process_expanded_rows: (Array[Array[untyped]] rows) -> Array[Array[untyped]]
49
+
50
+ private
51
+
52
+ def process_non_hash_row: (Array[untyped] row) -> Array[untyped]
53
+ def expand_row: (Array[untyped] row) -> Array[Array[untyped]]
54
+ def build_expanded_rows: (Hash[Symbol, untyped] row_data, Set[String] all_hash_keys, Array[untyped] original_row) -> Array[Array[untyped]]
55
+ def should_show_main_row?: () -> bool
56
+ def should_show_key_rows?: () -> bool
57
+ def build_main_expanded_row: (Hash[Symbol, untyped] row_data) -> Array[untyped]
58
+ def build_key_rows: (Set[String] all_hash_keys, Hash[Symbol, untyped] row_data, Array[untyped] original_row) -> Array[Array[untyped]]
59
+ def build_key_row: (String key, Hash[Symbol, untyped] row_data, Array[untyped] original_row) -> Array[untyped]
60
+ def process_key_values: (String key, Array[untyped] values, Array[untyped] original_row) -> Array[untyped]
61
+ def extract_hash_value: (untyped value, String key) -> untyped
62
+ def handle_non_hash_value: (Array[untyped] original_row, Integer index) -> untyped
63
+ end
64
+
65
+ class ColumnWidthCalculator
66
+ @table_style: Symbol
67
+ @min_column_width: Integer
68
+ @max_column_width: Integer
69
+
70
+ def initialize: (?table_style: Symbol, ?min_column_width: Integer, ?max_column_width: Integer) -> void
71
+ def calculate: (Integer col_count, Array[String] headers, Array[Array[untyped]] rows) -> Array[Integer]
72
+ def calculate_widths: (Array[String] headers, Array[Array[untyped]] rows) -> Array[Integer]
73
+
74
+ private
75
+
76
+ def initialize_column_widths: (Integer col_count, Array[String] headers) -> Array[Integer]
77
+ def update_widths_from_rows: (Array[Integer] widths, Array[Array[untyped]] rows, Integer col_count) -> void
78
+ def apply_minimum_widths: (Array[Integer] widths) -> Array[Integer]
79
+ def calculate_cell_width: (untyped cell) -> Integer
80
+ end
81
+
82
+ class TableRenderer
83
+ @table_style: Symbol
84
+ @max_column_width: Integer
85
+
86
+ def initialize: (?table_style: Symbol, ?max_column_width: Integer) -> void
87
+ def render: (Array[String] headers, Array[Array[untyped]] rows, Array[Integer] column_widths) -> Array[String]
88
+ def render_table: (Array[String] headers, Array[Array[untyped]] rows, Array[Integer] column_widths) -> Array[String]
89
+
90
+ private
91
+
92
+ def build_row: (Array[untyped] cells, Array[Integer] col_widths) -> String
93
+ def build_separator: (Array[Integer] col_widths) -> String
94
+ def format_cells: (Array[untyped] cells, Array[Integer] col_widths) -> Array[String]
95
+ def format_cell_content: (untyped cell) -> String
96
+ end
97
+ end
98
+
99
+ class FooterComponent < Base::BaseComponent
100
+ def initialize: (Hash[Symbol, untyped] options) -> void
101
+ def generate: () -> Array[String]
102
+ def generate_detailed_footer: () -> Array[String]
103
+ def generate_default_footer: () -> Array[String]
104
+
105
+ private
106
+
107
+ def build_footer_content: () -> Array[String]
108
+ end
109
+
110
+ class MissingBehaviorsComponent < Base::BaseComponent
111
+ @missing_behaviors: Hash[String, Hash[String, String]]
112
+
113
+ def generate: () -> Array[String]
114
+ def track_missing_behaviors: () -> void
115
+ def generate_missing_behaviors_summary: () -> Array[String]
116
+ def generate_grouped_summary: () -> Array[String]
117
+ def generate_flat_summary: () -> Array[String]
118
+ def generate_detailed_summary: () -> Array[String]
119
+
120
+ private
121
+
122
+ def find_missing_behaviors: () -> Hash[String, Array[String]]
123
+ def format_missing_behaviors: (Hash[String, Array[String]] missing) -> Array[String]
124
+ end
125
+
126
+ class GenericHeaderComponent < Base::BaseComponent
127
+ def generate: () -> Array[String]
128
+ def generate_markdown_header: () -> Array[String]
129
+ def generate_csv_header: () -> Array[String]
130
+ end
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,20 @@
1
+ # Main formatter classes
2
+ module ClassMetrix
3
+ class MarkdownFormatter < Formatters::Base::BaseFormatter
4
+ def initialize: (Hash[Symbol, untyped] data, ?bool expand_hashes, ?Hash[Symbol, untyped] options) -> void
5
+ def format: () -> String
6
+
7
+ private
8
+
9
+ def generate_markdown_content: () -> String
10
+ end
11
+
12
+ class CsvFormatter < Formatters::Base::BaseFormatter
13
+ def initialize: (Hash[Symbol, untyped] data, ?bool expand_hashes, ?Hash[Symbol, untyped] options) -> void
14
+ def format: () -> String
15
+
16
+ private
17
+
18
+ def generate_csv_content: () -> String
19
+ end
20
+ end
@@ -0,0 +1,102 @@
1
+ # Shared table builder classes and value processor
2
+ module ClassMetrix
3
+ module Formatters
4
+ module Shared
5
+ class ValueProcessor
6
+ def self.process_for_markdown: (untyped value, ?debug_mode: bool, ?debug_level: Symbol) -> String
7
+ def self.process_for_csv: (untyped value, ?Hash[Symbol, untyped] options, ?debug_mode: bool, ?debug_level: Symbol) -> String
8
+ def self.process_csv_value_by_type: (untyped value, untyped logger, String null_value) -> String
9
+ def self.process_hash_for_csv: (Hash[untyped, untyped] value, untyped logger) -> String
10
+ def self.process_array_for_csv: (Array[untyped] value, untyped logger) -> String
11
+ def self.process_string_for_csv: (String value, String null_value) -> String
12
+ def self.process_other_for_csv: (untyped value, untyped logger) -> String
13
+ def self.safe_hash_lookup: (Hash[untyped, untyped] hash, untyped key, ?debug_mode: bool, ?debug_level: Symbol) -> untyped
14
+ def self.has_hash_key?: (Hash[untyped, untyped] hash, untyped key, ?debug_mode: bool, ?debug_level: Symbol) -> bool
15
+ def self.missing_constant: () -> String
16
+ def self.missing_method: () -> String
17
+ def self.handle_extraction_error: (Exception error) -> String
18
+ def self.missing_hash_key: () -> String
19
+ end
20
+ class TableBuilder
21
+ @data: Hash[Symbol, untyped]
22
+ @expand_hashes: bool
23
+ @options: Hash[Symbol, untyped]
24
+
25
+ def initialize: (Hash[Symbol, untyped] data, bool expand_hashes, Hash[Symbol, untyped] options) -> void
26
+ def build: () -> Array[String]
27
+ def build_simple_table: () -> Hash[Symbol, untyped]
28
+ def build_expanded_table: () -> Hash[Symbol, untyped]
29
+ def build_flattened_table: () -> Hash[Symbol, untyped]
30
+ def process_rows_for_expansion: (Array[String] headers) -> Array[Array[untyped]]
31
+ def row_has_expandable_hash?: (Array[untyped] row) -> bool
32
+ def create_flattened_rows: (Array[Array[untyped]] rows, Array[String] headers, Hash[String, Set[String]] all_hash_keys) -> Array[Array[untyped]]
33
+ def has_type_column?: () -> bool
34
+ def behavior_column_index: () -> Integer
35
+ def value_start_index: () -> Integer
36
+ def class_headers: () -> Array[String]
37
+ def process_row: (Array[untyped] row) -> Array[untyped]
38
+ def process_value: (untyped value) -> String
39
+ def expand_row: (Array[untyped] row, Array[String] _headers) -> Array[Array[untyped]]
40
+ def collect_hash_keys_from_values: (Array[untyped] values) -> Set[String]
41
+ def build_expanded_row_set: (Array[untyped] row, String behavior_name, Array[untyped] values, Set[String] all_hash_keys) -> Array[Array[untyped]]
42
+ def should_show_main_row?: () -> bool
43
+ def should_show_key_rows?: () -> bool
44
+ def build_main_row: (Array[untyped] row, String behavior_name, Array[untyped] values) -> Array[untyped]
45
+ def build_sub_rows: (Set[String] all_hash_keys, Array[untyped] values) -> Array[Array[untyped]]
46
+ def build_single_sub_row: (String key, Array[untyped] values) -> Array[untyped]
47
+ def extract_key_values: (Array[untyped] values, String key) -> Array[untyped]
48
+ def extract_single_key_value: (untyped value, String key) -> untyped
49
+ def extract_hash_value_for_key: (Hash[untyped, untyped] hash, String key) -> untyped
50
+ def collect_all_hash_keys: (Array[Array[untyped]] rows, Array[String] _headers) -> Hash[String, Set[String]]
51
+ def collect_hash_keys_for_row: (Array[untyped] row, Integer value_start_idx, Hash[String, Set[String]] all_keys) -> Integer
52
+ def create_flattened_headers: (Array[String] headers, Hash[String, Set[String]] all_hash_keys) -> Array[String]
53
+ def add_hash_key_headers: (Array[String] flattened, Hash[String, Set[String]] all_hash_keys, Array[String] class_hdrs) -> void
54
+ def add_behavior_key_headers: (Array[String] flattened, String behavior_name, Set[String] keys, Array[String] class_hdrs) -> void
55
+ def flatten_row: (Array[untyped] row, Array[String] _headers, Hash[String, Set[String]] all_hash_keys) -> Array[untyped]
56
+ def extract_hash_key_value: (Hash[untyped, untyped] hash, String key) -> untyped
57
+ def add_flattened_hash_values: (Array[untyped] flattened, Array[untyped] row, String behavior_name, Hash[String, Set[String]] all_hash_keys) -> void
58
+ def add_flattened_values_for_key: (Array[untyped] flattened, Array[untyped] values, String key) -> void
59
+ def extract_flattened_value: (untyped value, String key) -> untyped
60
+ def get_null_value: () -> String
61
+
62
+ private
63
+
64
+ def create_header_row: (Array[String] headers) -> String
65
+ def create_separator_row: (Array[String] headers) -> String
66
+ def create_data_row: (Array[untyped] row) -> String
67
+ end
68
+
69
+ class MarkdownTableBuilder < TableBuilder
70
+ def build: () -> Array[String]
71
+ def process_value: (untyped value) -> String
72
+ def get_null_value: () -> String
73
+ def expand_row: (Array[untyped] row, Array[String] _headers) -> Array[Array[untyped]]
74
+ def collect_unique_hash_keys: (Array[untyped] values) -> Set[String]
75
+ def build_expanded_row_structure: (Array[untyped] row, String behavior_name, Array[untyped] values, Set[String] all_hash_keys) -> Array[Array[untyped]]
76
+ def build_main_row: (Array[untyped] row, String behavior_name, Array[untyped] values) -> Array[untyped]
77
+ def build_hash_key_rows: (Array[untyped] row, String behavior_name, Array[untyped] values, Set[String] all_hash_keys) -> Array[Array[untyped]]
78
+ def build_single_key_row: (Array[untyped] row, String behavior_name, Array[untyped] values, String key) -> Array[untyped]
79
+ def extract_key_values_for_row: (Array[untyped] values, String key) -> Array[untyped]
80
+ def extract_single_key_value: (untyped value, String key) -> untyped
81
+ def extract_hash_key_value: (Hash[untyped, untyped] hash, String key) -> untyped
82
+
83
+ private
84
+
85
+ def create_header_row: (Array[String] headers) -> String
86
+ def create_separator_row: (Array[String] headers) -> String
87
+ def create_data_row: (Array[untyped] row) -> String
88
+ end
89
+
90
+ class CsvTableBuilder < TableBuilder
91
+ def build: () -> Array[String]
92
+ def process_value: (untyped value) -> String
93
+ def get_null_value: () -> String
94
+
95
+ private
96
+
97
+ def create_csv_row: (Array[untyped] row) -> String
98
+ def escape_csv_value: (untyped value) -> String
99
+ end
100
+ end
101
+ end
102
+ end
data/sig/manifest.yaml ADDED
@@ -0,0 +1,32 @@
1
+ # manifest.yaml for RBS type definitions
2
+ # This file defines the structure and dependencies of the RBS signatures
3
+
4
+ dependencies:
5
+ - name: csv
6
+ version: ~> 3.0
7
+ - name: pathname
8
+ version: ~> 0.2
9
+ - name: json
10
+ version: ~> 2.0
11
+ - name: fileutils
12
+ version: ~> 1.0
13
+
14
+ type_definitions:
15
+ - class_metrix.rbs # Main module and entry point
16
+ - version.rbs # Version constant
17
+ - extractor.rbs # Core extractor fluent interface
18
+ - extractors.rbs # Specialized extractor classes
19
+ - formatters_base.rbs # Base formatter and component classes
20
+ - formatters_components.rbs # Component classes for formatters
21
+ - formatters_shared.rbs # Shared table builder classes
22
+ - formatters_main.rbs # Main formatter classes
23
+ - utils.rbs # Utility classes and processors
24
+
25
+ coverage_targets:
26
+ - lib/class_metrix.rb
27
+ - lib/class_metrix/version.rb
28
+ - lib/class_metrix/extractor.rb
29
+ - lib/class_metrix/extractors/
30
+ - lib/class_metrix/formatters/
31
+ - lib/class_metrix/utils/
32
+ - lib/class_metrix/processors/
data/sig/utils.rbs ADDED
@@ -0,0 +1,57 @@
1
+ # Utility classes
2
+ module ClassMetrix
3
+ module Utils
4
+ class ClassResolver
5
+ def self.normalize_classes: (Array[Class | String] classes) -> Array[Class]
6
+ def self.resolve_class: (Class | String klass) -> Class
7
+ def self.string_to_class: (String class_name) -> Class
8
+ end
9
+
10
+ class DebugLogger
11
+ LEVELS: Hash[Symbol, Integer]
12
+
13
+ @component_name: String
14
+ @debug_mode: bool
15
+ @level: Integer
16
+
17
+ def initialize: (String component_name, bool debug_mode, Symbol debug_level) -> void
18
+ def log: (String message, ?Symbol level) -> void
19
+ def enabled?: () -> bool
20
+ def log_safe_operation: (String operation_name, ?Symbol level) { () -> untyped } -> untyped
21
+ def log_summary: (String operation, Array[untyped] items) { (untyped item, Integer index) -> void } -> void
22
+ def log_decision: (String decision, String reason, ?Symbol level) -> void
23
+ def log_anomaly: (String description) -> void
24
+ def safe_inspect: (untyped value) -> String
25
+ def safe_class: (untyped value) -> String
26
+ def safe_keys: (untyped value) -> String
27
+ def safe_length: (untyped value) -> String
28
+ def safe_truncate: (String str, Integer max_length) -> String
29
+ def safe_to_s: (untyped value) -> String
30
+ def log_value_details: (untyped value, ?Integer? index, ?Symbol level) -> void
31
+ def log_hash_detection: (untyped value, ?Integer? index, ?Symbol level) -> void
32
+ def log_hash_detection_summary: (Array[untyped] values) -> void
33
+ def set_level: (Symbol level) -> void
34
+
35
+ private
36
+
37
+ def should_log?: (Symbol level) -> bool
38
+ def format_message: (String message) -> String
39
+ end
40
+ end
41
+ end
42
+
43
+ # Root level classes for processors
44
+ class ValueProcessor
45
+ def self.process: (untyped value, ?expand_hashes: bool) -> untyped
46
+ def self.format_hash: (Hash[untyped, untyped] hash) -> String
47
+ def self.expand_hash: (Hash[untyped, untyped] hash) -> Array[Hash[Symbol, untyped]]
48
+ def self.handle_extraction_error: (Exception error) -> String
49
+ def self.missing_constant: () -> String
50
+ def self.missing_method: () -> String
51
+ end
52
+
53
+ # Root level utility class references
54
+ module ClassMetrix
55
+ class ClassResolver < Utils::ClassResolver
56
+ end
57
+ end
@@ -0,0 +1,11 @@
1
+ # Legacy value processor for backward compatibility
2
+ module ClassMetrix
3
+ class ValueProcessor
4
+ def self.process: (untyped value, ?expand_hashes: bool) -> (String | Array[Hash[Symbol, untyped]])
5
+ def self.format_hash: (Hash[untyped, untyped] hash) -> String
6
+ def self.expand_hash: (Hash[untyped, untyped] hash) -> Array[Hash[Symbol, untyped]]
7
+ def self.handle_extraction_error: (Exception error) -> String
8
+ def self.missing_constant: () -> String
9
+ def self.missing_method: () -> String
10
+ end
11
+ end
data/sig/version.rbs ADDED
@@ -0,0 +1,4 @@
1
+ # Version information
2
+ module ClassMetrix
3
+ VERSION: String
4
+ end