ruby-maat 1.2.0 → 1.3.4

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.
data/RUBY_MAAT.md DELETED
@@ -1,227 +0,0 @@
1
- # RUBY_MAAT.md
2
-
3
- This file provides guidance to Claude Code (claude.ai/code) when working with the Ruby Maat codebase.
4
-
5
- ## Project Overview
6
-
7
- Ruby Maat is a Ruby port of Code Maat, maintaining full backward compatibility while providing a modern Ruby implementation. It's designed as a drop-in replacement for the original Clojure version.
8
-
9
- ## Build and Development Commands
10
-
11
- ### Setting Up Development Environment
12
-
13
- ```bash
14
- # Install dependencies
15
- bundle install
16
-
17
- # Run tests
18
- bundle exec rspec
19
-
20
- # Run linting
21
- bundle exec rubocop
22
-
23
- # Auto-fix linting issues
24
- bundle exec rubocop -a
25
-
26
- # Run all checks
27
- bundle exec rake
28
- ```
29
-
30
- ### Building and Installing
31
-
32
- ```bash
33
- # Build gem
34
- bundle exec rake build
35
-
36
- # Install locally
37
- bundle exec rake install
38
-
39
- # Run the CLI locally
40
- bundle exec exe/ruby-maat --help
41
- ```
42
-
43
- ### Testing
44
-
45
- ```bash
46
- # Run all tests
47
- bundle exec rspec
48
-
49
- # Run specific test file
50
- bundle exec rspec spec/ruby_maat/analysis/authors_spec.rb
51
-
52
- # Run with coverage
53
- bundle exec rspec --format documentation
54
-
55
- # Test specific functionality
56
- bundle exec rspec --tag focus
57
- ```
58
-
59
- ## Architecture Overview
60
-
61
- ### Core Components
62
-
63
- 1. **Command Line Interface** (`lib/ruby_maat/cli.rb`)
64
- - Uses optparse for argument parsing
65
- - Maintains full backward compatibility with Code Maat CLI
66
- - Provides identical command-line arguments and behavior
67
-
68
- 2. **Application Core** (`lib/ruby_maat/app.rb`)
69
- - Main orchestration following same pipeline as original:
70
- - VCS Parsing → Data Grouping → Analysis → CSV Output
71
- - Registry pattern for analysis selection
72
- - Error handling and recovery
73
-
74
- 3. **Data Model**
75
- - `ChangeRecord` - Immutable value object for VCS changes
76
- - `Dataset` - Wrapper around Rover DataFrame for domain operations
77
- - Clean separation between data structures and business logic
78
-
79
- 4. **VCS Parsers** (`lib/ruby_maat/parsers/`)
80
- - Strategy pattern with base class and specific implementations
81
- - Identical input formats as original Code Maat
82
- - Error handling for malformed log files
83
-
84
- 5. **Analysis Modules** (`lib/ruby_maat/analysis/`)
85
- - Object-oriented design with base class and inheritance
86
- - Each analysis encapsulates domain logic
87
- - Rover DataFrame integration for statistical operations
88
-
89
- 6. **Data Processors** (`lib/ruby_maat/groupers/`)
90
- - Layer grouping for architectural boundaries
91
- - Temporal grouping for time-based analysis
92
- - Team mapping for organizational analysis
93
-
94
- ### Key Design Decisions
95
-
96
- **Rover DataFrame Integration:**
97
-
98
- - Replaces Incanter from original Clojure version
99
- - Provides statistical computing capabilities
100
- - Andrew Kane's excellent DataFrame library
101
-
102
- **Object-Oriented Architecture:**
103
-
104
- - Functional Clojure code translated to Ruby OOP
105
- - Strategy pattern for parsers and analyses
106
- - Immutable value objects where appropriate
107
-
108
- **Backward Compatibility:**
109
-
110
- - Identical CLI arguments and behavior
111
- - Same CSV output format
112
- - Compatible with existing scripts and workflows
113
-
114
- ### Analysis Modules
115
-
116
- All analyses inherit from `BaseAnalysis` and implement `analyze(dataset, options)`:
117
-
118
- **Core Analyses:**
119
-
120
- - `Authors` - Developer count and revision metrics per entity
121
- - `LogicalCoupling` - Entities that change together
122
- - `Entities` - Basic revision counts
123
- - `Summary` - High-level repository statistics
124
-
125
- **Code Quality Analyses:**
126
-
127
- - `Churn::*` - Various code churn metrics
128
- - `Effort::*` - Developer effort and ownership patterns
129
- - `CodeAge` - Time since last modification
130
- - `SumOfCoupling` - Aggregated coupling metrics
131
-
132
- **Social Analyses:**
133
-
134
- - `Communication` - Developer collaboration patterns
135
- - `CommitMessages` - Commit message word frequency
136
-
137
- ### Data Flow
138
-
139
- 1. **Parse** - VCS log files → Array of `ChangeRecord` objects
140
- 2. **Group** - Apply architectural/temporal/team grouping transformations
141
- 3. **Analyze** - Convert to `Dataset` and run analysis algorithms
142
- 4. **Output** - Format results as CSV using `CsvOutput`
143
-
144
- ### Ruby-Specific Patterns
145
-
146
- **Enumerable Usage:**
147
-
148
- - Heavy use of `map`, `filter`, `group_by`, `sort_by`
149
- - Functional programming style within OOP structure
150
-
151
- **Error Handling:**
152
-
153
- - Consistent error messages and recovery
154
- - Validation at boundaries (CLI, file parsing)
155
- - Meaningful error messages for users
156
-
157
- **Memory Efficiency:**
158
-
159
- - Streaming CSV output
160
- - Efficient data structures
161
- - Garbage collection friendly
162
-
163
- ## Testing Strategy
164
-
165
- **RSpec Structure:**
166
-
167
- - Unit tests for each class and module
168
- - Integration tests for end-to-end workflows
169
- - Test data using `ChangeRecord` factories
170
-
171
- **Key Test Areas:**
172
-
173
- - Parser accuracy for all VCS formats
174
- - Analysis algorithm correctness
175
- - CLI argument parsing and validation
176
- - Error handling and edge cases
177
-
178
- **Test Data:**
179
-
180
- - Small, focused datasets for unit tests
181
- - Real-world patterns for integration tests
182
- - Edge cases (empty files, malformed data, etc.)
183
-
184
- ## Development Guidelines
185
-
186
- **Code Style:**
187
-
188
- - Follow Ruby community conventions
189
- - Use RuboCop for consistency
190
- - Prefer explicit over implicit
191
- - Clear method and variable names
192
-
193
- **Performance:**
194
-
195
- - Profile with large datasets during development
196
- - Memory-conscious data structures
197
- - Efficient algorithms for coupling analysis
198
-
199
- **Compatibility:**
200
-
201
- - Maintain CLI compatibility religiously
202
- - Test against Code Maat output for regression
203
- - Document any behavioral differences
204
-
205
- ## Integration with Original Code Maat
206
-
207
- Ruby Maat is designed to be a seamless replacement:
208
-
209
- **Input Compatibility:**
210
-
211
- - Accepts identical VCS log file formats
212
- - Same command-line arguments and flags
213
- - Compatible option parsing and validation
214
-
215
- **Output Compatibility:**
216
-
217
- - Identical CSV column names and formats
218
- - Same sorting and filtering behavior
219
- - Matching precision for numerical results
220
-
221
- **Feature Parity:**
222
-
223
- - All 23 analysis types implemented
224
- - Same grouping and mapping capabilities
225
- - Identical error messages where possible
226
-
227
- This makes Ruby Maat suitable for existing Code Maat workflows, scripts, and integrations without modification.