reviewer 0.1.5 → 1.0.0

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 (87) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +3 -0
  3. data/.github/workflows/main.yml +79 -11
  4. data/.github/workflows/release.yml +98 -0
  5. data/.gitignore +1 -1
  6. data/.inch.yml +3 -1
  7. data/.reek.yml +175 -0
  8. data/.reviewer.example.yml +7 -2
  9. data/.reviewer.yml +166 -40
  10. data/.rubocop.yml +34 -2
  11. data/CHANGELOG.md +42 -2
  12. data/Gemfile +39 -1
  13. data/Gemfile.lock +291 -70
  14. data/LICENSE.txt +20 -4
  15. data/README.md +310 -21
  16. data/RELEASING.md +190 -0
  17. data/Rakefile +117 -0
  18. data/dependency_decisions.yml +61 -0
  19. data/exe/fmt +1 -1
  20. data/exe/rvw +1 -1
  21. data/lib/reviewer/arguments/files.rb +47 -20
  22. data/lib/reviewer/arguments/keywords.rb +34 -41
  23. data/lib/reviewer/arguments/tags.rb +11 -11
  24. data/lib/reviewer/arguments.rb +100 -29
  25. data/lib/reviewer/batch/formatter.rb +87 -0
  26. data/lib/reviewer/batch.rb +32 -48
  27. data/lib/reviewer/capabilities.rb +81 -0
  28. data/lib/reviewer/command/string/env.rb +12 -6
  29. data/lib/reviewer/command/string/flags.rb +2 -4
  30. data/lib/reviewer/command/string.rb +47 -12
  31. data/lib/reviewer/command.rb +65 -10
  32. data/lib/reviewer/configuration/loader.rb +70 -0
  33. data/lib/reviewer/configuration.rb +6 -3
  34. data/lib/reviewer/context.rb +15 -0
  35. data/lib/reviewer/doctor/config_check.rb +46 -0
  36. data/lib/reviewer/doctor/environment_check.rb +58 -0
  37. data/lib/reviewer/doctor/formatter.rb +75 -0
  38. data/lib/reviewer/doctor/keyword_check.rb +85 -0
  39. data/lib/reviewer/doctor/opportunity_check.rb +88 -0
  40. data/lib/reviewer/doctor/report.rb +63 -0
  41. data/lib/reviewer/doctor/tool_inventory.rb +41 -0
  42. data/lib/reviewer/doctor.rb +28 -0
  43. data/lib/reviewer/history.rb +10 -17
  44. data/lib/reviewer/output/formatting.rb +40 -0
  45. data/lib/reviewer/output/printer.rb +70 -9
  46. data/lib/reviewer/output.rb +37 -78
  47. data/lib/reviewer/prompt.rb +38 -0
  48. data/lib/reviewer/report/formatter.rb +124 -0
  49. data/lib/reviewer/report.rb +100 -0
  50. data/lib/reviewer/runner/failed_files.rb +66 -0
  51. data/lib/reviewer/runner/formatter.rb +103 -0
  52. data/lib/reviewer/runner/guidance.rb +79 -0
  53. data/lib/reviewer/runner/result.rb +150 -0
  54. data/lib/reviewer/runner/strategies/captured.rb +98 -23
  55. data/lib/reviewer/runner/strategies/passthrough.rb +2 -11
  56. data/lib/reviewer/runner.rb +126 -40
  57. data/lib/reviewer/session/formatter.rb +87 -0
  58. data/lib/reviewer/session.rb +208 -0
  59. data/lib/reviewer/setup/catalog.rb +233 -0
  60. data/lib/reviewer/setup/detector.rb +61 -0
  61. data/lib/reviewer/setup/formatter.rb +94 -0
  62. data/lib/reviewer/setup/gemfile_lock.rb +55 -0
  63. data/lib/reviewer/setup/generator.rb +54 -0
  64. data/lib/reviewer/setup/tool_block.rb +112 -0
  65. data/lib/reviewer/setup.rb +41 -0
  66. data/lib/reviewer/shell/result.rb +14 -15
  67. data/lib/reviewer/shell/timer.rb +40 -35
  68. data/lib/reviewer/shell.rb +41 -12
  69. data/lib/reviewer/tool/conversions.rb +20 -0
  70. data/lib/reviewer/tool/file_resolver.rb +54 -0
  71. data/lib/reviewer/tool/settings.rb +88 -44
  72. data/lib/reviewer/tool/test_file_mapper.rb +73 -0
  73. data/lib/reviewer/tool/timing.rb +78 -0
  74. data/lib/reviewer/tool.rb +88 -69
  75. data/lib/reviewer/tools.rb +47 -33
  76. data/lib/reviewer/version.rb +1 -1
  77. data/lib/reviewer.rb +109 -50
  78. data/reviewer.gemspec +16 -19
  79. metadata +101 -142
  80. data/lib/reviewer/conversions.rb +0 -16
  81. data/lib/reviewer/guidance.rb +0 -77
  82. data/lib/reviewer/keywords/git/staged.rb +0 -64
  83. data/lib/reviewer/keywords/git.rb +0 -14
  84. data/lib/reviewer/keywords.rb +0 -9
  85. data/lib/reviewer/loader.rb +0 -59
  86. data/lib/reviewer/output/scrubber.rb +0 -48
  87. data/lib/reviewer/output/token.rb +0 -85
