class-metrix 1.0.0 → 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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.vscode/README.md +103 -47
  3. data/.vscode/extensions.json +10 -7
  4. data/.vscode/keybindings.json +26 -0
  5. data/.vscode/rbs.code-snippets +61 -0
  6. data/.vscode/settings.json +25 -1
  7. data/.vscode/tasks.json +141 -0
  8. data/CHANGELOG.md +2 -0
  9. data/README.md +46 -16
  10. data/Steepfile +26 -0
  11. data/docs/CHANGELOG_EVOLUTION_EXAMPLE.md +95 -0
  12. data/lib/class_metrix/extractor.rb +1 -1
  13. data/lib/class_metrix/extractors/constants_extractor.rb +1 -1
  14. data/lib/class_metrix/extractors/methods_extractor.rb +1 -1
  15. data/lib/class_metrix/extractors/multi_type_extractor.rb +2 -2
  16. data/lib/class_metrix/formatters/base/base_formatter.rb +3 -3
  17. data/lib/class_metrix/formatters/components/footer_component.rb +3 -3
  18. data/lib/class_metrix/formatters/components/generic_header_component.rb +2 -2
  19. data/lib/class_metrix/formatters/components/header_component.rb +4 -4
  20. data/lib/class_metrix/formatters/components/missing_behaviors_component.rb +7 -7
  21. data/lib/class_metrix/formatters/components/table_component/row_processor.rb +8 -5
  22. data/lib/class_metrix/formatters/components/table_component/table_data_extractor.rb +4 -1
  23. data/lib/class_metrix/formatters/components/table_component/table_renderer.rb +2 -2
  24. data/lib/class_metrix/formatters/components/table_component.rb +5 -4
  25. data/lib/class_metrix/formatters/csv_formatter.rb +3 -3
  26. data/lib/class_metrix/formatters/markdown_formatter.rb +3 -4
  27. data/lib/class_metrix/formatters/shared/markdown_table_builder.rb +2 -2
  28. data/lib/class_metrix/formatters/shared/table_builder.rb +8 -6
  29. data/lib/class_metrix/version.rb +1 -1
  30. data/sig/class_metrix.rbs +8 -0
  31. data/sig/extractor.rbs +54 -0
  32. data/sig/extractors.rbs +84 -0
  33. data/sig/formatters_base.rbs +59 -0
  34. data/sig/formatters_components.rbs +133 -0
  35. data/sig/formatters_main.rbs +20 -0
  36. data/sig/formatters_shared.rbs +102 -0
  37. data/sig/manifest.yaml +32 -0
  38. data/sig/utils.rbs +57 -0
  39. data/sig/value_processor.rbs +11 -0
  40. data/sig/version.rbs +4 -0
  41. metadata +44 -2
  42. data/sig/class/metrix.rbs +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 440b6eacf85b731cd683533be57ab3b2c17b25605ce70ed650bed43539f34531
4
- data.tar.gz: 728575b7ddac28f55d5d192f3e1004858f19820453a9e6c3d00002df50855c92
3
+ metadata.gz: 9b893eab40ee30c91bfb72059fcaffc282efca2088e4e150d2cf89c7fb0ff835
4
+ data.tar.gz: 553832b76ef1c44f6ace2cb7b37808dc2e18ef3c2f16882cc2aa951d1d9b82b3
5
5
  SHA512:
6
- metadata.gz: 868af534a658dc3a083315ee1660f4ba8754919474ac3d6c5c2458f2a5af8df763bfa292d6d1c426a0df20b4ef3419cd7cc031397bd14ed3a563f0dee07b605c
7
- data.tar.gz: 9bcfe4160f94b93abf072e1888c92222a790387f16e16d376ef93be48c28d4ac7ee1edd931c6b9e70236c64e3bec17d0610c2561db14ab80e60d4f0ed1a6af41
6
+ metadata.gz: 98297596048b427aa614a18ab3bb01cde37382b95df9b10dd2d9e2856db0afccdc420245e6b5f84ac676fa35bd7b6b68e8d945bf58f987526c39fde840d05a8f
7
+ data.tar.gz: dc3729ab21692725a5660b781c51c81282640640a3fae6d11328fb0485f30f4af4e30e71c74e987a3ad5709726878fb04713e349098bd4df0538468416b0099f
data/.vscode/README.md CHANGED
@@ -1,72 +1,128 @@
1
- # VS Code Works### Ruby Support
1
+ # VS Code Configuration for ClassMetrix
2
2
 
