Class: CI::Syntax::Tool::Format::Progress
- Defined in:
- lib/ci-syntax-tool/format/progress.rb
Overview
CI::Syntax::Tool::Format::Progress
Prints a dot for each
API you need if you want to add a format.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#file_finished(file_result) ⇒ Object
Called once at the end of the check on a file.
-
#initialize(io, args) ⇒ Progress
constructor
A new instance of Progress.
-
#lang_finished(lang_result) ⇒ Object
Invoked after all files are inspected, or interrupted by user.
- #lang_started(lang_result) ⇒ Object
Methods inherited from Base
descendant_classes, #file_started, #overall_finished, #overall_started
Constructor Details
#initialize(io, args) ⇒ Progress
Returns a new instance of Progress.
10 11 12 |
# File 'lib/ci-syntax-tool/format/progress.rb', line 10 def initialize(io, args) super end |
Instance Method Details
#file_finished(file_result) ⇒ Object
Called once at the end of the check on a file.
19 20 21 22 23 24 25 26 27 |
# File 'lib/ci-syntax-tool/format/progress.rb', line 19 def file_finished(file_result) if file_result.error_count > 0 out.print 'x' elsif file_result.warning_count > 0 out.print '*' else out.print '.' end end |
#lang_finished(lang_result) ⇒ Object
Invoked after all files are inspected, or interrupted by user.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/ci-syntax-tool/format/progress.rb', line 30 def lang_finished(lang_result) out.puts if lang_result.warning_count > 0 out.puts 'Files with warnings:' lang_result.warning_file_results.each do |fr| puts ' ' + fr.path fr.warnings.each do |w| puts ' ' + (w.line_number.to_s || '?') + ':' + (w.character.to_s || '?') + ':' + w. end end end if lang_result.error_count > 0 out.puts 'Files with errors:' lang_result.error_file_results.each do |fr| puts ' ' + fr.path fr.errors.each do |e| puts ' Line ' + (e.line_number.to_s || '?') + ': Col ' + (e.character.to_s || '?') + ':' + e. end end end end |
#lang_started(lang_result) ⇒ Object
14 15 16 |
# File 'lib/ci-syntax-tool/format/progress.rb', line 14 def lang_started(lang_result) out.puts "Starting syntax scan for #{lang_result.language_name}..." end |