File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed
Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,9 @@ all_on_start: true # Check all files at Guard startup.
6161cli: ' --rails' # Pass arbitrary RuboCop CLI arguments.
6262 # An array or string is acceptable.
6363 # default: nil
64+ cmd: ' ./bin/rubocop' # Pass custom cmd to run rubocop.
65+ # default: rubocop
66+
6467hide_stdout: false # Do not display console output (in case outputting to file).
6568 # default: false
6669keep_failed: true # Keep failed files until they pass.
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ def run(paths = [])
2828 end
2929
3030 def build_command ( paths )
31- command = [ 'rubocop' ]
31+ command = [ @options [ :cmd ] || 'rubocop' ]
3232
3333 if should_add_default_formatter_for_console?
3434 command . concat ( %w[ --format progress ] ) # Keep default formatter for console.
Original file line number Diff line number Diff line change 109109 let ( :options ) { { cli : %w[ --debug --rails ] } }
110110 let ( :paths ) { %w[ file1.rb file2.rb ] }
111111
112+ describe ':cmd option' do
113+ context 'when set' do
114+ let ( :options ) { { cmd : 'bin/rubocop' } }
115+
116+ it 'uses the supplied :cmd' do
117+ expect ( build_command [ 0 ] ) . to eq ( 'bin/rubocop' )
118+ end
119+ end
120+
121+ context 'when not set' do
122+ it 'uses the default command' do
123+ expect ( build_command [ 0 ] ) . to eq ( 'rubocop' )
124+ end
125+ end
126+ end
127+
112128 context 'when :hide_stdout is not set' do
113129 context 'and :cli option includes formatter for console' do
114130 before { options [ :cli ] = %w[ --format simple ] }
You can’t perform that action at this time.
0 commit comments