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.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/guard/rubocop.rb', line 14 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.
12 13 14 |
# File 'lib/guard/rubocop.rb', line 12 def failed_paths @failed_paths end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
12 13 14 |
# File 'lib/guard/rubocop.rb', line 12 def @options end |
Instance Method Details
#reload ⇒ Object
45 46 47 |
# File 'lib/guard/rubocop.rb', line 45 def reload @failed_paths = [] end |
#run_all ⇒ Object
32 33 34 35 |
# File 'lib/guard/rubocop.rb', line 32 def run_all UI.info 'Inspecting Ruby code style of all files' inspect_with_rubocop end |
#run_on_additions(paths) ⇒ Object
37 38 39 |
# File 'lib/guard/rubocop.rb', line 37 def run_on_additions(paths) run_partially(paths) end |
#run_on_modifications(paths) ⇒ Object
41 42 43 |
# File 'lib/guard/rubocop.rb', line 41 def run_on_modifications(paths) run_partially(paths) end |
#start ⇒ Object
28 29 30 |
# File 'lib/guard/rubocop.rb', line 28 def start run_all if @options[:all_on_start] end |