data/.reviewer.yml CHANGED
@@ -1,32 +1,42 @@
1
1
  bundle_audit:
2
2
  name: Bundle Audit
3
3
  description: Review Gem Dependencies for Security Issues
4
- tags: [critical, dependencies, ruby, dev]
4
+ tags: [critical, security, dependencies, ruby, dev]
5
5
  links:
6
6
  home: https://github.com/rubysec/bundler-audit
7
7
  install: https://github.com/rubysec/bundler-audit#install
8
8
  commands:
9
- install: 'bundle exec gem install bundler-audit'
10
- prepare: 'bundle exec bundle-audit update'
11
- review: 'bundle exec bundle-audit check --no-update'
9
+ install: "bundle exec gem install bundler-audit"
10
+ prepare: "bundle exec bundle-audit update"
11
+ review: "bundle exec bundle-audit check --no-update"
12
12
 
13
13
  tests:
14
14
  name: Minitest
15
15
  description: Unit Tests & Coverage
16
16
  tags: [ruby, tests, dev]
17
+ summary:
18
+ pattern: '(\d+)\s+tests?'
19
+ label: '\1 tests'
17
20
  links:
18
21
  home:
19
22
  commands:
20
23
  review: "bundle exec rake"
24
+ files:
25
+ review: "bundle exec ruby -Itest"
26
+ flag: ""
27
+ separator: " "
28
+ pattern: "*_test.rb"
29
+ map_to_tests: "minitest"
21
30
  reports:
22
31
  open_on_fail: true
23
32
  local_file: coverage/index.html
24
- local_uri: 'file:///Users/garrettdimon/Code/reviewer/coverage/index.html#_AllFiles'
33
+ local_uri: "file:///Users/garrettdimon/Code/reviewer/coverage/index.html#_AllFiles"
25
34
  env:
26
35
  testopts: --seed=$SEED
27
36
  # coverage: false
28
37
 
29
38
  reek:
39
+ # skip_in_batch: true # Reek provides guidance and is generally run solo
30
40
  name: Reek
31
41
  description: Examine Ruby Classes for Code Smells
32
42
  tags: [ruby, quality, dev]
@@ -34,14 +44,18 @@ reek:
34
44
  home: https://github.com/troessner/reek
35
45
  install: https://github.com/troessner/reek#quickstart
36
46
  commands:
37
- install: 'bundle exec gem install reek'
38
- review: 'bundle exec reek'
47
+ install: "bundle exec gem install reek"
48
+ review: "bundle exec reek --config .reek.yml lib/"
49
+ files:
50
+ flag: ""
51
+ separator: " "
52
+ pattern: "*.rb"
39
53
  flags:
40
54
  color:
41
55
  documentation:
42
56
 
43
57
  flog:
44
- disabled: true # Flog provides guidance and is generally run solo
58
+ # skip_in_batch: true # Flog provides guidance and is generally run solo
45
59
  name: Flog
46
60
  description: Reports your most tortured ruby code in an easy to read pain report.
47
61
  tags: [ruby, quality, dev]
@@ -49,15 +63,15 @@ flog:
49
63
  home: https://ruby.sadi.st/Flog.html
50
64
  install: https://ruby.sadi.st/Flog.html
51
65
  commands:
52
- install: 'bundle exec gem install flog'
53
- review: 'bundle exec flog -g lib'
66
+ install: "bundle exec gem install flog"
67
+ review: "bundle exec flog -g lib"
54
68
  flags:
55
69
  threshold: 10 # Percentage. i.e. Show the most concerning 10% of results
56
70
  group:
57
71
  methods-only:
58
72
 
59
73
  flay:
60
- disabled: true # Flay provides guidance and is generally run solo
74
+ # skip_in_batch: true # Flay provides guidance and is generally run solo
61
75
  name: Flay
62
76
  description: Review ruby code for structural similarities and refactoring opportunities.
63
77
  tags: [ruby, quality, dev]
@@ -65,37 +79,39 @@ flay:
65
79
  home: https://ruby.sadi.st/Flay.html
66
80
  install: https://ruby.sadi.st/Flay.html
67
81
  commands:
68
- install: 'bundle exec gem install flay'
69
- review: 'bundle exec flay ./lib'
82
+ install: "bundle exec gem install flay"
83
+ review: "bundle exec flay ./lib"
70
84
  flags:
71
85
  liberal:
72
86
  summary:
73
87
 
74
-
75
88
  rubocop:
76
89
  name: Rubocop
77
90
  description: Review Ruby Syntax & Formatting for Consistency
78
- tags: [ruby, syntax]
91
+ tags: [ruby, syntax, dev]
92
+ summary:
93
+ pattern: '(\d+)\s+offenses?'
94
+ label: '\1 offenses'
79
95
  links:
80
96
  home: https://rubocop.org
81
97
  install: https://docs.rubocop.org/rubocop/1.13/installation.html
82
98
  ignore_syntax: https://docs.rubocop.org/rubocop/configuration.html#ignoredmethods
83
99
  disable_syntax: https://docs.rubocop.org/rubocop/configuration.html#disabling-cops-within-source-code
84
100
  commands:
85
- install: 'bundle exec gem install rubocop'
86
- review: 'bundle exec rubocop --parallel'
87
- format: 'bundle exec rubocop --auto-correct'
101
+ install: "bundle exec gem install rubocop"
102
+ review: "bundle exec rubocop --parallel"
103
+ format: "bundle exec rubocop --auto-correct"
88
104
  files:
89
- flag: ''
90
- separator: ' '
105
+ flag: ""
106
+ separator: " "
107
+ pattern: "*.rb"
91
108
  flags:
92
109
  color:
93
110
 
94
-
95
111
  # The YARD Parser can also come in handy:
96
112
  # https://yardoc.org/types
97
113
  inch:
98
- disabled: true
114
+ # skip_in_batch: true
99
115
  tags: [docs, ruby, dev]
100
116
  name: Inch
101
117
  description: Review Ruby Documentation Quality
@@ -103,12 +119,11 @@ inch:
103
119
  home: https://rrrene.org/inch/
104
120
  usage: https://www.rubydoc.info/gems/yard/file/docs/Tags.md
105
121
  commands:
106
- install: 'bundle exec gem install inch'
107
- review: 'bundle exec inch'
108
-
122
+ install: "bundle exec gem install inch"
123
+ review: "bundle exec inch"
109
124
 
110
125
  yard:
111
- disabled: true
126
+ # skip_in_batch: true
112
127
  tags: [docs, ruby, dev]
113
128
  name: Yard
114
129
  description: Generates Documentation
@@ -117,24 +132,135 @@ yard:
117
132
  usage: https://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md#using
118
133
  install: https://github.com/lsegal/yard#installing
119
134
  commands:
120
- install: 'bundle exec gem install yard'
135
+ install: "bundle exec gem install yard"
121
136
  prepare: "yard doc 'lib/**/*.rb'"