3
- - **Ruby LSP** (`shopify.ruby-lsp`) - Primary Ruby language server with Rubocop formatting
4
- - **Solargraph** (`castwide.solargraph`) - Alternative Ruby IntelliSense
3
+ ## 🎯 Overview
5
4
 
6
- ### Markdown Support
5
+ This directory contains comprehensive VS Code configuration for the ClassMetrix Ruby gem development with full RBS (Ruby Signature) and Steep type checking integration.
7
6
 
8
- - **Prettier** (`esbenp.prettier-vscode`) - Primary Markdown formatter
9
- - **Markdown All in One** (`yzhang.markdown-all-in-one`) - Comprehensive Markdown support
10
- - **markdownlint** (`davidanson.vscode-markdownlint`) - Markdown lintingnfiguration
7
+ ## 📦 Extensions
11
8
 
12
- This folder contains VS Code workspace configuration files that help maintain consistent development environment across team members.
9
+ ### Required Extensions
13
10
 
14
- ## Files Overview
11
+ - **Ruby LSP** (`shopify.ruby-lsp`) - Primary Ruby language support
12
+ - **RBS Syntax** (`soutaro.rbs-syntax`) - RBS file syntax highlighting
13
+ - **Steep VS Code** (`soutaro.steep-vscode`) - Type checking integration
14
+ - **RBS Snippets** (`mateuszdrewniak.rbs-snippets`) - Code snippets for RBS
15
15
 
16
- - **settings.json**: Workspace-specific settings for Ruby and Markdown formatting
17
- - **extensions.json**: Recommended extensions for this project
18
- - **tasks.json**: Predefined tasks for common operations (Rubocop, RSpec)
19
- - **launch.json**: Debug configurations for Ruby files and tests
16
+ ### Optional Extensions
20
17
 
21
- ## Required Extensions
18
+ - **Ruby Debugger** (`koichisasada.vscode-rdbg`) - Debugging support
19
+ - **GitLens** (`eamodio.gitlens`) - Enhanced Git integration
20
+ - **Markdown All in One** (`yzhang.markdown-all-in-one`) - Documentation support
22
21
 
23
- To get the best development experience, install these recommended extensions:
22
+ ## ⚙️ Settings Configuration
24
23
 
25
- ### Ruby Support
24
+ ### Ruby Language Support
26
25
 
27
- - **Ruby LSP** (`shopify.ruby-lsp`) - Primary Ruby language server
28
- - **Solargraph** (`castwide.solargraph`) - Alternative Ruby IntelliSense
26
+ - **Format on Save**: Enabled with RuboCop
27
+ - **Ruby LSP**: Full feature set enabled
28
+ - **Semantic Highlighting**: Enabled for both Ruby and RBS files
29
29
 
30
- ### Markdown Support
30
+ ### RBS Type Checking
31
31
 
32
- - **Markdown All in One** (`yzhang.markdown-all-in-one`) - Comprehensive Markdown support
33
- - **markdownlint** (`davidanson.vscode-markdownlint`) - Markdown linting
32
+ - **Steep Integration**: Real-time type checking
33
+ - **Diagnostics**: Enabled for immediate feedback
34
+ - **File Associations**: `.rbs` files properly recognized
34
35
 
35
- ### General
36
+ ### Code Quality
36
37
 
37
- - **EditorConfig** (`editorconfig.editorconfig`) - Consistent coding styles
38
- - **GitLens** (`eamodio.gitlens`) - Enhanced Git capabilities
38
+ - **RuboCop**: Integrated for code formatting and linting
39
+ - **Auto-fix on Save**: Automatic code corrections
39
40
 
40
- ## Auto-formatting
41
+ ## 🛠️ Available Tasks
41
42
 
42
- The configuration enables automatic formatting on save for:
43
+ ### Ruby Development Tasks
43
44
 
44
- - **Ruby files**: Using Rubocop via Ruby LSP (Shopify.ruby-lsp)
45
- - **Markdown files**: Using Prettier formatter
46
- - **Format on type**: Enabled for Ruby files for real-time formatting
45
+ - **`Ctrl+Shift+P` "Tasks: Run Task"**
47
46
 
48
- ## Available Tasks
47
+ | Task | Description | Shortcut |
48
+ | --------------------------- | --------------------------- | ---------------------- |
49
+ | `Rubocop: Check` | Lint all Ruby files | - |
50
+ | `Rubocop: Fix` | Auto-fix all RuboCop issues | `Ctrl+Shift+R, Ctrl+R` |
51
+ | `Rubocop: Fix Current File` | Fix current file only | - |
52
+ | `RSpec: Run All Tests` | Run entire test suite | - |
53
+ | `RSpec: Run Current File` | Run tests for current file | - |
49
54
 
50
- Access via `Ctrl+Shift+P` → "Tasks: Run Task":
55
+ ### Type Checking Tasks
51
56
 
52
- - **Rubocop: Check** - Run Rubocop linting
53
- - **Rubocop: Fix** - Auto-fix Rubocop violations
54
- - **Rubocop: Fix Current File** - Fix violations in current file only
55
- - **RSpec: Run All Tests** - Run complete test suite
56
- - **RSpec: Run Current File** - Run tests for current file
57
- - **Bundle Install** - Install/update gems
57
+ | Task | Description | Shortcut |
58
+ | -------------------------- | --------------------------- | ---------------------- |
59
+ | `RBS: Validate` | Validate RBS syntax | `Ctrl+Shift+R, Ctrl+V` |
60
+ | `RBS: Generate Prototypes` | Generate RBS from Ruby code | - |
61
+ | `Steep: Type Check` | Run type checking | `Ctrl+Shift+R, Ctrl+S` |
62
+ | `Steep: Watch Mode` | Continuous type checking | `Ctrl+Shift+R, Ctrl+W` |
58
63
 
59
- ## Debug Configurations
64
+ ### Build Tasks
60
65
 
61
- Available debug configurations:
66
+ | Task | Description |
67
+ | ---------------- | ------------------------ |
68
+ | `Bundle Install` | Install gem dependencies |
62
69
 
63
- - **Ruby: Run Current File** - Debug the currently open Ruby file
64
- - **RSpec: Debug Current File** - Debug tests in current file
65
- - **RSpec: Debug All Tests** - Debug entire test suite
70
+ ## ⌨️ Keyboard Shortcuts
66
71
 
67
- ## Setup Instructions
72
+ ### Custom Shortcuts
68
73
 
69
- 1. Open this project in VS Code
70
- 2. Install recommended extensions (VS Code will prompt you)
71
- 3. Run "Bundle Install" task to ensure gems are installed
72
- 4. Start coding! Auto-formatting will work on save
74
+ - **`Ctrl+Shift+R, Ctrl+V`**: RBS Validate
75
+ - **`Ctrl+Shift+R, Ctrl+S`**: Steep Type Check
76
+ - **`Ctrl+Shift+R, Ctrl+W`**: Steep Watch Mode
77
+ - **`Ctrl+Shift+R, Ctrl+R`**: RuboCop Fix
78
+
79
+ ### Usage Pattern
80
+
81
+ 1. Press `Ctrl+Shift+R` to enter "Ruby mode"
82
+ 2. Press the second key for the specific action
83
+
84
+ ## 📝 Code Snippets
85
+
86
+ ### RBS Snippets
87
+
88
+ - **`rbsclass`**: Complete RBS class template
89
+ - **`rbsmodule`**: RBS module template
90
+ - **`rbsmethod`**: Method signature
91
+ - **`rbsattr_reader`**: Attribute reader
92
+ - **`rbsattr_writer`**: Attribute writer
93
+ - **`rbsattr_accessor`**: Attribute accessor
94
+
95
+ ### Usage
96
+
97
+ 1. Type snippet prefix in `.rbs` file
98
+ 2. Press `Tab` to expand
99
+ 3. Use `Tab` to navigate through placeholders
100
+
101
+ ## 🚀 Getting Started
102
+
103
+ ### 1. Install Extensions
104
+
105
+ VS Code will prompt to install recommended extensions when you open the workspace.
106
+
107
+ ### 2. Verify Setup
108
+
109
+ 1. Open any `.rb` file - should have Ruby LSP support
110
+ 2. Open any `.rbs` file - should have syntax highlighting
111
+ 3. Run `Ctrl+Shift+R, Ctrl+S` - should type check without errors
112
+
113
+ ### 3. Start Development
114
+
115
+ 1. Use `Ctrl+Shift+R, Ctrl+W` to start watch mode
116
+ 2. Edit Ruby files - see real-time type checking
117
+ 3. Use code snippets for rapid RBS development
118
+
119
+ ## 📊 Current Status
120
+
121
+ ✅ **Type Safety**: 100% (0 Steep errors)
122
+ ✅ **RBS Coverage**: Complete for all extractors
123
+ ✅ **VS Code Integration**: Fully configured
124
+ ✅ **Development Workflow**: Optimized
125
+
126
+ ---
127
+
128
+ This VS Code setup provides a complete Ruby development environment with modern type checking capabilities.
@@ -1,10 +1,15 @@
1
- { "recommendations": [
1
+ {
2
+ "recommendations": [
2
3
  // Ruby language support
3
4
  "shopify.ruby-lsp",
4
- "castwide.solargraph",
5
5
 
6
- // Alternative Ruby support (choose one of the above)
7
- // "rebornix.ruby",
6
+ // RBS and Steep support (type checking)
7
+ "soutaro.rbs-syntax",
8
+ "soutaro.steep-vscode",
9
+ "mateuszdrewniak.rbs-snippets",
10
+
11
+ // Debugging support
12
+ "koichisasada.vscode-rdbg",
8
13
 
9
14
  // Markdown support
10
15
  "esbenp.prettier-vscode",
@@ -21,8 +26,6 @@
21
26
 
22
27
  // Additional helpful extensions
23
28
  "ms-vscode.test-adapter-converter",
24
- "hbenl.vscode-test-explorer",
25
- "formulahendry.auto-rename-tag",
26
- "bradlc.vscode-tailwindcss"
29
+ "hbenl.vscode-test-explorer"
27
30
  ]
28
31
  }
@@ -0,0 +1,26 @@
1
+ [
2
+ {
3
+ "key": "ctrl+shift+r ctrl+v",
4
+ "command": "workbench.action.tasks.runTask",
5
+ "args": "RBS: Validate",
6
+ "when": "editorTextFocus"
7
+ },
8
+ {
9
+ "key": "ctrl+shift+r ctrl+s",
10
+ "command": "workbench.action.tasks.runTask",
11
+ "args": "Steep: Type Check",
12
+ "when": "editorTextFocus"
13
+ },
14
+ {
15
+ "key": "ctrl+shift+r ctrl+w",
16
+ "command": "workbench.action.tasks.runTask",
17
+ "args": "Steep: Watch Mode",
18
+ "when": "editorTextFocus"
19
+ },
20
+ {
21
+ "key": "ctrl+shift+r ctrl+r",
22
+ "command": "workbench.action.tasks.runTask",
23
+ "args": "Rubocop: Fix",
24
+ "when": "editorTextFocus"
25
+ }
26
+ ]
@@ -0,0 +1,61 @@
1
+ {
2
+ "RBS Class Definition": {
3
+ "prefix": "rbsclass",
4
+ "body": [
5
+ "class ${1:ClassName}",
6
+ " ${2:# Instance variables}",
7
+ " ${3:@var}: ${4:Type}",
8
+ "",
9
+ " ${5:# Methods}",
10
+ " def initialize: (${6:params}) -> void",
11
+ " def ${7:method_name}: (${8:params}) -> ${9:ReturnType}",
12
+ "",
13
+ " private",
14
+ "",
15
+ " def ${10:private_method}: () -> ${11:ReturnType}",
16
+ "end"
17
+ ],
18
+ "description": "RBS class definition template"
19
+ },
20
+ "RBS Module Definition": {
21
+ "prefix": "rbsmodule",
22
+ "body": [
23
+ "module ${1:ModuleName}",
24
+ " ${2:# Module methods}",
25
+ " def self.${3:method_name}: (${4:params}) -> ${5:ReturnType}",
26
+ "",
27
+ " ${6:# Instance methods}",
28
+ " def ${7:method_name}: (${8:params}) -> ${9:ReturnType}",
29
+ "end"
30
+ ],
31
+ "description": "RBS module definition template"
32
+ },
33
+ "RBS Method Definition": {
34
+ "prefix": "rbsmethod",
35
+ "body": [
36
+ "def ${1:method_name}: (${2:params}) -> ${3:ReturnType}"
37
+ ],
38
+ "description": "RBS method definition"
39
+ },
40
+ "RBS Attribute Reader": {
41
+ "prefix": "rbsattr_reader",
42
+ "body": [
43
+ "attr_reader ${1:attribute}: ${2:Type}"
44
+ ],
45
+ "description": "RBS attribute reader"
46
+ },
47
+ "RBS Attribute Writer": {
48
+ "prefix": "rbsattr_writer",
49
+ "body": [
50
+ "attr_writer ${1:attribute}: ${2:Type}"
51
+ ],
52
+ "description": "RBS attribute writer"
53
+ },
54
+ "RBS Attribute Accessor": {
55
+ "prefix": "rbsattr_accessor",
56
+ "body": [
57
+ "attr_accessor ${1:attribute}: ${2:Type}"
58
+ ],
59
+ "description": "RBS attribute accessor"
60
+ }
61
+ }
@@ -39,13 +39,24 @@
39
39
  "other": "off"
40
40
  }
41
41
  },
42
+ "[rbs]": {
43
+ "editor.defaultFormatter": "soutaro.rbs-syntax",
44
+ "editor.formatOnSave": true,
45
+ "editor.tabSize": 2,
46
+ "editor.insertSpaces": true,
47
+ "editor.semanticHighlighting.enabled": true,
48
+ "editor.rulers": [120],
49
+ "editor.trimAutoWhitespace": true
50
+ },
42
51
 
43
52
  // File associations
44
53
  "files.associations": {
45
54
  "*.gemspec": "ruby",
46
55
  "Gemfile": "ruby",
47
56
  "Rakefile": "ruby",
48
- ".rubocop.yml": "yaml"
57
+ ".rubocop.yml": "yaml",
58
+ "*.rbs": "rbs",
59
+ "Steepfile": "ruby"
49
60
  },
50
61
 
51
62
  // Auto-save settings
@@ -81,6 +92,19 @@
81
92
  "ruby.rubocop.configFilePath": ".rubocop.yml",
82
93
  "ruby.rubocop.suppressRubocopWarnings": false,
83
94
 
95
+ // Steep type checker settings
96
+ "steep.enabled": true,
97
+ "steep.checkOnSave": true,
98
+ "steep.diagnosticsEnabled": true,
99
+ "steep.signatureHelp": true,
100
+ "steep.hover": true,
101
+
102
+ // RBS validation settings
103
+ "ruby.rbs": {
104
+ "enabled": true,
105
+ "diagnostics": true
106
+ },
107
+
84
108
  // Additional helpful settings
85
109
  "breadcrumbs.enabled": true,
86
110
  "editor.minimap.enabled": true,
data/.vscode/tasks.json CHANGED
@@ -94,6 +94,147 @@
94
94
  "focus": false,
95
95
  "panel": "shared"
96
96
  }
