reviewer 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.flayignore +1 -0
  3. data/.github/workflows/main.yml +11 -3
  4. data/.gitignore +5 -0
  5. data/.reviewer.example.yml +27 -23
  6. data/.reviewer.yml +58 -5
  7. data/.rubocop.yml +2 -0
  8. data/.ruby-version +1 -1
  9. data/CHANGELOG.md +14 -0
  10. data/Gemfile +0 -3
  11. data/Gemfile.lock +54 -29
  12. data/README.md +5 -50
  13. data/exe/fmt +1 -1
  14. data/exe/rvw +1 -1
  15. data/lib/reviewer.rb +39 -26
  16. data/lib/reviewer/arguments.rb +25 -9
  17. data/lib/reviewer/arguments/files.rb +37 -5
  18. data/lib/reviewer/arguments/keywords.rb +23 -9
  19. data/lib/reviewer/arguments/tags.rb +26 -3
  20. data/lib/reviewer/batch.rb +64 -0
  21. data/lib/reviewer/command.rb +100 -0
  22. data/lib/reviewer/command/string.rb +72 -0
  23. data/lib/reviewer/command/string/env.rb +40 -0
  24. data/lib/reviewer/command/string/flags.rb +40 -0
  25. data/lib/reviewer/command/string/verbosity.rb +51 -0
  26. data/lib/reviewer/command/verbosity.rb +65 -0
  27. data/lib/reviewer/configuration.rb +24 -4
  28. data/lib/reviewer/conversions.rb +27 -0
  29. data/lib/reviewer/guidance.rb +73 -0
  30. data/lib/reviewer/history.rb +38 -0
  31. data/lib/reviewer/keywords.rb +9 -0
  32. data/lib/reviewer/keywords/git.rb +14 -0
  33. data/lib/reviewer/keywords/git/staged.rb +48 -0
  34. data/lib/reviewer/loader.rb +2 -3
  35. data/lib/reviewer/output.rb +92 -0
  36. data/lib/reviewer/printer.rb +25 -0
  37. data/lib/reviewer/runner.rb +43 -72
  38. data/lib/reviewer/runner/strategies/quiet.rb +90 -0
  39. data/lib/reviewer/runner/strategies/verbose.rb +63 -0
  40. data/lib/reviewer/shell.rb +58 -0
  41. data/lib/reviewer/shell/result.rb +69 -0
  42. data/lib/reviewer/shell/timer.rb +57 -0
  43. data/lib/reviewer/tool.rb +109 -40
  44. data/lib/reviewer/tool/settings.rb +18 -32
  45. data/lib/reviewer/tools.rb +38 -3
  46. data/lib/reviewer/version.rb +1 -1
  47. data/reviewer.gemspec +10 -2
  48. metadata +143 -16
  49. data/lib/reviewer/arguments/keywords/git.rb +0 -16
  50. data/lib/reviewer/arguments/keywords/git/staged.rb +0 -64
  51. data/lib/reviewer/logger.rb +0 -62
  52. data/lib/reviewer/tool/command.rb +0 -80
  53. data/lib/reviewer/tool/env.rb +0 -38
  54. data/lib/reviewer/tool/flags.rb +0 -38
  55. data/lib/reviewer/tool/verbosity.rb +0 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 538f085294cbfbb5ce7c8412a39991534a2251b83978894133537f20e2bbf1ba
4
- data.tar.gz: 39bee00497eccb91256b772f5af8a77746374648efd884c9ffb719f9fd7b1e16
3
+ metadata.gz: 9223e406b7f957249c7d39ba4c56e3fbdabe323e52b270af076de0a530b51b9f
4
+ data.tar.gz: afb2714ed785bd91b2fe3d3d7b6f75fa8826f9387609ba6eb21ed21960883e10
5
5
  SHA512:
6
- metadata.gz: 872fbfb03db5c520c6b20d0eedf624ae37c9c9c2452b34bb286a4f9c52eddafe2846f5e401d702424e14dae9a153cefd6e3f8e8bf15a9a3e4c58e76940af64e9
7
- data.tar.gz: 4bc2ae679b15339577014e404fb8340c436e0c7ae26f6f46ac2baaf94d14592c42610a343e6eba679928bdcb3d1c0698f0e75d68771f78fa4f1bef9f03ed8dfd
6
+ metadata.gz: 7f56b586b5bea303b4dab387ba4c66535caf2f1cdbc0d8ff3b2a8e092b54d0a3bc340ae864a0ae90729bb89a2925294c51c8bab9476cb2a34f886b429efb3694
7
+ data.tar.gz: 71da282037c2f26c339afe21ddb71ff0713ff7bf652bb0787f74df3b16bf12cd9aea86a7bf7625c0ee43d8d80e6d1e0ca03315e6cf9c1e8eee33cb6082415558
data/.flayignore ADDED
@@ -0,0 +1 @@
1
+ ./test/**/*.rb
@@ -4,13 +4,21 @@ on: [push,pull_request]
4
4
 
5
5
  jobs:
6
6
  build:
7
+ strategy:
8
+ matrix:
9
+ ruby: [2.5.9, 2.6.8, 2.7.4, 3.0.2]
7
10
  runs-on: ubuntu-latest
8
11
  steps:
9
12
  - uses: actions/checkout@v2
10
13
  - name: Set up Ruby
11
14
  uses: ruby/setup-ruby@v1
12
15
  with:
13
- ruby-version: 2.7.3
16
+ ruby-version: ${{ matrix.ruby }}
14
17
  bundler-cache: true
15
- - name: Run the default task
16
- run: bundle exec rake
18
+ - name: Bundle Audit
19
+ run: bundle exec ./exe/rvw bundle_audit
20
+ - name: Test Review
21
+ run: bundle exec ./exe/rvw tests
22
+ - name: Multiple Command Review
23
+ run: bundle exec ./exe/rvw bundle_audit tests
24
+
data/.gitignore CHANGED
@@ -6,3 +6,8 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ /rubocop_cache/
10
+ .reviewer_history.yml
11
+ .reviewer_history_test.yml
12
+ coverage
13
+ Gemfile.lock
@@ -1,4 +1,5 @@
1
1
  # Quick overview of the options configuration for command-line tools.
2
+ # It can be handy to leave this section in your configuration file as a convenient reference.
2
3
  #
3
4
  # <command_key>: // ex. 'rubocop', 'bundler-audit', etc.
4
5
  # disabled: true // Optional. Tools are enabled by default
@@ -8,7 +9,8 @@
8
9
  # links:
9
10
  # home: // Optional. A link to the home page for the tool.
10
11
  # install: // Optional. A link to the installation instructions for the tool.
11
- # ignore_syntax: // Optional. A link to the syntax for ignoring/disabling some rules for the tool.
12
+ # ignore_syntax: // Optional. A link to the syntax for ignoring some rules for small sections of code.
13
+ # disable_syntax: // Optional. A link to the syntax for disabling entire rules for a tool.
12
14
  # commands:
13
15
  # install: // Optional. Command to run to install the tool.
14
16
  # prepare: // Optional. Command to run prior to the review phase. ex. 'bundle exec bundle-audit update'
@@ -25,25 +27,27 @@
25
27
  # example_one: value // - Reviewer is smart enough to handle single-letter (-f) and multi-letter (--format) flags.
26
28
  # example_two: value // - It's highly-recommended to use the longer-name format for flags when possible to serve as self-documentation.
27
29
 
28
- # This is an example for a YAML block for a command-line tool:
29
- #
30
- # tool-name-key:
31
- # disabled: true
32
- # name: Tool
33
- # description: A tool that finds issues and fixes code.
34
- # tags: [syntax, security]
35
- # links:
36
- # home: https://example.com
37
- # install: https://example.com/install
38
- # ignore_syntax: https://example.com/ignore
39
- # commands:
40
- # install: 'bundle install tool'
41
- # prepare: 'bundle exec tool update'
42
- # review: 'bundle exec tool'
43
- # format: 'bundle exec tool --format'
44
- # quiet_option: '--quiet'
45
- # max_exit_status: 1
46
- # env:
47
- # report: false
48
- # flags:
49
- # format: json
30
+ # In practice, a configuration block would look something like the block below.
31
+ tool-name-key:
32
+ disabled: true
33
+ name: Tool
34
+ description: A tool that finds issues and fixes code.
35
+ tags: [syntax, security]
36
+ links:
37
+ home: https://example.com
38
+ install: https://example.com/install
39
+ ignore_syntax: https://example.com/ignore
40
+ disable_syntax: https://example.com/disable
41
+ commands:
42
+ install: 'bundle install tool'
43
+ prepare: 'bundle exec tool update'
44
+ review: 'bundle exec tool'
45
+ format: 'bundle exec tool --format'
46
+ quiet_option: '--quiet'
47
+ max_exit_status: 1
48
+ files_flag: 'files'
49
+ files_separator: ','
50
+ env:
51
+ report: false
52
+ flags:
53
+ format: json
data/.reviewer.yml CHANGED
@@ -1,7 +1,7 @@
1
- bundler_audit:
2
- tags: [critical, dependencies, ruby, dev]
3
- name: Bundler Audit
1
+ bundle_audit:
2
+ name: Bundle Audit
4
3
  description: Review Gem Dependencies for Security Issues