122
- review: 'yard stats'
123
- serve: 'yard server --reload && open http://0.0.0.0:8808'
137
+ review: "yard stats"
138
+ serve: "yard server --reload && open http://0.0.0.0:8808"
124
139
  generate:
125
- quiet_flag: '--quiet'
126
-
140
+ quiet_flag: "--quiet"
127
141
 
128
142
  alex:
129
- disabled: true
143
+ skip_in_batch: true
130
144
  tags: [language, docs]
131
- name: Yard
132
- description: Generates Documentation
145
+ name: Alex
146
+ description: Catch insensitive, inconsiderate writing
133
147
  links:
134
- home:
135
- usage:
136
- install:
148
+ home: https://alexjs.com
149
+ commands:
150
+ install: "yarn global add alex"
151
+ review: "alex ."
152
+
153
+ # New tools for expanded testing coverage
154
+
155
+ brakeman:
156
+ skip_in_batch: true # Requires Rails application, not applicable to gems
157
+ name: Brakeman
158
+ description: Static analysis security scanner for Ruby
159
+ tags: [security, ruby, dev]
160
+ links:
161
+ home: https://brakemanscanner.org
162
+ install: https://brakemanscanner.org/docs/install/
163
+ commands:
164
+ install: "bundle exec gem install brakeman"
165
+ review: "bundle exec brakeman --no-pager -q"
166
+
167
+ fasterer:
168
+ name: Fasterer
169
+ description: Suggest performance improvements for Ruby code
170
+ tags: [ruby, quality, performance, dev]
171
+ links:
172
+ home: https://github.com/DamirSvrtan/fasterer
173
+ commands:
174
+ install: "bundle exec gem install fasterer"
175
+ review: "bundle exec fasterer"
176
+ files:
177
+ flag: ""
178
+ separator: " "
179
+ pattern: "*.rb"
180
+
181
+ debride:
182
+ skip_in_batch: true # Broken on Ruby 3.4 (missing require for Racc, Timeout)
183
+ name: Debride
184
+ description: Find potentially unused methods and classes
185
+ tags: [ruby, quality, dev]
186
+ links:
187
+ home: https://github.com/seattlerb/debride
188
+ commands:
189
+ install: "bundle exec gem install debride"
190
+ review: "bundle exec debride lib/"
191
+
192
+ rubycritic:
193
+ skip_in_batch: true # Generates HTML reports, best run manually
194
+ name: RubyCritic
195
+ description: Code quality analysis with HTML reports
196
+ tags: [ruby, quality, dev]
197
+ links:
198
+ home: https://github.com/whitesmith/rubycritic
199
+ commands:
200
+ install: "bundle exec gem install rubycritic"
201
+ review: "bundle exec rubycritic lib/ --no-browser -f console"
202
+
203
+ metric_fu:
204
+ skip_in_batch: true # Meta-tool that runs many others, slow
205
+ name: MetricFu
206
+ description: Aggregate code metrics from multiple tools
207
+ tags: [ruby, quality, dev]
208
+ links:
209
+ home: https://github.com/metricfu/metric_fu
210
+ commands:
211
+ install: "bundle exec gem install metric_fu"
212
+ review: "bundle exec metric_fu"
213
+
214
+ yardstick:
215
+ # skip_in_batch: true # Documentation coverage measurement
216
+ name: Yardstick
217
+ description: Measure YARD documentation coverage
218
+ tags: [docs, ruby, dev]
219
+ links:
220
+ home: https://github.com/dkubb/yardstick
221
+ commands:
222
+ install: "bundle exec gem install yardstick"
223
+ review: "bundle exec yardstick lib/"
224
+
225
+ standard:
226
+ skip_in_batch: true # Conflicts with existing RuboCop configuration
227
+ name: Standard
228
+ description: Zero-configuration Ruby linter
229
+ tags: [ruby, syntax, dev]
230
+ links:
231
+ home: https://github.com/standardrb/standard
232
+ commands:
233
+ install: "bundle exec gem install standard"
234
+ review: "bundle exec standardrb"
235
+ format: "bundle exec standardrb --fix"
236
+
237
+ rufo:
238
+ skip_in_batch: true # Alternative formatter to RuboCop
239
+ name: Rufo
240
+ description: Ruby code formatter
241
+ tags: [ruby, syntax, dev]
242
+ links:
243
+ home: https://github.com/ruby-formatter/rufo
244
+ commands:
245
+ install: "bundle exec gem install rufo"
246
+ review: "bundle exec rufo --check lib/"
247
+ format: "bundle exec rufo lib/"
248
+
249
+ license_finder:
250
+ skip_in_batch: true # Slow - run manually with: rvw license_finder
251
+ name: License Finder
252
+ description: Check dependency licenses for compliance
253
+ tags: [dependencies, compliance, slow, dev]
254
+ links:
255
+ home: https://github.com/pivotal/LicenseFinder
256
+ commands:
257
+ install: "bundle exec gem install license_finder"
258
+ review: "bundle exec license_finder --decisions-file=./dependency_decisions.yml"
259
+
260
+ notes:
261
+ name: Notes
262
+ description: Find TODO, FIXME, HACK, and OPTIMIZE comments
263
+ tags: [quality, dev]
137
264
  commands:
