attractor 2.6.0 → 2.7.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/README.md +59 -0
- data/app/assets/javascripts/index.pack.js +5 -5
- data/lib/attractor/cache.rb +36 -5
- data/lib/attractor/calculators/base_calculator.rb +54 -19
- data/lib/attractor/cli.rb +89 -16
- data/lib/attractor/config.rb +53 -0
- data/lib/attractor/diff_calculator.rb +142 -0
- data/lib/attractor/formatters/format_strategy.rb +20 -0
- data/lib/attractor/formatters/formats/csv.rb +20 -0
- data/lib/attractor/formatters/formats/json.rb +28 -0
- data/lib/attractor/formatters/formats/markdown.rb +82 -0
- data/lib/attractor/formatters/formats/table.rb +55 -0
- data/lib/attractor/formatters/formatter.rb +16 -0
- data/lib/attractor/formatters/report.rb +21 -0
- data/lib/attractor/formatters/targets/console.rb +47 -0
- data/lib/attractor/formatters/targets/diff.rb +80 -0
- data/lib/attractor/git.rb +51 -0
- data/lib/attractor/reporters/base_reporter.rb +1 -0
- data/lib/attractor/reporters/console_reporter.rb +14 -81
- data/lib/attractor/reporters/diff_reporter.rb +26 -0
- data/lib/attractor/suggester.rb +5 -2
- data/lib/attractor/value.rb +4 -1
- data/lib/attractor/version.rb +1 -1
- data/lib/attractor/watcher.rb +1 -1
- data/lib/attractor.rb +12 -8
- metadata +76 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f92fa88c85c572827d8a18feba00fcbd156c70a4642bbb9544beb90d7242af8f
|
|
4
|
+
data.tar.gz: d146f48f098cfb0e12ea135ed05279e1accf7ad44be1dbdd7009f8a1441efe60
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 379f288757d88603c45617ffc626c14498bcefc6e14c6442b1b95adf85afef07bb8b064833b2ceed36ebd582f6b0fafe2799fe972593f56f8755a757c330cf90
|
|
7
|
+
data.tar.gz: c89dcdb9f88391c072bec3af06f2efa2c962b70e95e04bbcc7899ba5dc61473d0461c7d23d9ebf59479c60a99d5c3d2e5dac6394cc427a352c96f4881ac56a25
|
data/README.md
CHANGED
|
@@ -54,6 +54,8 @@
|
|
|
54
54
|
<!-- GIF -->
|
|
55
55
|
![attractor_v0 6 1][demo-gif]
|
|
56
56
|
|
|
57
|
+
**If you are looking for a managed solution to observe your code's quality, check out [UseAttractor](https://useattr.actor)**
|
|
58
|
+
|
|
57
59
|
## Table of Contents
|
|
58
60
|
|
|
59
61
|
- [Table of Contents](#table-of-contents)
|
|
@@ -182,6 +184,31 @@ attractor:
|
|
|
182
184
|
- attractor_output
|
|
183
185
|
```
|
|
184
186
|
|
|
187
|
+
## Configuration File
|
|
188
|
+
|
|
189
|
+
Attractor can read defaults from an `.attractor.yml` file in the repository root. This keeps project-specific settings in version control and avoids repeating flags on every command.
|
|
190
|
+
|
|
191
|
+
```yml
|
|
192
|
+
report:
|
|
193
|
+
app_root: app # maps to --file_prefix
|
|
194
|
+
minimum_churn: 3
|
|
195
|
+
ignore: "vendor,node_modules"
|
|
196
|
+
start_ago: 2y
|
|
197
|
+
skip:
|
|
198
|
+
includes: ["wip"] # CI-only for now
|
|
199
|
+
branches:
|
|
200
|
+
only: [main] # CI-only for now
|
|
201
|
+
except: [gh-pages] # CI-only for now
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Values under `report` are picked up by all CLI commands. Explicit CLI flags always override the config file. The `skip` and `branches` keys are reserved for CI/SaaS usage and are currently ignored by the CLI.
|
|
205
|
+
|
|
206
|
+
You can also point to a custom config path:
|
|
207
|
+
|
|
208
|
+
```sh
|
|
209
|
+
attractor report --config path/to/attractor.yml
|
|
210
|
+
```
|
|
211
|
+
|
|
185
212
|
## CLI Commands and Options
|
|
186
213
|
|
|
187
214
|
Initialize the local cache:
|
|
@@ -193,6 +220,7 @@ attractor init
|
|
|
193
220
|
--start_ago|-s (e.g. 5y, 3m, 7w)
|
|
194
221
|
--minimum_churn|-c (minimum times a file must have changed to be processed)
|
|
195
222
|
--ignore|-i 'spec/*_spec.rb,db/schema.rb,tmp'
|
|
223
|
+
--config path/to/.attractor.yml
|
|
196
224
|
```
|
|
197
225
|
|
|
198
226
|
Print a simple output to console:
|
|
@@ -205,6 +233,33 @@ attractor calc
|
|
|
205
233
|
--start_ago|-s (e.g. 5y, 3m, 7w)
|
|
206
234
|
--minimum_churn|-c (minimum times a file must have changed to be processed)
|
|
207
235
|
--ignore|-i 'spec/*_spec.rb,db/schema.rb,tmp'
|
|
236
|
+
--files 'app/models/user.rb,app/models/post.rb' # restrict to an explicit list of paths
|
|
237
|
+
--files - # read newline-separated paths from stdin
|
|
238
|
+
--config path/to/.attractor.yml
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Calculate the complexity delta between two git refs:
|
|
242
|
+
|
|
243
|
+
```sh
|
|
244
|
+
attractor diff
|
|
245
|
+
--base main
|
|
246
|
+
--head HEAD
|
|
247
|
+
--file_prefix|-p app/models
|
|
248
|
+
--type|-t rb|js
|
|
249
|
+
--start_ago|-s (e.g. 5y, 3m, 7w)
|
|
250
|
+
--minimum_churn|-c (minimum times a file must have changed to be processed)
|
|
251
|
+
--ignore|-i 'spec/*_spec.rb,db/schema.rb,tmp'
|
|
252
|
+
--files 'app/models/user.rb,app/models/post.rb'
|
|
253
|
+
--files -
|
|
254
|
+
--format|-f table|markdown|json
|
|
255
|
+
--config path/to/.attractor.yml
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
The `markdown` format produces a PR/MR-ready summary with Stats, Trends, and To-dos sections, followed by the full per-file table wrapped in a collapsible `<details>` block. Pipe it into a GitHub or GitLab comment:
|
|
259
|
+
|
|
260
|
+
```sh
|
|
261
|
+
attractor diff --base main --head HEAD --format markdown | gh pr comment 123 --body-file -
|
|
262
|
+
attractor diff --base main --head HEAD --format markdown | glab mr note 45 --message "$(cat)"
|
|
208
263
|
```
|
|
209
264
|
|
|
210
265
|
Generate a full report
|
|
@@ -218,6 +273,9 @@ attractor report
|
|
|
218
273
|
--start_ago|-s (e.g. 5y, 3m, 7w)
|
|
219
274
|
--minimum_churn|-c (minimum times a file must have changed to be processed)
|
|
220
275
|
--ignore|-i 'spec/*_spec.rb,db/schema.rb,tmp'
|
|
276
|
+
--files 'app/models/user.rb,app/models/post.rb'
|
|
277
|
+
--files -
|
|
278
|
+
--config path/to/.attractor.yml
|
|
221
279
|
```
|
|
222
280
|
|
|
223
281
|
Serve the output on `http://localhost:7890`
|
|
@@ -230,6 +288,7 @@ attractor serve
|
|
|
230
288
|
--start_ago|-s (e.g. 5y, 3m, 7w)
|
|
231
289
|
--minimum_churn|-c (minimum times a file must have changed to be processed)
|
|
232
290
|
--ignore|-i 'spec/*_spec.rb,db/schema.rb,tmp'
|
|
291
|
+
--config path/to/.attractor.yml
|
|
233
292
|
```
|
|
234
293
|
|
|
235
294
|
Clear the local cache:
|