97
+ },
98
+ {
99
+ "label": "RBS: Validate",
100
+ "type": "shell",
101
+ "command": "bundle",
102
+ "args": ["exec", "rbs", "validate"],
103
+ "group": "test",
104
+ "presentation": {
105
+ "echo": true,
106
+ "reveal": "always",
107
+ "focus": false,
108
+ "panel": "shared"
109
+ },
110
+ "problemMatcher": [
111
+ {
112
+ "owner": "rbs",
113
+ "fileLocation": "absolute",
114
+ "pattern": [
115
+ {
116
+ "regexp": "^([^:]+):(\\d+):(\\d+): (.*)$",
117
+ "file": 1,
118
+ "line": 2,
119
+ "column": 3,
120
+ "message": 4
121
+ }
122
+ ]
123
+ }
124
+ ]
125
+ },
126
+ {
127
+ "label": "Steep: Type Check",
128
+ "type": "shell",
129
+ "command": "bundle",
130
+ "args": ["exec", "steep", "check"],
131
+ "group": "test",
132
+ "presentation": {
133
+ "echo": true,
134
+ "reveal": "always",
135
+ "focus": false,
136
+ "panel": "shared"
137
+ },
138
+ "problemMatcher": [
139
+ {
140
+ "owner": "steep",
141
+ "fileLocation": "absolute",
142
+ "pattern": [
143
+ {
144
+ "regexp": "^([^:]+):(\\d+):(\\d+): \\[([^\\]]+)\\] (.*)$",
145
+ "file": 1,
146
+ "line": 2,
147
+ "column": 3,
148
+ "severity": 4,
149
+ "message": 5
150
+ }
151
+ ]
152
+ }
153
+ ]
154
+ },
155
+ {
156
+ "label": "Steep: Watch Mode",
157
+ "type": "shell",
158
+ "command": "bundle",
159
+ "args": ["exec", "steep", "watch", "lib"],
160
+ "group": "build",
161
+ "isBackground": true,
162
+ "presentation": {
163
+ "echo": true,
164
+ "reveal": "always",
165
+ "focus": false,
166
+ "panel": "shared"
167
+ },
168
+ "problemMatcher": [
169
+ {
170
+ "owner": "steep",
171
+ "fileLocation": "absolute",
172
+ "pattern": [
173
+ {
174
+ "regexp": "^([^:]+):(\\d+):(\\d+): \\[([^\\]]+)\\] (.*)$",
175
+ "file": 1,
176
+ "line": 2,
177
+ "column": 3,
178
+ "severity": 4,
179
+ "message": 5
180
+ }
181
+ ],
182
+ "background": {
183
+ "activeOnStart": true,
184
+ "beginsPattern": "^# Type checking files:",
185
+ "endsPattern": "^(No type error detected|Detected \\d+ problems)"
186
+ }
187
+ }
188
+ ]
189
+ },
190
+ {
191
+ "label": "Steep: Watch All Targets",
192
+ "type": "shell",
193
+ "command": "bundle",
194
+ "args": ["exec", "steep", "watch", "--target", "lib"],
195
+ "group": "build",
196
+ "isBackground": true,
197
+ "presentation": {
198
+ "echo": true,
199
+ "reveal": "always",
200
+ "focus": false,
201
+ "panel": "shared"
202
+ },
203
+ "problemMatcher": [
204
+ {
205
+ "owner": "steep",
206
+ "fileLocation": "absolute",
207
+ "pattern": [
208
+ {
209
+ "regexp": "^([^:]+):(\\d+):(\\d+): \\[([^\\]]+)\\] (.*)$",
210
+ "file": 1,
211
+ "line": 2,
212
+ "column": 3,
213
+ "severity": 4,
214
+ "message": 5
215
+ }
216
+ ],
217
+ "background": {
218
+ "activeOnStart": true,
219
+ "beginsPattern": "^# Type checking files:",
220
+ "endsPattern": "^(No type error detected|Detected \\d+ problems)"
221
+ }
222
+ }
223
+ ]
224
+ },
225
+ {
226
+ "label": "RBS: Generate Prototypes",
227
+ "type": "shell",
228
+ "command": "bundle",
229
+ "args": ["exec", "rbs", "prototype", "rb", "lib"],
230
+ "group": "build",
231
+ "presentation": {
232
+ "echo": true,
233
+ "reveal": "always",
234
+ "focus": false,
235
+ "panel": "shared"
236
+ },
237
+ "problemMatcher": []
97
238
  }
98
239
  ]
99
240
  }
data/CHANGELOG.md CHANGED
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.0.1] - 2025-06-08
11
+
10
12
  ## [1.0.0] - 2025-06-07
11
13
 
12
14
  ### 🎉 Major Release - Production Ready