138
- install: 'yarn global add alex'
139
- review: 'alex .'
140
- quiet_flag: '--quiet'
265
+ review: "grep -rn --include='*.rb' -E '(TODO|FIXME|HACK|OPTIMIZE|XXX):?' lib/ test/ || true"
266
+ max_exit_status: 1
data/.rubocop.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.5
2
+ TargetRubyVersion: 3.2
3
3
  NewCops: enable
4
+ SuggestExtensions: false
4
5
  UseCache: true
5
6
  CacheRootDirectory: './'
6
7
  Exclude:
@@ -12,9 +13,40 @@ Layout/LineLength:
12
13
 
13
14
  # One case statement in a single method isn't complex.
14
15
  Metrics/CyclomaticComplexity:
15
- IgnoredMethods: ['case']
16
+ AllowedMethods: ['case']
17
+
18
+ # Development dependencies in gemspec is fine for this gem
19
+ Gemspec/DevelopmentDependencies:
20
+ Enabled: false
21
+
22
+ # Keyword arguments are self-documenting at call sites, so they don't
23
+ # create the readability problem that long positional lists do.
24
+ Metrics/ParameterLists:
25
+ CountKeywordArgs: false
26
+
27
+ # The CLI entry point is a routing method with one guard clause per line.
28
+ # Each branch is a single method call — the structure is as clear as it gets.
29
+ Metrics/AbcSize:
30
+ AllowedMethods: ['handle_early_exits']
16
31
 
17
32
  # 10 is a good goal but a little draconian
18
33
  Metrics/MethodLength:
19
34
  CountAsOne: ['array', 'hash', 'heredoc']
20
35
  Max: 15
36
+
37
+ # Test classes naturally grow with coverage (see test/.rubocop.yml for higher limit)
38
+ Metrics/ClassLength:
39
+ CountAsOne: ['array', 'hash', 'heredoc']
40
+ Max: 150
41
+
42
+ Metrics/ModuleLength:
43
+ CountAsOne: ['array', 'hash', 'heredoc']
44
+ Max: 150
45
+
46
+ # Fasterer prefers yield over block.call for performance
47
+ Style/ExplicitBlockArgument:
48
+ Enabled: false
49
+
50
+ # Fasterer prefers fetch with block over second argument for performance
51
+ Style/RedundantFetchBlock:
52
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,7 +1,47 @@
1
1
  ## [Unreleased]
2
2
 
