Module: Undercover::CLI
- Defined in:
- lib/undercover/cli.rb
Constant Summary collapse
- WARNINGS_TO_S =
TODO: Report calls >parser< for each file instead of traversing the whole project at first!
{ stale_coverage: Rainbow('🚨 WARNING: Coverage data is older than your ' \ 'latest changes and results might be incomplete. ' \ 'Re-run tests to update').yellow, no_changes: Rainbow('✅ No reportable changes').green }.freeze
Class Method Summary collapse
- .changeset(opts) ⇒ Object
- .run(args) ⇒ Object
-
.run_report(opts) ⇒ Object
rubocop:enable.
- .syntax_version(version) ⇒ Object
Class Method Details
.changeset(opts) ⇒ Object
45 46 47 48 |
# File 'lib/undercover/cli.rb', line 45 def self.changeset(opts) git_dir = File.join(opts.path, opts.git_dir) Undercover::Changeset.new(git_dir, opts.compare) end |
.run(args) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/undercover/cli.rb', line 17 def self.run(args) opts = Undercover::Options.new.parse(args) syntax_version(opts.syntax_version) run_report(opts) end |
.run_report(opts) ⇒ Object
rubocop:enable
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/undercover/cli.rb', line 25 def self.run_report(opts) report = Undercover::Report.new(changeset(opts), opts).build error = report.validate(opts.lcov) if error puts(WARNINGS_TO_S[error]) return 0 if error == :no_changes end flagged = report.flagged_results puts Undercover::Formatter.new(flagged) flagged.any? ? 1 : 0 end |
.syntax_version(version) ⇒ Object
39 40 41 42 43 |
# File 'lib/undercover/cli.rb', line 39 def self.syntax_version(version) return unless version Imagen.parser_version = version end |