pretty-git 0.1.2 → 0.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -1
- data/README.md +144 -39
- data/README.ru.md +144 -39
- data/lib/pretty_git/analytics/churn.rb +75 -0
- data/lib/pretty_git/analytics/hotspots.rb +78 -0
- data/lib/pretty_git/analytics/ownership.rb +90 -0
- data/lib/pretty_git/app.rb +18 -16
- data/lib/pretty_git/cli.rb +7 -4
- data/lib/pretty_git/cli_helpers.rb +16 -3
- data/lib/pretty_git/filters.rb +11 -2
- data/lib/pretty_git/git/provider.rb +35 -3
- data/lib/pretty_git/render/console_renderer.rb +53 -16
- data/lib/pretty_git/render/csv_renderer.rb +20 -17
- data/lib/pretty_git/render/markdown_renderer.rb +85 -21
- data/lib/pretty_git/render/xml_renderer.rb +71 -3
- data/lib/pretty_git/render/yaml_renderer.rb +58 -2
- data/lib/pretty_git/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e190585a91de27221e54bc2cbc58b5f6d26a1428c2e5cd5189ff0c18d362e6c
|
4
|
+
data.tar.gz: f8d2bc8f5d6c6a4887a745abd611a038166bcb54e95267a15d4868ee9d530003
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e11fd51d24ed1e63fd5c773f76a46510bbcedad23c02ace63b25d7d80c366479fd02fe2bfabaa58693389c222bafe4fd9e6fc0b157b7d598e96294a3f888fbef
|
7
|
+
data.tar.gz: 38fc87c6467d72ae6a1cb63a13b06c417e81f714d5b074feae961f121e061cea0733494020e0b8f562f36ea00b2d537a0d6fd5ac36eea942465680376f8eb71e
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,39 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
9
|
|
10
|
+
## [0.1.4] - 2025-08-17
|
11
|
+
### Added
|
12
|
+
- Integration tests for new reports exports: CSV/Markdown/YAML/XML for `hotspots`, `churn`, `ownership`.
|
13
|
+
- Schema validations: `rake validate:json`, `rake validate:xml` to ensure format compatibility.
|
14
|
+
- CI: expanded matrix to include macOS; smoke test for installed binary (`--help`, `--version`).
|
15
|
+
|
16
|
+
### Changed
|
17
|
+
- Renderers (`MarkdownRenderer`, `YamlRenderer`, `XmlRenderer`): deterministic sorting for all new reports according to `docs/determinism.md`.
|
18
|
+
- XML: per-report root elements in XML exports to match XSDs (`hotspotsReport`, `churnReport`, `ownershipReport`, `languagesReport`, etc.).
|
19
|
+
- Documentation: `README.md` and `README.ru.md` updated with sections and examples for new reports and all export formats.
|
20
|
+
- CLI: keep `--time-bucket` permissive; default `time_bucket=nil`.
|
21
|
+
|
22
|
+
### Fixed
|
23
|
+
- Time parsing: interpret date-only inputs (`YYYY-MM-DD`) as UTC midnight and normalize to UTC ISO8601.
|
24
|
+
- CLI UX: error when `--metric` is used outside `languages` report.
|
25
|
+
- Tests/specs: updated XML specs to per-report roots; added timezone edge cases; fixed Open3 `popen3` stubs (`chdir:`) and integration requires.
|
26
|
+
|
27
|
+
|
28
|
+
## [0.1.3] - 2025-08-14
|
29
|
+
### Added
|
30
|
+
- New analytics reports: `hotspots`, `churn`, `ownership` with sorting, scoring, and limits.
|
31
|
+
- Exporters: CSV and Markdown support for new reports with dynamic headers via mapping constants.
|
32
|
+
- Docs: Detailed sections for new reports in `README.md` and `README.ru.md` with usage and examples (CSV/JSON/YAML/XML).
|
33
|
+
|
34
|
+
### Changed
|
35
|
+
- Console: dispatching and rendering wired for new reports; consistent theming and width handling.
|
36
|
+
- CLI/App: unified analytics dispatch for all reports.
|
37
|
+
- Docs: public READMEs cleaned up from internal DR-* mentions; anchors and headings aligned (CSV).
|
38
|
+
|
39
|
+
### Fixed
|
40
|
+
- Minor documentation inaccuracies and anchor mismatches.
|
41
|
+
|
42
|
+
|
10
43
|
## [0.1.2] - 2025-08-13
|
11
44
|
### Added
|
12
45
|
- Languages report: support multiple metrics — `bytes`, `files`, `loc`; dynamic columns in Console/CSV/Markdown; color and percent fields in output.
|
@@ -15,7 +48,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve
|
|
15
48
|
### Changed
|
16
49
|
- Languages: JSON language reinstated in the mapping and color scheme; sorting and percent calculations are based on the selected metric; percentages rounded to two decimals.
|
17
50
|
- Renderers: updated `csv`, `markdown`, and console renderers to work with dynamic metrics.
|
18
|
-
- Internal specs updated: `
|
51
|
+
- Internal specs updated: `docs/output_formats.md`, `docs/cli_spec.md`, `docs/languages_map.md`.
|
19
52
|
|
20
53
|
### Fixed
|
21
54
|
- Git provider: correct commit counting — emit a new commit when a header is read and remove the record separator from the subject (`lib/pretty_git/git/provider.rb`).
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
<br>
|
15
15
|
</p>
|
16
16
|
|
17
|
-
Generator of rich reports for a local Git repository: summary, activity, authors, files, heatmap, languages. Output to Console and formats: JSON, CSV, Markdown, YAML, XML.
|
17
|
+
Generator of rich reports for a local Git repository: summary, activity, authors, files, heatmap, languages, hotspots, churn, ownership. Output to Console and formats: JSON, CSV, Markdown, YAML, XML.
|
18
18
|
|
19
19
|
— License: MIT.
|
20
20
|
|
@@ -35,10 +35,13 @@ Generator of rich reports for a local Git repository: summary, activity, authors
|
|
35
35
|
- [files — by files](#files--by-files)
|
36
36
|
- [heatmap — commit heatmap](#heatmap--commit-heatmap)
|
37
37
|
- [languages — languages](#languages--languages)
|
38
|
+
- [hotspots — hotspots (risky files)](#hotspots--hotspots-risky-files)
|
39
|
+
- [churn — code churn by file](#churn--code-churn-by-file)
|
40
|
+
- [ownership — code ownership](#ownership--code-ownership)
|
38
41
|
- [Exports](#exports)
|
39
42
|
- [Console](#console)
|
40
43
|
- [JSON](#json)
|
41
|
-
- [CSV
|
44
|
+
- [CSV](#csv)
|
42
45
|
- [Markdown](#markdown)
|
43
46
|
- [YAML](#yaml)
|
44
47
|
- [XML](#xml)
|
@@ -49,17 +52,17 @@ Generator of rich reports for a local Git repository: summary, activity, authors
|
|
49
52
|
- [Development](#development)
|
50
53
|
- [License](#license)
|
51
54
|
|
52
|
-
## Features
|
53
|
-
* **Reports**: `summary`, `activity`, `authors`, `files`, `heatmap`, `languages`.
|
55
|
+
## ✨ Features
|
56
|
+
* **Reports**: `summary`, `activity`, `authors`, `files`, `heatmap`, `languages`, `hotspots`, `churn`, `ownership`.
|
54
57
|
* **Filters**: branches, authors, paths, time period.
|
55
58
|
* **Exports**: `console`, `json`, `csv`, `md`, `yaml`, `xml`.
|
56
59
|
* **Output**: to stdout or file via `--out`.
|
57
60
|
|
58
|
-
## Requirements
|
61
|
+
## ⚙️ Requirements
|
59
62
|
* **Ruby**: >= 3.4 (recommended 3.4.x)
|
60
63
|
* **Git**: installed and available in `PATH`
|
61
64
|
|
62
|
-
## Installation
|
65
|
+
## 📦 Installation
|
63
66
|
|
64
67
|
### 🍺 Homebrew (recommended)
|
65
68
|
```bash
|
@@ -101,7 +104,7 @@ bundle install
|
|
101
104
|
bundle exec pretty-git --help
|
102
105
|
```
|
103
106
|
|
104
|
-
## Quick Start
|
107
|
+
## 🚀 Quick Start
|
105
108
|
```bash
|
106
109
|
# Repository summary to console
|
107
110
|
bundle exec bin/pretty-git summary .
|
@@ -114,21 +117,25 @@ bundle exec bin/pretty-git activity . --time-bucket week --since 2025-01-01 \
|
|
114
117
|
--paths app,lib --format csv --out activity.csv
|
115
118
|
```
|
116
119
|
|
117
|
-
## CLI and Options
|
120
|
+
## 🧰 CLI and Options
|
118
121
|
General form:
|
119
122
|
|
120
123
|
```bash
|
121
124
|
pretty-git <report> <repo_path> [options]
|
122
125
|
```
|
123
126
|
|
124
|
-
|
127
|
+
Notes:
|
128
|
+
* `<repo_path>` defaults to `.` if omitted.
|
129
|
+
* You can also pass the repository via `--repo PATH` as an alternative to the positional argument.
|
130
|
+
|
131
|
+
Available reports: `summary`, `activity`, `authors`, `files`, `heatmap`, `languages`, `hotspots`, `churn`, `ownership`.
|
125
132
|
|
126
133
|
Key options:
|
127
134
|
* **--format, -f** `console|json|csv|md|yaml|xml` (default `console`)
|
128
135
|
* **--out, -o** Path to write output file
|
129
136
|
* **--limit, -l** Number of items shown; `all` or `0` — no limit
|
130
137
|
* **--time-bucket** `day|week|month` (for `activity`)
|
131
|
-
* **--since/--until** Date/time in ISO8601 or `YYYY-MM-DD`
|
138
|
+
* **--since/--until** Date/time in ISO8601 or `YYYY-MM-DD`
|
132
139
|
* **--branch** Multi-option, can be specified multiple times
|
133
140
|
* **--author/--exclude-author** Filter by authors
|
134
141
|
* **--path/--exclude-path** Filter by paths (comma-separated or repeated option)
|
@@ -165,15 +172,15 @@ pretty-git authors . --format csv --out authors.csv
|
|
165
172
|
* `1` — user error (unknown report/format, bad arguments)
|
166
173
|
* `2` — system error (git error etc.)
|
167
174
|
|
168
|
-
## Reports and Examples
|
175
|
+
## 📊 Reports and Examples
|
169
176
|
|
170
|
-
### summary — repository summary
|
177
|
+
### 🧭 summary — repository summary
|
171
178
|
```bash
|
172
179
|
pretty-git summary . --format json
|
173
180
|
```
|
174
181
|
Contains totals (commits, authors, additions, deletions) and top authors/files.
|
175
182
|
|
176
|
-
### activity — activity (day/week/month)
|
183
|
+
### 📆 activity — activity (day/week/month)
|
177
184
|
```bash
|
178
185
|
pretty-git activity . --time-bucket week --format csv
|
179
186
|
```
|
@@ -186,7 +193,7 @@ JSON example:
|
|
186
193
|
]
|
187
194
|
```
|
188
195
|
|
189
|
-
### authors — by authors
|
196
|
+
### 👤 authors — by authors
|
190
197
|
```bash
|
191
198
|
pretty-git authors . --format md --limit 10
|
192
199
|
```
|
@@ -199,27 +206,39 @@ Markdown example:
|
|
199
206
|
| Bob | b@example.com | 1 | 2 | 0 | 2.0 |
|
200
207
|
```
|
201
208
|
|
202
|
-
### files — by files
|
209
|
+
### 📁 files — by files
|
203
210
|
```bash
|
204
211
|
pretty-git files . --paths app,lib --format csv
|
205
212
|
```
|
206
213
|
CSV columns: `path,commits,additions,deletions,changes`.
|
214
|
+
|
207
215
|
XML example:
|
208
216
|
```xml
|
209
|
-
|
210
|
-
|
211
|
-
<
|
217
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
218
|
+
<report>
|
219
|
+
<report>files</report>
|
212
220
|
<generated_at>2025-01-31T00:00:00Z</generated_at>
|
213
221
|
<repo_path>/abs/path/to/repo</repo_path>
|
214
|
-
<
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
</
|
222
|
+
<items>
|
223
|
+
<item>
|
224
|
+
<path>app/models/user.rb</path>
|
225
|
+
<commits>42</commits>
|
226
|
+
<additions>2100</additions>
|
227
|
+
<deletions>1400</deletions>
|
228
|
+
<changes>3500</changes>
|
229
|
+
</item>
|
230
|
+
<item>
|
231
|
+
<path>app/services/auth.rb</path>
|
232
|
+
<commits>35</commits>
|
233
|
+
<additions>1500</additions>
|
234
|
+
<deletions>900</deletions>
|
235
|
+
<changes>2400</changes>
|
236
|
+
</item>
|
237
|
+
</items>
|
238
|
+
</report>
|
220
239
|
```
|
221
240
|
|
222
|
-
### heatmap — commit heatmap
|
241
|
+
### 🔥 heatmap — commit heatmap
|
223
242
|
```bash
|
224
243
|
pretty-git heatmap . --format json
|
225
244
|
```
|
@@ -231,7 +250,7 @@ dow,hour,commits
|
|
231
250
|
1,11,7
|
232
251
|
```
|
233
252
|
|
234
|
-
### languages — languages
|
253
|
+
### 🈺 languages — languages
|
235
254
|
```bash
|
236
255
|
pretty-git languages . --format md --limit 10
|
237
256
|
```
|
@@ -264,11 +283,97 @@ Export:
|
|
264
283
|
- CSV/MD: columns are dynamic — `language,<metric>,percent`. Markdown also includes a `color` column.
|
265
284
|
- JSON/YAML/XML: full report structure including per-language `color` and metadata (`report`, `generated_at`, `repo_path`).
|
266
285
|
|
267
|
-
|
286
|
+
### ⚠️ hotspots — hotspots (risky files)
|
287
|
+
```bash
|
288
|
+
pretty-git hotspots . --format csv --limit 20
|
289
|
+
```
|
290
|
+
Highlights riskier files combining change frequency and magnitude.
|
291
|
+
|
292
|
+
CSV columns: `path,score,commits,additions,deletions,changes`.
|
293
|
+
|
294
|
+
Example:
|
295
|
+
```csv
|
296
|
+
path,score,commits,additions,deletions,changes
|
297
|
+
lib/a.rb,9.5,12,300,220,520
|
298
|
+
app/b.rb,7.1,8,140,60,200
|
299
|
+
```
|
300
|
+
|
301
|
+
JSON example:
|
302
|
+
```json
|
303
|
+
{
|
304
|
+
"report": "hotspots",
|
305
|
+
"generated_at": "2025-01-31T00:00:00Z",
|
306
|
+
"repo_path": ".",
|
307
|
+
"items": [
|
308
|
+
{"path": "lib/a.rb", "score": 9.5, "commits": 12, "additions": 300, "deletions": 220, "changes": 520}
|
309
|
+
]
|
310
|
+
}
|
311
|
+
```
|
312
|
+
|
313
|
+
### 🔄 churn — code churn by file
|
314
|
+
```bash
|
315
|
+
pretty-git churn . --format md --limit 20
|
316
|
+
```
|
317
|
+
Measures code churn (amount of code changing frequently).
|
318
|
+
|
319
|
+
CSV columns: `path,churn,commits,additions,deletions`.
|
320
|
+
|
321
|
+
Markdown example:
|
322
|
+
```markdown
|
323
|
+
| path | churn | commits | additions | deletions |
|
324
|
+
|---|---:|---:|---:|---:|
|
325
|
+
| lib/a.rb | 520 | 12 | 300 | 220 |
|
326
|
+
```
|
327
|
+
|
328
|
+
YAML example:
|
329
|
+
```yaml
|
330
|
+
report: churn
|
331
|
+
generated_at: '2025-01-31T00:00:00Z'
|
332
|
+
repo_path: .
|
333
|
+
items:
|
334
|
+
- path: lib/a.rb
|
335
|
+
churn: 520
|
336
|
+
commits: 12
|
337
|
+
additions: 300
|
338
|
+
deletions: 220
|
339
|
+
```
|
340
|
+
|
341
|
+
### 🏷️ ownership — code ownership
|
342
|
+
```bash
|
343
|
+
pretty-git ownership . --format csv --limit 50
|
344
|
+
```
|
345
|
+
Shows file ownership concentration per primary owner.
|
346
|
+
|
347
|
+
CSV columns: `path,owner,owner_share,authors`.
|
348
|
+
|
349
|
+
Notes:
|
350
|
+
- `owner`: author identifier (name/email) with the largest share of edits.
|
351
|
+
- `owner_share`: percent of edits by the owner (0..100).
|
352
|
+
- `authors`: total unique authors who edited the file.
|
353
|
+
|
354
|
+
XML example:
|
355
|
+
```xml
|
356
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
357
|
+
<report>
|
358
|
+
<report>ownership</report>
|
359
|
+
<generated_at>2025-01-31T00:00:00Z</generated_at>
|
360
|
+
<repo_path>.</repo_path>
|
361
|
+
<items>
|
362
|
+
<item>
|
363
|
+
<path>lib/a.rb</path>
|
364
|
+
<owner>Alice <a@example.com></owner>
|
365
|
+
<owner_share>82.5</owner_share>
|
366
|
+
<authors>2</authors>
|
367
|
+
</item>
|
368
|
+
</items>
|
369
|
+
</report>
|
370
|
+
```
|
371
|
+
|
372
|
+
## 📤 Exports
|
268
373
|
|
269
374
|
Below are exact serialization rules for each format to ensure compatibility with common tools (Excel, BI, CI, etc.).
|
270
375
|
|
271
|
-
### Console
|
376
|
+
### 🖥️ Console
|
272
377
|