3
- - TODO: Improve and streamline installation
4
- - TODO: Add support for targeting specific files
3
+ ## [1.0.0] - 2026-02-03
4
+
5
+ ### Added
6
+ - Git-aware file targeting: `staged`, `unstaged`, `modified`, `untracked` keywords resolve files from git status and pass only relevant files to each tool
7
+ - `failed` keyword: re-run only tools that failed in the previous run, scoped to their failed files
8
+ - `--json` / `-j` flag for structured JSON output (CI, scripting, agent integration)
9
+ - `--raw` / `-r` flag to force passthrough output (bypasses capturing)
10
+ - `--format` flag with streaming, summary, and json modes
11
+ - `--capabilities` / `-c` flag for agent discovery (outputs JSON describing tools, keywords, scenarios)
12
+ - `skip_in_batch` config option: exclude tools from `rvw` while keeping them available via `rvw tool_name`
13
+ - `files.pattern` config: glob pattern to filter which files are passed to each tool
14
+ - `files.map_to_tests` config: map source files to test files (`minitest` or `rspec` conventions)
15
+ - `files.review` / `files.format` config: alternative commands when files are scoped
16
+ - First-run experience: interactive setup when no `.reviewer.yml` exists
17
+ - `rvw init` command: auto-detect tools from Gemfile.lock and generate `.reviewer.yml`
18
+ - `rvw doctor` command: diagnostics for configuration, tools, keywords, and environment
19
+ - Keyword resolution summary: preview which tools and files will run before execution
20
+ - Spell-check suggestions for mistyped keywords
21
+ - Auto-detection catalog: bundler-audit, rubocop, standard, reek, flog, flay, brakeman, fasterer, minitest, rspec, eslint, prettier, stylelint, typescript, biome
22
+ - Progress bar for captured output with timing estimates
23
+ - PTY-based streaming capture for failed file extraction from single-tool runs
24
+
25
+ ### Fixed
26
+ - Console width returns default in piped/CI contexts instead of 0
27
+ - `rvw failed` no longer crashes on empty tag objects
28
+ - MIT license restored in LICENSE.txt
29
+ - `--help` and `--version` exit immediately instead of running tool suite
30
+ - Valid JSON emitted for early exits (no matching tools, no files)
31
+
32
+ ### Changed
33
+ - **Ruby 3.2+ required** (supports 3.2, 3.3, 3.4, and 4.0)
34
+ - Architecture refactor: full dependency injection, no global state in business logic
35
+ - Output decomposed into domain formatters (Runner, Batch, Session, Doctor, Setup, Report)
36
+ - Session class owns run lifecycle; Reviewer module is pure wiring
37
+ - Context struct threads shared dependencies through the call stack
38
+ - Tool timing extracted to Tool::Timing collaborator with injected history
39
+ - Result interpretation separated from Runner execution (Result.from_runner)
40
+ - Tests no longer depend on global state or require reset between runs
41
+ - Redesigned output: compact `↳ command` format, `✓ ~Xs` checkmark summaries
42
+ - ANSI color output guarded for TTY (clean output in CI and pipes)
43
+ - README rewritten with installation, usage, configuration, and workflow documentation
44
+ - `disabled` config key deprecated in favor of `skip_in_batch`
5
45
 
6
46
  ## [0.1.4] - 2021-07-08
7
47
 
data/Gemfile CHANGED
@@ -5,4 +5,42 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in reviewer.gemspec
6
6
  gemspec
7
7
 
8
- gem 'rake', '~> 13.0'
8
+ gem 'rake', '~> 13.2'
9
+
10
+ # Security auditing - always run in CI
11
+ gem 'bundler-audit'
12
+
13
+ # Self-review tools - not required for running tests
14
+ # Install with: bundle config set --local with lint && bundle install
15
+ group :lint, optional: true do
16
+ # Ruby 3.4+ requires explicit racc (no longer a default gem)
17
+ gem 'racc'
18
+
19
+ # Style & Linting
20
+ gem 'rubocop'
21
+ gem 'rubocop-minitest'
22
+ gem 'rubocop-rake'
23
+ gem 'standard', '>= 1.35.1'
24
+
25
+ # Code Quality & Complexity
26
+ gem 'debride'
27
+ gem 'fasterer'
28
+ gem 'flay'
29
+ gem 'flog'
30
+ gem 'metric_fu'
31
+ gem 'reek'
32
+ gem 'rubycritic'
33
+
34
+ # Security
35
+ gem 'brakeman'
36
+
37
+ # Documentation
38
+ gem 'inch'
39
+ gem 'yardstick'
40
+
41
+ # Formatting
42
+ gem 'rufo'
43
+
44
+ # Compliance
45
+ gem 'license_finder'
46
+ end