Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Remove standard output from with_rubygems #7122

Merged
1 commit merged into from
Apr 23, 2019
Merged

Conversation

deivid-rodriguez
Copy link
Member

This PR might be very specific to my setup, but it would certainly help me.

What was the end-user problem that led to this PR?

The problem was that sometimes I don't find out early about rubocop issues, so I have to push extra commits to fix them, and that means time and CI resources.

What was your diagnosis of the problem?

My diagnosis was that:

  • I run rubocop automatically on save from `vim using ale.
  • I set ENV["RGV"] = master, so that I always run the latest rubygems.

Because of setting ENV["RGV"], the with_rubygems script is run everytime a binstub is loaded (including rubocop). This script prints some git information to the standard output. Since ALE expects a very specific output from rubocop, the fact that the with_rubygems script prints stuff to the standard output means that ALE no longer works, and I don't get to early fix style issues.

What is your fix for the problem, implemented in this PR?

My fix is to make the with_rubygems script be silent.

Why did you choose this fix out of the possible options?

I could've removed loading the with_rubygems script from the rubocop binstub, but I chose this fix because other subcommands in the script already seemed to try to be silent, like the --quiet flag passed to git checkout.

@deivid-rodriguez
Copy link
Member Author

Unless anyone has a very strong opinion here, I'd like to get this in... Otherwise I feel I need to choose between setting RGV=master or having a working linter configuration, and I'd like to have both 😅.

@deivid-rodriguez
Copy link
Member Author

$ bin/rubocop
Fetching origin
Checked out rubygems 'master' at b2ec76a447f3670b115c1dd1267869427d968b7b
Inspecting 368 files
...........................C....................................................................................................................................................................................................................................................................................................................................................

Offenses:

spec/bundler/env_spec.rb:57:7: C: Layout/AccessModifierIndentation: Outdent access modifiers like private.
      private
      ^^^^^^^

368 files inspected, 1 offense detected

The first two lines of the output is what I'm removing here, so that tools relying on rubocop's output having a specific shape don't get tripped up.

@deivid-rodriguez
Copy link
Member Author

Doing this since it's handy for me and there's no strong opposition.

@bundlerbot r+

ghost pushed a commit that referenced this pull request Apr 23, 2019
7122: Remove standard output from `with_rubygems` r=deivid-rodriguez a=deivid-rodriguez

This PR might be very specific to my setup, but it would certainly help me.

### What was the end-user problem that led to this PR?

The problem was that sometimes I don't find out early about rubocop issues, so I have to push extra commits to fix them, and that means time and CI resources.

### What was your diagnosis of the problem?

My diagnosis was that:

* I run rubocop automatically on save from `vim using [ale](https://github.com/w0rp/ale).
* I set `ENV["RGV"] = master`, so that I always run the latest rubygems.

Because of setting `ENV["RGV"]`, the `with_rubygems` script is run everytime a binstub is loaded (including `rubocop`). This script prints some git information to the standard output. Since ALE expects a very specific output from `rubocop`, the fact that the `with_rubygems` script prints stuff to the standard output means that ALE no longer works, and I don't get to early fix style issues.

### What is your fix for the problem, implemented in this PR?

My fix is to make the `with_rubygems` script be silent.

### Why did you choose this fix out of the possible options?

I could've removed loading the `with_rubygems` script from the `rubocop` binstub, but I chose this fix because other subcommands in the script already seemed to try to be silent, like the `--quiet` flag passed to `git checkout`.


Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
@ghost
Copy link

ghost commented Apr 23, 2019

Build succeeded

@ghost ghost merged commit a4afc44 into master Apr 23, 2019
@ghost ghost deleted the remove_output_from_with_rubygems branch April 23, 2019 07:07
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant