Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Avoid opening error popups when rubocop is not found #339

Closed
mdesantis opened this issue Jun 13, 2019 · 14 comments
Closed

Avoid opening error popups when rubocop is not found #339

mdesantis opened this issue Jun 13, 2019 · 14 comments
Labels

Comments

@mdesantis
Copy link

mdesantis commented Jun 13, 2019

Hello,

I set the Rubocop command to bundle exec rubocop, and I often use bundle open <some_gem> in order to inspect gems. The problem is that when I click around gems files rubocop command not found exceptions keep popping up, and they are pretty annoying. I'd love some configuration like report with console.log on rubocop command not found instead of UI popups, since I don't really care about that, I just know that in the projects where I need linter-rubocop if linter-rubocop doesn't work is because bundle exec rubocop fails. What do you think about that?

@Arcanemagus
Copy link
Member

Personally I'm strongly against this, how is the package supposed to tell the difference between when you simply haven't setup the environment correctly, or when you are operating in a purposely broken environment?

I'd recommend simply running Linter: Toggle Active Editor to temporarily disable running on the file when you are working in this purposely broken environment. However... I don't use this provider myself so I'll leave it up to @AtomLinter/linter-rubocop to decided the best course of action 😉.

@mdesantis
Copy link
Author

mdesantis commented Jun 14, 2019

@Arcanemagus well, you don't expect any UI extension to spam popups for every file you click and every line you edit, do you?

I'm not saying that the error should be discarded, I'm saying that could be reported without blowing the UI, or at least that an option for that would be appreciated

(Actually I suggested to silently fail but as @Arcanemagus noticed it's probably too much brutal, I'm just removing that in favour of shell reporting)

@mdesantis mdesantis changed the title Silently fail when rubocop is not found Avoid opening error popups when rubocop is not found Jun 14, 2019
@vzamanillo
Copy link
Contributor

Why not to remove the .rubocop.yml file and check the Disable when no .rubocop.yml config file is found configuration option?

@mdesantis
Copy link
Author

mdesantis commented Jun 18, 2019

Because they are gems and they come with .rubocop.yml. You could say "but gem releasers should keep that file out of the gem", but unfortunately it isn't very common.

@vzamanillo
Copy link
Contributor

Let me understand your environment setup, What is the purpose of setting bundle exec rubocop as Rubocop command? are you using rvm or rbenv? Are you running Atom from the command line with a specific gemset previously loaded?

@mdesantis
Copy link
Author

mdesantis commented Jun 20, 2019

@vzamanillo thank you for your effort.

What is the purpose of setting bundle exec rubocop as Rubocop command?

bundle exec rubocop is set because I work on many projects and there is a different version of Rubocop for each project, so I can't assume that the latest Rubocop version installed works (I already had cases where different Rubocop versions produced different results).

are you using rvm or rbenv?

I use asdf.

Are you running Atom from the command line with a specific gemset previously loaded?

Yes, I often run bundle open some_gem in order to inspect gems and even edit them. bundle open some_gem opens Atom because I have the following env var set: EDITOR=/usr/bin/atom.

@vzamanillo
Copy link
Contributor

@vzamanillo thank you for your effort.

You are welcome

bundle exec rubocop is set because I work on many projects and there is a different version of Rubocop for each project, so I can't assume that the latest Rubocop version installed works (I already had cases where different Rubocop versions produced different results).

That is the main problem, this linter is not prepared to do that (#21, #283), in fact, assumes that you are working with the same and latest Rubocop for linting all your projects.

I use asdf.

I didn't ear about asdf, thank you for the info.

Yes, I often run bundle open some_gem in order to inspect gems and even edit them. bundle open some_gem opens Atom because I have the following env var set: EDITOR=/usr/bin/atom.

Will not installing rubocop in your active gemset solve the problem?

I perfectly understand your proposal because the popup is an infinite spam, but the inclusion of a configuration option to report to console does not solve the real problem, is a temporal solution.

Let me think about other possible solutions.

@maschwenk
Copy link
Contributor

Maybe the answer is looking at prior art. There are multitudes of Rubocop plugins we could check out the source for?

@mdesantis
Copy link
Author

this linter is not prepared to do that (#21, #283), in fact, assumes that you are working with the same and latest Rubocop for linting all your projects

I must say that using bundle exec rubocop this is the only issue I've encountered so far

Will not installing rubocop in your active gemset solve the problem?

Well, I don't know what is an active gemset. Do you mean running bundle in the gem folder?

@vzamanillo
Copy link
Contributor

Well, I don't know what is an active gemset. Do you mean running bundle in the gem folder?

Yes.

@mdesantis
Copy link
Author

I didn't try but there's a faster workaround: delete the .rubocop.yml inside the gem folder

@mdesantis
Copy link
Author

What about emulating linter-eslint behaviour? it reports the error in the Linter messages below:

Schermata del 2019-06-21 15-43-58

In this way the user gets the error without getting spammed, and everyone wins

@Arcanemagus
Copy link
Member

I'd completely forgotten about that solution 🤦‍♂, thanks for bringing it up!

@vzamanillo
Copy link
Contributor

What about emulating linter-eslint behaviour? it reports the error in the Linter messages below:

Schermata del 2019-06-21 15-43-58

In this way the user gets the error without getting spammed, and everyone wins

I am working on this.

vzamanillo added a commit to vzamanillo/linter-rubocop that referenced this issue Jun 21, 2019
forward non timeout execution errors to linter
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants