Closed aeberlin closed 9 years ago
Also, here are the versions I'm using. I will test later to see if this occurs with previous versions:
bundler (1.7.0)
cucumber (1.3.17)
guard (2.6.1)
guard-cucumber (1.4.1)
guard-rspec (4.3.1)
guard-rubocop (1.1.0)
guard-shell (0.6.1)
guard-shotgun (0.4.0)
rake (10.1.0)
rspec (3.1.0, 3.0.0)
rspec-core (3.1.3, 3.1.2, 3.0.4)
rspec-expectations (3.1.1, 3.1.0, 3.0.4)
rspec-mocks (3.1.0, 3.0.4)
rspec-support (3.1.0, 3.0.4)
rubocop (0.26.1, 0.26.0, 0.25.0)
terminal-notifier-guard (1.5.3)
Looking through the source, I believe the problem lies here.
# lib/guard/rubocop/runner.rb
def include_formatter_for_console?(cli_args)
index = -1
formatter_args = cli_args.group_by do |arg|
index += 1 if arg == '--format' || arg.start_with?('-f')
index
end
formatter_args.delete(-1)
formatter_args.each_value.any? do |args|
args.none? { |a| a == '--out' || a.start_with?('-o') }
end
end
The way the code is written, it expects that you will always want console output if an additional formatter and output source is specified, but that's not always the case. Please see the pull request in Issue #15.
:+1:
:+1:
Are you active?
Closing as #15 has been merged.
Hi,
I recently discovered a bug in the runner which results in output being piped to
$stdout
even if the--out
option is specified in thecli
. Here are the steps to replicate:git clone
git@github.com:aeberlin/guard_example.git
RUBOCOP_OPTS
inGuardfile
with the text below:rake
and allow to load, thentouch
lib/guard_example/foo.rb
Notice how output for the default formatter is redirected to
$stdout
in addition to the results forProgressFormatter
being written totmp/progress_results.log
.For comparison, run a few of the statements below from
bash
and review the results.As you can see, the default formatter is properly omitted in the first example and then properly retained in the second example, with the specified formatter results always written to the designated path.
If you try to forcibly redirect output for the default formatter to another file, using the configuration below, you can also see that the results are still piped to
$stdout
.Any thoughts?
Thanks, cheers!