4
+ tags: [critical, 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
@@ -13,13 +13,65 @@ bundler_audit:
13
13
 
14
14
  tests:
15
15
  name: Minitest
16
- description: Unit Tests
16
+ description: Unit Tests & Coverage
17
17
  tags: [ruby, tests, dev]
18
18
  links:
19
19
  home:
20
20
  commands:
21
21
  review: "bundle exec rake TESTOPTS='--seed=$SEED'"
22
22
  quiet_option: '--silent'
23
+ reports:
24
+ open_on_fail: true
25
+ local_file: coverage/index.html
26
+ local_uri: 'file:///Users/garrettdimon/Code/reviewer/coverage/index.html#_AllFiles'
27
+ env:
28
+ coverage: true
29
+
30
+ reek:
31
+ name: Reek
32
+ description: Examine Ruby Classes for Code Smells
33
+ tags: [ruby, quality, dev]
34
+ links:
35
+ home: https://github.com/troessner/reek
36
+ install: https://github.com/troessner/reek#quickstart
37
+ commands:
38
+ install: 'bundle exec gem install reek'
39
+ review: 'bundle exec reek'
40
+ flags:
41
+ color:
42
+ documentation:
43
+
44
+ flog:
45
+ disabled: true # Flog provides guidance and is generally run solo
46
+ name: Flog
47
+ description: Reports your most tortured ruby code in an easy to read pain report.
48
+ tags: [ruby, quality, dev]
49
+ links:
50
+ home: https://ruby.sadi.st/Flog.html
51
+ install: https://ruby.sadi.st/Flog.html
52
+ commands:
53
+ install: 'bundle exec gem install flog'
54
+ review: 'bundle exec flog -g lib'
55
+ flags:
56
+ threshold: 10 # Percentage. i.e. Show the most concerning 10% of results
57
+ group:
58
+ methods-only:
59
+
60
+ flay:
61
+ disabled: true # Flay provides guidance and is generally run solo
62
+ name: Flay
63
+ description: Review ruby code for structural similarities and refactoring opportunities.
64
+ tags: [ruby, quality, dev]
65
+ links:
66
+ home: https://ruby.sadi.st/Flay.html
67
+ install: https://ruby.sadi.st/Flay.html
68
+ commands:
69
+ install: 'bundle exec gem install flay'
70
+ review: 'bundle exec flay ./lib'
71
+ flags:
72
+ liberal:
73
+ summary:
74
+
23
75
 
24
76
  rubocop:
25
77
  name: Rubocop
@@ -37,9 +89,10 @@ rubocop:
37
89
  quiet_option: '--format q'
38
90
  files_flag: ''
39
91
  files_list_separator: ' '
92
+ flags:
93
+ color:
40
94
 
41
95
  inch:
42
- disabled: true # Inch provides guidance and is generally run solo
43
96
  tags: [docs, ruby, dev]
44
97
  name: Inch
45
98
  description: Review Ruby Documentation
data/.rubocop.yml CHANGED
@@ -1,5 +1,7 @@
1
1
  AllCops:
2
2
  NewCops: enable
3
+ UseCache: true
4
+ CacheRootDirectory: './'
3
5
  Exclude:
4
6
  - 'bin/**/*'
5
7
 
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.3
1
+ 2.5.9
data/CHANGELOG.md CHANGED
@@ -3,6 +3,20 @@
3
3
  - TODO: Improve and streamline installation
4
4
  - TODO: Add support for targeting specific files
5
5
 
6
+ ## [0.1.4] - 2021-07-08
7
+
8
+ On the surface, this release doesn't change much or provide drastically new functionality, but it begins to lay the foundation for something that could evolve in the long-term.
9
+
10
+ - Mostly refactoring to support the long-term vision
11
+ - Add Reek to dev dependencies
12
+ - Enable Inch in the default commands
13
+ - Reduce external dependencies
14
+ - Broaden official support Ruby 2.5.9, 2.6.8, 2.7.4, and 3.0.2
15
+ - Add more robust GitHub Actions integration
16
+ - Add Code Coverage via SimpleCov and set the bar at 100%
17
+ - Begin to expand documentation coverage
18
+ - Improve UX of results, timing, output, and error recovery guidance
19
+
6
20
  ## [0.1.3] - 2021-07-07
7
21
 
8
22
  The most significant update to how the core commands work and how the command-line arguments are handled. Most of the overall structure is starting to feel stable enough to begin documenting and adding comments.
data/Gemfile CHANGED
@@ -6,6 +6,3 @@ source 'https://rubygems.org'
6
6
  gemspec
7
7
 
8
8
  gem 'rake', '~> 13.0'
9
-
10
- gem 'minitest', '~> 5.14.4'
11
- gem 'minitest-color', '~> 0.0.2'
data/Gemfile.lock CHANGED
@@ -1,93 +1,118 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- reviewer (0.1.3)
5
- activesupport
4
+ reviewer (0.1.4)
6
5
  colorize
7
6
  slop
8
7
 
9
8
  GEM
10
9
  remote: https://rubygems.org/
11
10
  specs:
12
- activesupport (6.1.3.1)
13
- concurrent-ruby (~> 1.0, >= 1.0.2)
14
- i18n (>= 1.6, < 2)
15
- minitest (>= 5.1)
16
- tzinfo (~> 2.0)
17
- zeitwerk (~> 2.3)
18
11
  ast (2.4.2)
19
12
  bundler-audit (0.8.0)
20
13
  bundler (>= 1.2.0, < 3)
21
14
  thor (~> 1.0)
15
+ codecov (0.5.2)
16
+ simplecov (>= 0.15, < 0.22)
22
17
  coderay (1.1.3)
23
18
  colorize (0.8.1)
24
- concurrent-ruby (1.1.8)
25
- i18n (1.8.10)
26
- concurrent-ruby (~> 1.0)
19
+ dead_end (1.1.7)
20
+ docile (1.4.0)
21
+ erubis (2.7.0)
22
+ flay (2.12.1)
23
+ erubis (~> 2.7.0)
24
+ path_expander (~> 1.0)
25
+ ruby_parser (~> 3.0)
26
+ sexp_processor (~> 4.0)
27
+ flog (4.6.4)
28
+ path_expander (~> 1.0)
29
+ ruby_parser (~> 3.1, > 3.1.0)
30
+ sexp_processor (~> 4.8)
27
31
  inch (0.8.0)
28
32
  pry
29
33
  sparkr (>= 0.2.0)
30
34
  term-ansicolor
31
35
  yard (~> 0.9.12)
36
+ kwalify (0.7.2)
32
37
  method_source (1.0.0)
33
38
  minitest (5.14.4)
34
39
  minitest-color (0.0.2)
35
40
  minitest (~> 5)
36
41
  parallel (1.20.1)
37
- parser (3.0.1.0)
42
+ parser (3.0.2.0)
38
43
  ast (~> 2.4.1)
44
+ path_expander (1.1.0)
39
45
  pry (0.14.1)
40
46
  coderay (~> 1.1)
41
47
  method_source (~> 1.0)
48
+ psych (3.3.2)
42
49
  rainbow (3.0.0)
43
- rake (13.0.3)
50
+ rake (13.0.6)
51
+ reek (6.0.5)
52
+ kwalify (~> 0.7.0)
53
+ parser (~> 3.0.0)
54
+ psych (>= 3.1, < 5.0)
55
+ rainbow (>= 2.0, < 4.0)
44
56
  regexp_parser (2.1.1)
45
57
  rexml (3.2.5)
46
- rubocop (1.13.0)
58
+ rubocop (1.18.4)
47
59
  parallel (~> 1.10)
48
60
  parser (>= 3.0.0.0)
49
61
  rainbow (>= 2.2.2, < 4.0)
50
62
  regexp_parser (>= 1.8, < 3.0)
51
63
  rexml
52
- rubocop-ast (>= 1.2.0, < 2.0)
64
+ rubocop-ast (>= 1.8.0, < 2.0)
53
65
  ruby-progressbar (~> 1.7)
54
66
  unicode-display_width (>= 1.4.0, < 3.0)
55
- rubocop-ast (1.4.1)
56
- parser (>= 2.7.1.5)
57
- rubocop-minitest (0.11.1)
67
+ rubocop-ast (1.8.0)
68
+ parser (>= 3.0.1.1)
69
+ rubocop-minitest (0.14.0)
58
70
  rubocop (>= 0.90, < 2.0)
59
- rubocop-rake (0.5.1)
60
- rubocop
71
+ rubocop-rake (0.6.0)
72
+ rubocop (~> 1.0)
61
73
  ruby-progressbar (1.11.0)
62
- slop (4.8.2)
74
+ ruby_parser (3.16.0)
75
+ sexp_processor (~> 4.15, >= 4.15.1)
76
+ sexp_processor (4.15.3)
77
+ simplecov (0.21.2)
78
+ docile (~> 1.1)
79
+ simplecov-html (~> 0.11)
80
+ simplecov_json_formatter (~> 0.1)
81
+ simplecov-html (0.12.3)
82
+ simplecov_json_formatter (0.1.3)
83
+ slop (4.9.1)
63
84
  sparkr (0.4.1)
64
85
  sync (0.5.0)
65
86
  term-ansicolor (1.7.1)
66
87
  tins (~> 1.0)
67
88
  thor (1.1.0)
68
- tins (1.28.0)
89
+ tins (1.29.1)
69
90
  sync
70
- tzinfo (2.0.4)
71
- concurrent-ruby (~> 1.0)
72
91
  unicode-display_width (2.0.0)
73
92
  yard (0.9.26)
74
- zeitwerk (2.4.2)
75
93
 
76
94
  PLATFORMS
77
95
  ruby
78
- x86_64-darwin-19
96
+ x86_64-darwin-20
79
97
  x86_64-linux
80
98
 
81
99
  DEPENDENCIES
82
100
  bundler-audit
101
+ codecov
102
+ dead_end
103
+ flay
104
+ flog
83
105
  inch
84
- minitest (~> 5.14.4)
85
- minitest-color (~> 0.0.2)
106
+ minitest
107
+ minitest-color
108
+ psych (~> 3.3.2)
86
109
  rake (~> 13.0)
110
+ reek
87
111
  reviewer!
88
112
  rubocop
89
113
  rubocop-minitest
90
114
  rubocop-rake
115
+ simplecov
91
116
 
92
117
  BUNDLED WITH
93
- 2.2.16
118
+ 2.2.25
data/README.md CHANGED
@@ -1,58 +1,13 @@
1
- **Note:** As of May 4th, 2021, Reviewer is a work in progress and does not actually do anything just yet. Hopefully soon.
2
1
 
3
- # Reviewer
2
+ **Note:** As of August 4th, 2021, Reviewer is a work in progress. While it's working great reviewing its own code, it's not quite ready for wider usage.
4
3
 
5
- Reviewer reduces the friction of using automated tools for dependency audits, static analysis, linting, testing, and more by providing a standardized way to configure and run them in different contexts with less friction.
4
+ [![Gem Version](https://badge.fury.io/rb/reviewer.svg)](https://badge.fury.io/rb/reviewer) [![Ruby](https://github.com/garrettdimon/reviewer/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/garrettdimon/reviewer/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/garrettdimon/reviewer/branch/main/graph/badge.svg?token=UuXUlQAA2e)](https://codecov.io/gh/garrettdimon/reviewer)
6
5
 
7
- So, instead of...
8
- ```
9
- yarn audit --level moderate
10
- bundle exec bundle-audit check --no-update
11
- bundle exec rubocop --parallel
12
- bundle exec erblint --lint-all --enable-all-linters
13
- yarn stylelint .
14
- yarn eslint .
15
- bundle exec rake notes
16
- ```
6
+ # What is Reviewer?
17
7
 
18
- You run...
19
- ```
20
- rvw
21
- ```
8
+ *Reviewer reduces the friction of using multiple automated code review tools so you can use them more frequently and consistently.*
22
9
 
23
- But that's just the beginning. It also cleans up the output and lets easily you run subsets of commands for different contexts.
24
-
25
- For more detailed information, take a look at the [Overview](https://github.com/garrettdimon/reviewer/wiki/Overview) and [Usage](https://github.com/garrettdimon/reviewer/wiki/Usage) pages in the wiki.
26
-
27
- ## Installation
28
-
29
- Add this line to your application's Gemfile:
30
-
31
- ```ruby
32
- gem 'reviewer'
33
- ```
34
-
35
- And then execute:
36
-
37
- $ bundle install
38
-
39
- Or install it yourself as:
40
-
41
- $ gem install reviewer
42
-
43
- ## Usage
44
-
45
- TODO: Write usage instructions here
46
-
47
- ## Development
48
-
49
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
50
-
51
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
52
-
53
- ## Contributing
54
-
55
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/reviewer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/reviewer/blob/master/CODE_OF_CONDUCT.md).
10
+ For more detailed information, the [Wiki](https://github.com/garrettdimon/reviewer/wiki) is the best place to start. Or if you'd like the full story, you can go straight to the [Overview](https://github.com/garrettdimon/reviewer/wiki/Overview).
56
11
 
57
12
  ## License
58
13