class-metrix 0.1.2 → 1.0.1
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.
- checksums.yaml +4 -4
- data/.editorconfig +48 -0
- data/.vscode/README.md +128 -0
- data/.vscode/extensions.json +31 -0
- data/.vscode/keybindings.json +26 -0
- data/.vscode/launch.json +32 -0
- data/.vscode/rbs.code-snippets +61 -0
- data/.vscode/settings.json +112 -0
- data/.vscode/tasks.json +240 -0
- data/CHANGELOG.md +73 -4
- data/README.md +86 -22
- data/Steepfile +26 -0
- data/docs/ARCHITECTURE.md +501 -0
- data/docs/CHANGELOG_EVOLUTION_EXAMPLE.md +95 -0
- data/examples/README.md +161 -114
- data/examples/basic_usage.rb +88 -0
- data/examples/debug_levels_demo.rb +65 -0
- data/examples/debug_mode_demo.rb +75 -0
- data/examples/inheritance_and_modules.rb +155 -0
- data/lib/class_metrix/extractor.rb +106 -11
- data/lib/class_metrix/extractors/constants_extractor.rb +155 -21
- data/lib/class_metrix/extractors/methods_extractor.rb +186 -21
- data/lib/class_metrix/extractors/multi_type_extractor.rb +8 -7
- data/lib/class_metrix/formatters/base/base_formatter.rb +3 -3
- data/lib/class_metrix/formatters/components/footer_component.rb +4 -4
- data/lib/class_metrix/formatters/components/generic_header_component.rb +2 -2
- data/lib/class_metrix/formatters/components/header_component.rb +4 -4
- data/lib/class_metrix/formatters/components/missing_behaviors_component.rb +7 -7
- data/lib/class_metrix/formatters/components/table_component/column_width_calculator.rb +56 -0
- data/lib/class_metrix/formatters/components/table_component/row_processor.rb +141 -0
- data/lib/class_metrix/formatters/components/table_component/table_data_extractor.rb +57 -0
- data/lib/class_metrix/formatters/components/table_component/table_renderer.rb +55 -0
- data/lib/class_metrix/formatters/components/table_component.rb +32 -245
- data/lib/class_metrix/formatters/csv_formatter.rb +3 -3
- data/lib/class_metrix/formatters/markdown_formatter.rb +3 -4
- data/lib/class_metrix/formatters/shared/markdown_table_builder.rb +12 -7
- data/lib/class_metrix/formatters/shared/table_builder.rb +92 -27
- data/lib/class_metrix/formatters/shared/value_processor.rb +72 -16
- data/lib/class_metrix/utils/debug_logger.rb +159 -0
- data/lib/class_metrix/version.rb +1 -1
- data/sig/class_metrix.rbs +8 -0
- data/sig/extractor.rbs +54 -0
- data/sig/extractors.rbs +84 -0
- data/sig/formatters_base.rbs +59 -0
- data/sig/formatters_components.rbs +133 -0
- data/sig/formatters_main.rbs +20 -0
- data/sig/formatters_shared.rbs +102 -0
- data/sig/manifest.yaml +32 -0
- data/sig/utils.rbs +57 -0
- data/sig/value_processor.rbs +11 -0
- data/sig/version.rbs +4 -0
- metadata +60 -10
- data/examples/advanced/error_handling.rb +0 -199
- data/examples/advanced/hash_expansion.rb +0 -180
- data/examples/basic/01_simple_constants.rb +0 -56
- data/examples/basic/02_simple_methods.rb +0 -99
- data/examples/basic/03_multi_type_extraction.rb +0 -116
- data/examples/components/configurable_reports.rb +0 -201
- data/examples/csv_output_demo.rb +0 -237
- data/examples/real_world/microservices_audit.rb +0 -312
- data/sig/class/metrix.rbs +0 -6
data/CHANGELOG.md
CHANGED
|
@@ -5,20 +5,88 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [1.0.1] - 2025-06-08
|
|
11
|
+
|
|
12
|
+
## [1.0.0] - 2025-06-07
|
|
13
|
+
|
|
14
|
+
### 🎉 Major Release - Production Ready
|
|
15
|
+
|
|
16
|
+
This marks the first stable release of ClassMetrix with a comprehensive feature set and robust architecture.
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- **🐛 Advanced Debug System**: Comprehensive debug logging with three levels (`:basic`, `:detailed`, `:verbose`)
|
|
21
|
+
- Safe object inspection for problematic objects with broken `inspect`/`to_s` methods
|
|
22
|
+
- Smart hash detection to prevent issues with proxy objects
|
|
23
|
+
- Component-specific debug loggers for targeted troubleshooting
|
|
24
|
+
- Error-resistant operations with graceful degradation
|
|
25
|
+
- **📊 Enhanced Hash Expansion**: Multiple hash expansion modes for different analysis needs
|
|
26
|
+
- `show_only_main`: Show collapsed hash representations (default)
|
|
27
|
+
- `show_only_keys`: Show only expanded key rows for detailed analysis
|
|
28
|
+
- `show_expanded_details`: Show both main and expanded rows
|
|
29
|
+
- Support for nested hash structures with proper truncation
|
|
30
|
+
- **🏗️ Refactored Architecture**: Clean separation of concerns and improved maintainability
|
|
31
|
+
- Modular extractor system with dedicated extractors for each type
|
|
32
|
+
- Shared table builders for consistent formatting across output formats
|
|
33
|
+
- Centralized value processor for robust value handling
|
|
34
|
+
- Component-based formatter architecture
|
|
35
|
+
- **⚙️ Enhanced Configuration**: More granular control over extraction and formatting
|
|
36
|
+
- Hash expansion display options (`hide_main_row`, `hide_key_rows`)
|
|
37
|
+
- Improved inheritance and module inclusion handling
|
|
38
|
+
- Better error handling and recovery mechanisms
|
|
39
|
+
- **🔧 VS Code Integration**: Complete development environment setup
|
|
40
|
+
- Auto-formatting with Rubocop integration
|
|
41
|
+
- Task definitions for common operations
|
|
42
|
+
- Debug configurations for Ruby and RSpec
|
|
43
|
+
- Recommended extensions for optimal development experience
|
|
44
|
+
|
|
45
|
+
### Enhanced
|
|
46
|
+
|
|
47
|
+
- **Hash Processing**: Robust handling of complex nested structures and edge cases
|
|
48
|
+
- **CSV Export**: Improved hash flattening with better column organization
|
|
49
|
+
- **Error Handling**: More resilient extraction with detailed error reporting
|
|
50
|
+
- **Performance**: Optimized table building and value processing
|
|
51
|
+
- **Documentation**: Comprehensive examples and architecture documentation
|
|
52
|
+
|
|
53
|
+
### Fixed
|
|
54
|
+
|
|
55
|
+
- Parameter list optimization in `MultiTypeExtractor` (reduced from 6 to 5 parameters)
|
|
56
|
+
- Method length optimization in `ValueProcessor.process_for_csv` (reduced from 28 to 25 lines)
|
|
57
|
+
- Improved hash detection to prevent issues with ActiveRecord and other proxy objects
|
|
58
|
+
- Better handling of objects with problematic method behaviors
|
|
59
|
+
|
|
60
|
+
### Technical Improvements
|
|
61
|
+
|
|
62
|
+
- **Safety-First Design**: All operations wrapped with exception handling
|
|
63
|
+
- **Debug Integration**: Every component includes comprehensive debug logging
|
|
64
|
+
- **Type Safety**: Strict hash detection prevents issues with duck-typed objects
|
|
65
|
+
- **Modular Design**: Easy to extend with new extraction types and formatters
|
|
66
|
+
- **Test Coverage**: Extensive test suite covering edge cases and error conditions
|
|
67
|
+
|
|
68
|
+
### Breaking Changes
|
|
69
|
+
|
|
70
|
+
- Hash expansion now defaults to `show_only_main` (was `show_expanded_details`)
|
|
71
|
+
- Some internal API changes for better consistency (affects custom extensions)
|
|
72
|
+
|
|
73
|
+
## [0.1.2] - 2025-06-07
|
|
9
74
|
|
|
10
75
|
### Added
|
|
76
|
+
|
|
11
77
|
- GitHub Actions CI/CD workflow for automated releases
|
|
12
78
|
- Multi-version Ruby testing (3.1, 3.2, 3.3)
|
|
13
79
|
- Automated gem publishing to RubyGems
|
|
14
80
|
- Version consistency checking
|
|
15
81
|
|
|
16
82
|
### Changed
|
|
83
|
+
|
|
17
84
|
- Improved CI workflow with better test coverage
|
|
18
85
|
|
|
19
|
-
## [0.1.0] -
|
|
86
|
+
## [0.1.0] - 2025-06-07
|
|
20
87
|
|
|
21
88
|
### Added
|
|
89
|
+
|
|
22
90
|
- Initial release of ClassMetrix
|
|
23
91
|
- Constants extraction from Ruby classes
|
|
24
92
|
- Class methods extraction and comparison
|
|
@@ -32,10 +100,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
32
100
|
- RuboCop integration
|
|
33
101
|
|
|
34
102
|
### Features
|
|
103
|
+
|
|
35
104
|
- 🔍 Multi-Type Extraction: Constants, class methods, and more
|
|
36
|
-
- 📊 Hash Expansion: Expand hash values into readable sub-rows
|
|
105
|
+
- 📊 Hash Expansion: Expand hash values into readable sub-rows
|
|
37
106
|
- 🛡️ Error Handling: Graceful handling of missing methods and constants
|
|
38
107
|
- 📝 Rich Markdown Reports: Professional reports with configurable components
|
|
39
108
|
- 📄 CSV Export: Data analysis-friendly CSV output with hash flattening
|
|
40
109
|
- ⚙️ Highly Configurable: Customize every aspect of the output
|
|
41
|
-
- 🚀 Simple API: Chainable, intuitive interface
|
|
110
|
+
- 🚀 Simple API: Chainable, intuitive interface
|
data/README.md
CHANGED
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
**ClassMetrix** is a Ruby gem that extracts and compares class behaviors (constants, class methods, and more) across multiple classes, generating clean markdown reports for analysis, documentation, and compliance auditing.
|
|
7
7
|
|
|
8
|
+
> **Why "Metrix"?** Short for "metrics" - measuring and analyzing class behaviors.
|
|
9
|
+
|
|
8
10
|
## ✨ Features
|
|
9
11
|
|
|
10
12
|
- **🔍 Multi-Type Extraction**: Constants, class methods, and more
|
|
11
|
-
- **📊 Hash Expansion**: Expand hash values into readable sub-rows
|
|
13
|
+
- **📊 Hash Expansion**: Expand hash values into readable sub-rows
|
|
12
14
|
- **🛡️ Error Handling**: Graceful handling of missing methods and constants
|
|
15
|
+
- **🐛 Debug Mode**: Detailed logging for troubleshooting and analysis
|
|
13
16
|
- **📝 Rich Markdown Reports**: Professional reports with configurable components
|
|
14
17
|
- **📄 CSV Export**: Data analysis-friendly CSV output with hash flattening
|
|
15
18
|
- **⚙️ Highly Configurable**: Customize every aspect of the output
|
|
@@ -29,7 +32,7 @@ ClassMetrix.extract(:constants, :class_methods)
|
|
|
29
32
|
.filter(/config$/)
|
|
30
33
|
.expand_hashes
|
|
31
34
|
.handle_errors
|
|
32
|
-
.to_markdown("audit_report.md",
|
|
35
|
+
.to_markdown("audit_report.md",
|
|
33
36
|
title: "Service Configuration Audit",
|
|
34
37
|
footer_style: :detailed,
|
|
35
38
|
show_missing_summary: true
|
|
@@ -39,7 +42,7 @@ ClassMetrix.extract(:constants, :class_methods)
|
|
|
39
42
|
ClassMetrix.extract(:constants)
|
|
40
43
|
.from([DatabaseConfig, RedisConfig])
|
|
41
44
|
.expand_hashes
|
|
42
|
-
.to_csv("config_analysis.csv",
|
|
45
|
+
.to_csv("config_analysis.csv",
|
|
43
46
|
title: "Configuration Analysis",
|
|
44
47
|
flatten_hashes: true
|
|
45
48
|
)
|
|
@@ -64,6 +67,7 @@ gem install class-metrix
|
|
|
64
67
|
### Basic Extraction
|
|
65
68
|
|
|
66
69
|
#### Constants
|
|
70
|
+
|
|
67
71
|
```ruby
|
|
68
72
|
# Extract constants from multiple classes
|
|
69
73
|
ClassMetrix.extract(:constants)
|
|
@@ -78,6 +82,7 @@ ClassMetrix.extract(:constants)
|
|
|
78
82
|
```
|
|
79
83
|
|
|
80
84
|
#### Class Methods
|
|
85
|
+
|
|
81
86
|
```ruby
|
|
82
87
|
# Extract class method results
|
|
83
88
|
ClassMetrix.extract(:class_methods)
|
|
@@ -93,6 +98,7 @@ ClassMetrix.extract(:class_methods)
|
|
|
93
98
|
```
|
|
94
99
|
|
|
95
100
|
#### Multi-Type Extraction
|
|
101
|
+
|
|
96
102
|
```ruby
|
|
97
103
|
# Combine multiple extraction types in one table
|
|
98
104
|
ClassMetrix.extract(:constants, :class_methods)
|
|
@@ -109,6 +115,7 @@ ClassMetrix.extract(:constants, :class_methods)
|
|
|
109
115
|
### Advanced Features
|
|
110
116
|
|
|
111
117
|
#### Hash Expansion
|
|
118
|
+
|
|
112
119
|
```ruby
|
|
113
120
|
# Expand hash values into readable sub-rows
|
|
114
121
|
ClassMetrix.extract(:constants)
|
|
@@ -126,6 +133,7 @@ ClassMetrix.extract(:constants)
|
|
|
126
133
|
```
|
|
127
134
|
|
|
128
135
|
#### Error Handling
|
|
136
|
+
|
|
129
137
|
```ruby
|
|
130
138
|
# Handle missing methods and constants gracefully
|
|
131
139
|
ClassMetrix.extract(:class_methods)
|
|
@@ -143,6 +151,7 @@ ClassMetrix.extract(:class_methods)
|
|
|
143
151
|
```
|
|
144
152
|
|
|
145
153
|
#### Filtering
|
|
154
|
+
|
|
146
155
|
```ruby
|
|
147
156
|
# Filter behaviors by pattern
|
|
148
157
|
ClassMetrix.extract(:constants)
|
|
@@ -157,7 +166,48 @@ ClassMetrix.extract(:class_methods)
|
|
|
157
166
|
.to_markdown
|
|
158
167
|
```
|
|
159
168
|
|
|
169
|
+
#### Debug Mode
|
|
170
|
+
|
|
171
|
+
```ruby
|
|
172
|
+
# Enable detailed logging for troubleshooting
|
|
173
|
+
ClassMetrix.extract(:constants, :class_methods)
|
|
174
|
+
.from([ServiceA, ServiceB])
|
|
175
|
+
.expand_hashes
|
|
176
|
+
.debug # Enable debug mode (basic level)
|
|
177
|
+
.to_markdown("debug_report.md")
|
|
178
|
+
|
|
179
|
+
# Different debug levels for different needs
|
|
180
|
+
ClassMetrix.extract(:constants)
|
|
181
|
+
.from([ServiceA, ServiceB])
|
|
182
|
+
.debug(:basic) # Key decisions and summaries only
|
|
183
|
+
.to_markdown
|
|
184
|
+
|
|
185
|
+
ClassMetrix.extract(:constants)
|
|
186
|
+
.from([ServiceA, ServiceB])
|
|
187
|
+
.debug(:detailed) # More context and intermediate steps
|
|
188
|
+
.to_markdown
|
|
189
|
+
|
|
190
|
+
ClassMetrix.extract(:constants)
|
|
191
|
+
.from([ServiceA, ServiceB])
|
|
192
|
+
.debug(:verbose) # Full details including individual value processing
|
|
193
|
+
.to_markdown
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Debug Levels:**
|
|
197
|
+
|
|
198
|
+
- **`:basic`** (default) - Key decisions and summaries only
|
|
199
|
+
- **`:detailed`** - More context and intermediate steps
|
|
200
|
+
- **`:verbose`** - Full details including individual value processing
|
|
201
|
+
|
|
202
|
+
**Debug Features:**
|
|
203
|
+
|
|
204
|
+
- **Safe Object Inspection**: Handles objects with problematic `inspect`/`to_s` methods
|
|
205
|
+
- **Hash Detection Analysis**: Shows why objects are/aren't treated as expandable hashes
|
|
206
|
+
- **Smart Logging**: Reduces spam by grouping related operations and focusing on key decisions
|
|
207
|
+
- **Error Diagnostics**: Detailed error context for troubleshooting
|
|
208
|
+
|
|
160
209
|
#### CSV Output
|
|
210
|
+
|
|
161
211
|
```ruby
|
|
162
212
|
# Basic CSV output
|
|
163
213
|
ClassMetrix.extract(:constants)
|
|
@@ -191,6 +241,7 @@ ClassMetrix.extract(:class_methods)
|
|
|
191
241
|
ClassMetrix offers extensive configuration options for customizing report generation:
|
|
192
242
|
|
|
193
243
|
### Markdown Report Options
|
|
244
|
+
|
|
194
245
|
```ruby
|
|
195
246
|
ClassMetrix.extract(:constants)
|
|
196
247
|
.from([User, Admin])
|
|
@@ -198,30 +249,31 @@ ClassMetrix.extract(:constants)
|
|
|
198
249
|
# File and title
|
|
199
250
|
"report.md",
|
|
200
251
|
title: "Custom Report Title",
|
|
201
|
-
|
|
252
|
+
|
|
202
253
|
# Content sections
|
|
203
254
|
show_metadata: true, # Show title and report info
|
|
204
255
|
show_classes: true, # Show "Classes Analyzed" section
|
|
205
256
|
show_extraction_info: true, # Show "Extraction Types" section
|
|
206
257
|
show_missing_summary: false, # Show missing behaviors summary
|
|
207
|
-
|
|
258
|
+
|
|
208
259
|
# Footer configuration
|
|
209
260
|
show_footer: true, # Show footer
|
|
210
261
|
footer_style: :detailed, # :default, :minimal, :detailed
|
|
211
262
|
show_timestamp: true, # Include generation timestamp
|
|
212
263
|
custom_footer: "Custom note", # Custom footer message
|
|
213
|
-
|
|
264
|
+
|
|
214
265
|
# Table formatting
|
|
215
266
|
table_style: :standard, # :standard, :compact, :wide
|
|
216
267
|
min_column_width: 3, # Minimum column width
|
|
217
268
|
max_column_width: 50, # Maximum column width (for :compact style)
|
|
218
|
-
|
|
269
|
+
|
|
219
270
|
# Missing behaviors analysis
|
|
220
271
|
summary_style: :grouped # :grouped, :flat, :detailed
|
|
221
272
|
)
|
|
222
273
|
```
|
|
223
274
|
|
|
224
275
|
### CSV Output Options
|
|
276
|
+
|
|
225
277
|
```ruby
|
|
226
278
|
ClassMetrix.extract(:constants)
|
|
227
279
|
.from([User, Admin])
|
|
@@ -229,16 +281,16 @@ ClassMetrix.extract(:constants)
|
|
|
229
281
|
# File and title
|
|
230
282
|
"report.csv",
|
|
231
283
|
title: "Custom CSV Report",
|
|
232
|
-
|
|
284
|
+
|
|
233
285
|
# Content options
|
|
234
286
|
show_metadata: true, # Show comment headers
|
|
235
287
|
comment_char: "#", # Comment character for metadata
|
|
236
|
-
|
|
288
|
+
|
|
237
289
|
# CSV formatting
|
|
238
290
|
separator: ",", # Column separator (comma, semicolon, tab)
|
|
239
291
|
quote_char: '"', # Quote character
|
|
240
292
|
null_value: "", # Value for nil/missing data
|
|
241
|
-
|
|
293
|
+
|
|
242
294
|
# Hash handling
|
|
243
295
|
flatten_hashes: true, # Flatten hashes into separate columns
|
|
244
296
|
# false = expand into sub-rows
|
|
@@ -248,23 +300,29 @@ ClassMetrix.extract(:constants)
|
|
|
248
300
|
### Footer Styles
|
|
249
301
|
|
|
250
302
|
#### Default Footer
|
|
303
|
+
|
|
251
304
|
```markdown
|
|
252
305
|
---
|
|
253
|
-
|
|
306
|
+
|
|
307
|
+
_Report generated by ClassMetrix gem_
|
|
254
308
|
```
|
|
255
309
|
|
|
256
310
|
#### Minimal Footer
|
|
311
|
+
|
|
257
312
|
```markdown
|
|
258
313
|
---
|
|
259
|
-
|
|
314
|
+
|
|
315
|
+
_Generated by ClassMetrix_
|
|
260
316
|
```
|
|
261
317
|
|
|
262
318
|
#### Detailed Footer
|
|
319
|
+
|
|
263
320
|
```markdown
|
|
264
321
|
---
|
|
322
|
+
|
|
265
323
|
## Report Information
|
|
266
324
|
|
|
267
|
-
- **Generated by**: [ClassMetrix gem](https://github.com/
|
|
325
|
+
- **Generated by**: [ClassMetrix gem](https://github.com/patrick204nqh/class-metrix)
|
|
268
326
|
- **Generated at**: 2024-01-15 14:30:25 UTC
|
|
269
327
|
- **Ruby version**: 3.2.0
|
|
270
328
|
```
|
|
@@ -272,18 +330,22 @@ ClassMetrix.extract(:constants)
|
|
|
272
330
|
### Missing Behaviors Styles
|
|
273
331
|
|
|
274
332
|
#### Grouped (Default)
|
|
333
|
+
|
|
275
334
|
```markdown
|
|
276
335
|
## Missing Behaviors Summary
|
|
277
336
|
|
|
278
337
|
### DatabaseConfig
|
|
338
|
+
|
|
279
339
|
- `redis_config` - 🚫 Not defined
|
|
280
340
|
- `cache_timeout` - 🚫 No method
|
|
281
341
|
|
|
282
|
-
### RedisConfig
|
|
342
|
+
### RedisConfig
|
|
343
|
+
|
|
283
344
|
- `db_config` - 🚫 Not defined
|
|
284
345
|
```
|
|
285
346
|
|
|
286
347
|
#### Flat
|
|
348
|
+
|
|
287
349
|
```markdown
|
|
288
350
|
## Missing Behaviors
|
|
289
351
|
|
|
@@ -293,22 +355,26 @@ ClassMetrix.extract(:constants)
|
|
|
293
355
|
```
|
|
294
356
|
|
|
295
357
|
#### Detailed
|
|
358
|
+
|
|
296
359
|
```markdown
|
|
297
360
|
## Missing Behaviors Analysis
|
|
298
361
|
|
|
299
362
|
**Summary**: 3 missing behaviors across 2 classes
|
|
300
363
|
|
|
301
364
|
### 🚫 Not (2 items)
|
|
365
|
+
|
|
302
366
|
- **DatabaseConfig**: `redis_config` - 🚫 Not defined
|
|
303
367
|
- **RedisConfig**: `db_config` - 🚫 Not defined
|
|
304
368
|
|
|
305
369
|
### 🚫 No (1 items)
|
|
370
|
+
|
|
306
371
|
- **DatabaseConfig**: `cache_timeout` - 🚫 No method
|
|
307
372
|
```
|
|
308
373
|
|
|
309
374
|
## 🎯 Real-World Examples
|
|
310
375
|
|
|
311
376
|
### Microservices Configuration Audit
|
|
377
|
+
|
|
312
378
|
```ruby
|
|
313
379
|
# Audit configuration consistency across services
|
|
314
380
|
services = [DatabaseService, RedisService, S3Service, AuthService]
|
|
@@ -327,6 +393,7 @@ ClassMetrix.extract(:constants, :class_methods)
|
|
|
327
393
|
```
|
|
328
394
|
|
|
329
395
|
### Policy Classes Comparison
|
|
396
|
+
|
|
330
397
|
```ruby
|
|
331
398
|
# Compare authorization policies
|
|
332
399
|
policies = [UserPolicy, AdminPolicy, ModeratorPolicy]
|
|
@@ -341,6 +408,7 @@ ClassMetrix.extract(:constants)
|
|
|
341
408
|
```
|
|
342
409
|
|
|
343
410
|
### API Version Compatibility
|
|
411
|
+
|
|
344
412
|
```ruby
|
|
345
413
|
# Check API compatibility across versions
|
|
346
414
|
apis = [V1::UsersAPI, V2::UsersAPI, V3::UsersAPI]
|
|
@@ -363,7 +431,7 @@ ClassMetrix uses a modular component architecture for maximum flexibility:
|
|
|
363
431
|
```
|
|
364
432
|
MarkdownFormatter
|
|
365
433
|
├── HeaderComponent # Title, classes, extraction info
|
|
366
|
-
├── TableComponent # Table formatting and hash expansion
|
|
434
|
+
├── TableComponent # Table formatting and hash expansion
|
|
367
435
|
├── MissingBehaviorsComponent # Missing behavior analysis
|
|
368
436
|
└── FooterComponent # Footer with various styles
|
|
369
437
|
```
|
|
@@ -374,7 +442,7 @@ Each component is independently configurable and can be customized for specific
|
|
|
374
442
|
|
|
375
443
|
```bash
|
|
376
444
|
# Clone the repository
|
|
377
|
-
git clone https://github.com/
|
|
445
|
+
git clone https://github.com/patrick204nqh/class-metrix.git
|
|
378
446
|
cd class-metrix
|
|
379
447
|
|
|
380
448
|
# Install dependencies
|
|
@@ -390,7 +458,7 @@ ruby examples/advanced/hash_expansion.rb
|
|
|
390
458
|
|
|
391
459
|
## 📋 Requirements
|
|
392
460
|
|
|
393
|
-
- Ruby 2.7+
|
|
461
|
+
- Ruby 2.7+
|
|
394
462
|
- No runtime dependencies (pure Ruby implementation)
|
|
395
463
|
|
|
396
464
|
## 🤝 Contributing
|
|
@@ -407,11 +475,7 @@ This gem is available as open source under the terms of the [MIT License](LICENS
|
|
|
407
475
|
|
|
408
476
|
## 🔗 Links
|
|
409
477
|
|
|
410
|
-
- [Documentation](https://github.com/
|
|
478
|
+
- [Documentation](https://github.com/patrick204nqh/class-metrix/wiki)
|
|
411
479
|
- [Examples](examples/)
|
|
412
480
|
- [Build Guide](BUILD_GUIDE.md)
|
|
413
481
|
- [Changelog](CHANGELOG.md)
|
|
414
|
-
|
|
415
|
-
---
|
|
416
|
-
|
|
417
|
-
**Built with ❤️ for Ruby developers who love clean, maintainable code.**
|
data/Steepfile
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Steepfile for ClassMetrix gem
|
|
4
|
+
D = Steep::Diagnostic
|
|
5
|
+
|
|
6
|
+
target :lib do
|
|
7
|
+
signature "sig"
|
|
8
|
+
|
|
9
|
+
check "lib"
|
|
10
|
+
|
|
11
|
+
# Configure libraries
|
|
12
|
+
library "pathname"
|
|
13
|
+
library "csv"
|
|
14
|
+
library "json"
|
|
15
|
+
library "fileutils"
|
|
16
|
+
|
|
17
|
+
# Configure typing options
|
|
18
|
+
configure_code_diagnostics(D::Ruby.default)
|
|
19
|
+
|
|
20
|
+
# Disable some noisy diagnostics for better development experience
|
|
21
|
+
configure_code_diagnostics do |hash|
|
|
22
|
+
hash[D::Ruby::UnresolvedOverloading] = :information
|
|
23
|
+
hash[D::Ruby::FallbackAny] = :information
|
|
24
|
+
hash[D::Ruby::ImplicitBreakValueMismatch] = :hint
|
|
25
|
+
end
|
|
26
|
+
end
|