|
273
378
|
_Example terminal output (theme: basic)._
|
274
379
|
* **Colors**: headers and table heads highlighted; totals: `commits` — yellow, `+additions` — green, `-deletions` — red. `--no-color` fully disables coloring.
|
@@ -279,7 +384,7 @@ _Example terminal output (theme: basic)._
|
|
279
384
|
* **Purpose**: human-readable terminal output.
|
280
385
|
* **Layout**: boxed tables, auto-truncation of long values.
|
281
386
|
|
282
|
-
### JSON
|
387
|
+
### 🧾 JSON
|
283
388
|
* **Keys**: `snake_case`.
|
284
389
|
* **Numbers**: integers/floats without localization (dot decimal separator).
|
285
390
|
* **Boolean**: `true/false`; **null**: `null`.
|
@@ -311,7 +416,7 @@ _Example terminal output (theme: basic)._
|
|
311
416
|
Bob,b@example.com,1,2,0,2.0
|
312
417
|
```
|
313
418
|
|
314
|
-
### Markdown
|
419
|
+
### 📝 Markdown
|
315
420
|
* **Tables**: GitHub Flavored Markdown.
|
316
421
|
* **Alignment**: numeric columns are right-aligned (`---:`).
|
317
422
|
* **Encoding/line endings**: UTF‑8, LF.
|
@@ -324,7 +429,7 @@ _Example terminal output (theme: basic)._
|
|
324
429
|
| app/models/user.rb | 42 | 2100 | 1400 |
|
325
430
|
```
|
326
431
|
|
327
|
-
### YAML
|
432
|
+
### 📄 YAML
|
328
433
|
* **Structure**: full result hierarchy.
|
329
434
|
* **Keys**: serialized as strings.
|
330
435
|
* **Numbers/boolean/null**: standard YAML (`123`, `true/false`, `null`).
|
@@ -344,7 +449,7 @@ _Example terminal output (theme: basic)._
|
|
344
449
|
commits: 1
|
345
450
|
```
|
346
451
|
|
347
|
-
### XML
|
452
|
+
### 🗂️ XML
|
348
453
|
* **Structure**: elements correspond to keys; arrays — repeated `<item>` or specialized tags.
|
349
454
|
* **Attributes**: for compact rows (e.g., files report) main fields may be attributes.
|
350
455
|
* **Text nodes**: used for scalar values when needed.
|
@@ -362,7 +467,7 @@ _Example terminal output (theme: basic)._
|
|
362
467
|
</authors>
|
363
468
|
```
|
364
469
|
|
365
|
-
## Ignored directories and files
|
470
|
+
## 🚫 Ignored directories and files
|
366
471
|
|
367
472
|
To keep language statistics meaningful, certain directories and file types are skipped by default.
|
368
473
|
|
@@ -387,16 +492,16 @@ vendor, node_modules, .git, .bundle, dist, build, out, target, coverage,
|
|
387
492
|
|
388
493
|
These lists mirror the implementation in `lib/pretty_git/analytics/languages.rb` and may evolve.
|
389
494
|
|
390
|
-
## Determinism and Sorting
|
495
|
+
## 🔁 Determinism and Sorting
|
391
496
|
Output is deterministic given the same input. Sorting for files/authors: by changes (desc), then by commits (desc), then by path/name (asc). Limits are applied after sorting; `all` or `0` means no limit.
|
392
497
|
|
393
|
-
## Windows Notes
|
498
|
+
## 🪟 Windows Notes
|
394
499
|
Primary targets — macOS/Linux. Windows is supported best‑effort:
|
395
500
|
* Running via Git Bash/WSL is OK
|
396
501
|
* Colors can be disabled by `--no-color`
|
397
502
|
* Carefully quote arguments when working with paths
|
398
503
|
|
399
|
-
## Diagnostics and Errors
|
504
|
+
## 🩺 Diagnostics and Errors
|
400
505
|
Typical issues and solutions:
|
401
506
|
|
402
507
|
* **Unknown report/format** — check the first argument and `--format`.
|
@@ -405,12 +510,12 @@ Typical issues and solutions:
|
|
405
510
|
* **Empty result** — check your filters (`--since/--until`, `--branch`, `--path`); your selection might be too narrow.
|
406
511
|
* **CSV encoding issues** — files are saved as UTF‑8; when opening in Excel, pick UTF‑8.
|
407
512
|
|
408
|
-
## FAQ
|
513
|
+
## ❓ FAQ
|
409
514
|
* **Why Ruby 3.4+?** The project uses dependencies aligned with Ruby 3.4+ and targets the current ecosystem.
|
410
515
|
* **New formats?** Yes, add a renderer under `lib/pretty_git/render/` and wire it in the app.
|
411
516
|
* **Where does data come from?** From system `git` via CLI calls.
|
412
517
|
|
413
|
-
## Development
|
518
|
+
## 🛠️ Development
|
414
519
|
```bash
|
415
520
|
# Install deps
|
416
521
|
bin/setup
|
@@ -422,5 +527,5 @@ bundle exec rubocop
|
|
422
527
|
|
423
528
|
Style — RuboCop clean. Tests cover aggregators, renderers, CLI, and integration scenarios (determinism, format correctness).
|
424
529
|
|
425
|
-
## License
|
530
|
+
## 📄 License
|
426
531
|
MIT © Contributors
|