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
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Reviewer
4
- class Output
5
- # Provides a structure interface for the results of running a command
6
- class Scrubber
7
- # A lot of tools are run via rake which inclues some unhelpful drive when there's a non-zero
8
- # exit status. This is what it starts with so Reviewer can recognize and remove it.
9
- RAKE_ABORTED_TEXT = <<~DRIVEL
10
- rake aborted!
11
- DRIVEL
12
-
13
- attr_accessor :raw
14
-
15
- # Creates a scrubber instance for the provided text content
16
- # @param raw [String] the text to be scrubbed of unhelpful content
17
- #
18
- # @return [self]
19
- def initialize(raw)
20
- @raw = raw || ''
21
- end
22
-
23
- def clean
24
- rake_aborted_text? ? preceding_text : raw
25
- end
26
-
27
- private
28
-
29
- def rake_aborted_text?
30
- raw.include?(RAKE_ABORTED_TEXT)
31
- end
32
-
33
- # Removes any unhelpful rake exit status details from $stderr. Reviewew uses `exit` when a
34
- # command fails so that the resulting command-line exit status can be interpreted correctly
35
- # in CI and similar environments. Without that exit status, those environments wouldn't
36
- # recognize the failure. As a result, Rake almost always adds noise that begins with the value
37
- # in RAKE_EXIT_DRIVEL when `exit` is called. Frequently, that RAKE_EXIT_DRIVEL is the only
38
- # information in $stderr, and it's not helpful in the human-readable output, but other times
39
- # when a valid exception occurs, there's useful error information preceding RAKE_EXIT_DRIVEL.
40
- # So this ensures that the unhelpful part is always removed so the output is cluttered with
41
- # red herrings since the command is designed to fail with an exit status of 1 under normal
42
- # operation with tool failures.
43
- def preceding_text
44
- raw.split(RAKE_ABORTED_TEXT).first
45
- end
46
- end
47
- end
48
- end
@@ -1,85 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Reviewer
4
- class Output
5
- # Simple class for streamlining the output of 'tokens' representing a style and content
6
- #
7
- # @author [garrettdimon]
8
- #
9
- class Token
10
- ESC = "\e["
11
-
12
- attr_accessor :style, :content
13
-
14
- def initialize(style, content)
15
- @style = style
16
- @content = content
17
- end
18
-
19
- def to_s
20
- [
21
- style_string,
22
- content,
23
- reset_string
24
- ].join
25
- end
26
-
27
- private
28
-
29
- def style_string
30
- "#{ESC}#{weight};#{color}m"
31
- end
32
-
33
- def reset_string
34
- "#{ESC}0m"
35
- end
36
-
37
- def weight_key
38
- style_components[0]
39
- end
40
-
41
- def color_key
42
- style_components[1]
43
- end
44
-
45
- def weight
46
- {
47
- default: 0,
48
- bold: 1,
49
- light: 2,
50
- italic: 3
51
- }.fetch(weight_key)
52
- end
53
-
54
- def color
55
- {
56
- black: 30,
57
- red: 31,
58
- green: 32,
59
- yellow: 33,
60
- blue: 34,
61
- magenta: 35,
62
- cyan: 36,
63
- gray: 37,
64
- default: 39
65
- }.fetch(color_key)
66
- end
67
-
68
- def style_components
69
- {
70
- success_bold: %i[bold green],
71
- success: %i[default green],
72
- success_light: %i[light green],
73
- error: %i[bold red],
74
- failure: %i[default red],
75
- warning: %i[bold yellow],
76
- warning_light: %i[light yellow],
77
- source: %i[italic default],
78
- bold: %i[default default],
79
- default: %i[default default],
80
- muted: %i[light gray]
81
- }.fetch(style)
82
- end
83
- end
84
- end
85
- end