Class: DiffCop
- Inherits:
-
Object
- Object
- DiffCop
- Defined in:
- lib/diff_cop.rb,
lib/diff_cop/version.rb
Constant Summary collapse
- VERSION =
'0.1.0'.freeze
Instance Attribute Summary collapse
-
#lint_results ⇒ Object
Returns the value of attribute lint_results.
-
#patches ⇒ Object
Returns the value of attribute patches.
-
#raw_lint_results ⇒ Object
Returns the value of attribute raw_lint_results.
Instance Method Summary collapse
-
#print! ⇒ Object
take the generated lint results and print the relevant offenses to stdout (CLI).
-
#start ⇒ Object
generate patches, run the linter and filter to only relevant results.
Instance Attribute Details
#lint_results ⇒ Object
Returns the value of attribute lint_results.
6 7 8 |
# File 'lib/diff_cop.rb', line 6 def lint_results @lint_results end |
#patches ⇒ Object
Returns the value of attribute patches.
6 7 8 |
# File 'lib/diff_cop.rb', line 6 def patches @patches end |
#raw_lint_results ⇒ Object
Returns the value of attribute raw_lint_results.
6 7 8 |
# File 'lib/diff_cop.rb', line 6 def raw_lint_results @raw_lint_results end |
Instance Method Details
#print! ⇒ Object
take the generated lint results and print the relevant offenses to stdout (CLI)
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/diff_cop.rb', line 22 def print! fail 'must run #start before printing' unless @lint_results if @lint_results.empty? puts "\nYou're good! Rubocop has no offenses to report.\n" return true end puts <<-MSG DiffCop Offenses: ===================== #{.join("\n\n")} MSG false end |
#start ⇒ Object
generate patches, run the linter and filter to only relevant results
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/diff_cop.rb', line 9 def start @patches = generate_patches.group_by(&:file) @raw_lint_results = parsed_raw_lint_results(patches.keys) @lint_results = filter_raw_lint_results( raw_lint_results['files'] || [], patches ) self end |