Class: Guard::RuboCop
- Inherits:
-
Plugin
- Object
- Plugin
- Guard::RuboCop
- Defined in:
- lib/guard/rubocop.rb,
lib/guard/rubocop/runner.rb
Overview
This class gets API calls from guard
and runs rubocop
command via Runner.
An instance of this class stays alive in a guard
command session.
Defined Under Namespace
Classes: Runner
Instance Attribute Summary collapse
-
#failed_paths ⇒ Object
readonly
Returns the value of attribute failed_paths.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ RuboCop
constructor
A new instance of RuboCop.
- #reload ⇒ Object
- #run_all ⇒ Object
- #run_on_additions(paths) ⇒ Object
- #run_on_modifications(paths) ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ RuboCop
Returns a new instance of RuboCop.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/guard/rubocop.rb', line 12 def initialize( = {}) super @options = { all_on_start: true, keep_failed: true, notification: :failed, cli: nil, hide_stdout: false }.merge() @failed_paths = [] end |
Instance Attribute Details
#failed_paths ⇒ Object (readonly)
Returns the value of attribute failed_paths.
10 11 12 |
# File 'lib/guard/rubocop.rb', line 10 def failed_paths @failed_paths end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/guard/rubocop.rb', line 10 def @options end |
Instance Method Details
#reload ⇒ Object
43 44 45 |
# File 'lib/guard/rubocop.rb', line 43 def reload @failed_paths = [] end |
#run_all ⇒ Object
30 31 32 33 |
# File 'lib/guard/rubocop.rb', line 30 def run_all UI.info 'Inspecting Ruby code style of all files' inspect_with_rubocop end |
#run_on_additions(paths) ⇒ Object
35 36 37 |
# File 'lib/guard/rubocop.rb', line 35 def run_on_additions(paths) run_partially(paths) end |
#run_on_modifications(paths) ⇒ Object
39 40 41 |
# File 'lib/guard/rubocop.rb', line 39 def run_on_modifications(paths) run_partially(paths) end |
#start ⇒ Object
26 27 28 |
# File 'lib/guard/rubocop.rb', line 26 def start run_all if @options[:all_on_start] end |