question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Doesn't work without one or multiple restarts

See original GitHub issue

I know there have been timing issues which prevented SublimeLinter from running with correct environment variables and paths every now and then. I thought this was fixed for good with a recent Sublime Text update and a new API callback. But for a few weeks I have the following problem:

Most times linting doesn’t work for me without restarts. I get (erred) in the status bar at the bottom for rubocop and reek. Usually I restart Sublime once or twice and it works the way one would expect.

Since this happens for both rubocop and reek the issue doesn’t seem to be linter specific.

Here are 2 logs, the first one shows the error occuring, the other one shows how everything works after a restart of Sublime.

Log 1 👎:

SublimeLinter: log_handler.py:74: Logging installed; log level INFO
SublimeLinter: sublime_linter.py:50: debug mode: on
SublimeLinter: sublime_linter.py:51: version: 4.7.2
SublimeLinter: sublime_linter.py:250: Delay buffer 26 for 0.0s
SublimeLinter: linter.py:887: Checking lint mode background vs lint reason on_load
SublimeLinter: linter.py:887: Checking lint mode background vs lint reason on_load
SublimeLinter: #1 linter.py:907: 'reek' is linting 'shop_gallery_controller.rb'
SublimeLinter: #1 util.py:142: PATH:
    /usr/bin
    /bin
    /usr/sbin
    /sbin
SublimeLinter: #2 linter.py:907: 'rubocop' is linting 'shop_gallery_controller.rb'
SublimeLinter: #1 linter.py:1197: Automatically appending the filename to cmd has been deprecated. Use $file, $temp_file or $file_on_disk instead.
SublimeLinter: #2 linter.py:1263: Running ...

  /Users/Enno/Sites/pictrs/master/pictrs  (working dir)
  $ cat app/controllers/shop_gallery_controller.rb | /usr/bin/ruby -S rubocop --format emacs --force-exclusion --stdin /Users/Enno/Sites/pictrs/master/pictrs/app/controllers/shop_gallery_controller.rb

SublimeLinter: #1 linter.py:1263: Running ...

  /Users/Enno/Sites/pictrs/master/pictrs  (working dir)
  $ /usr/bin/ruby -S reek /var/folders/l2/j37t2cjs5ssgcgsrk1xyt1x40000gn/T/tmp3tvsad.rb

SublimeLinter: #2 linter.py:589: WARNING: rubocop output:
/usr/bin/ruby: No such file or directory -- rubocop (LoadError)

SublimeLinter: #2 linter.py:591: Note: above warning will become an error in the future. Implement `on_stderr` if you think this is wrong.
SublimeLinter: #1 linter.py:589: WARNING: reek output:
/usr/bin/ruby: No such file or directory -- reek (LoadError)

SublimeLinter: #1 linter.py:591: Note: above warning will become an error in the future. Implement `on_stderr` if you think this is wrong.
SublimeLinter: sublime_linter.py:444: Linting buffer 26 took 0.08s
Emmet: No need to update PyV8
Package Control: Skipping automatic upgrade, last run at 2018-08-14 10:27:54, next run at 2018-08-14 11:27:54 or after

Log 2 👍:

SublimeLinter: log_handler.py:74: Logging installed; log level INFO
SublimeLinter: sublime_linter.py:50: debug mode: on
SublimeLinter: sublime_linter.py:51: version: 4.7.2
Load settings: Open-Include
SublimeLinter: sublime_linter.py:250: Delay buffer 26 for 0.0s
SublimeLinter: linter.py:887: Checking lint mode background vs lint reason on_load
SublimeLinter: linter.py:887: Checking lint mode background vs lint reason on_load
SublimeLinter: #1 linter.py:907: 'reek' is linting 'shop_gallery_controller.rb'
SublimeLinter: #1 util.py:142: PATH:
    /Users/Enno/.rvm/gems/ruby-2.2.4/bin
    /Users/Enno/.rvm/gems/ruby-2.2.4@global/bin
    /Users/Enno/.rvm/rubies/ruby-2.2.4/bin
    /usr/local/bin
    /usr/bin
    /bin
    /usr/sbin
    /sbin
    /Applications/VMware Fusion.app/Contents/Public
    /Users/Enno/.rvm/bin
SublimeLinter: #2 linter.py:907: 'rubocop' is linting 'shop_gallery_controller.rb'
SublimeLinter: #1 linter.py:1197: Automatically appending the filename to cmd has been deprecated. Use $file, $temp_file or $file_on_disk instead.
SublimeLinter: #2 linter.py:1263: Running ...

  /Users/Enno/Sites/pictrs/master/pictrs  (working dir)
  $ cat app/controllers/shop_gallery_controller.rb | /Users/Enno/.rvm/bin/rvm-auto-ruby -S rubocop --format emacs --force-exclusion --stdin /Users/Enno/Sites/pictrs/master/pictrs/app/controllers/shop_gallery_controller.rb

SublimeLinter: #1 linter.py:1263: Running ...

  /Users/Enno/Sites/pictrs/master/pictrs  (working dir)
  $ /Users/Enno/.rvm/bin/rvm-auto-ruby -S reek /var/folders/l2/j37t2cjs5ssgcgsrk1xyt1x40000gn/T/tmp7n9l9s.rb

Emmet: No need to update PyV8
Package Control: Skipping automatic upgrade, last run at 2018-08-14 10:27:54, next run at 2018-08-14 11:27:54 or after
SublimeLinter: #2 linter.py:955: rubocop output:
    /Users/Enno/Sites/pictrs/master/pictrs/app/controllers/shop_gallery_controller.rb:1:1: C: Unnecessary utf-8 encoding comment.
    ...
    ...
    ...
    /Users/Enno/Sites/pictrs/master/pictrs/app/controllers/shop_gallery_controller.rb:2115:11: C: Avoid more than 3 levels of block nesting.
SublimeLinter: #1 linter.py:955: reek output:
    /var/folders/l2/j37t2cjs5ssgcgsrk1xyt1x40000gn/T/tmp7n9l9s.rb -- 20 warnings:
      [1372, 1372, 1374, 1376]:DuplicateMethodCall: ShopGalleryController#_add_pw_to_session calls 'album.shop' 4 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
      ...
      ...
      ...
      [1253]:TooManyStatements: ShopGalleryController#redaktion_register has approx 14 statements [https://github.com/troessner/reek/blob/master/docs/Too-Many-Statements.md]
SublimeLinter: #1 linter.py:995: reek: No match for line: '/var/folders/l2/j37t2cjs5ssgcgsrk1xyt1x40000gn/T/tmp7n9l9s.rb -- 20 warnings:'
SublimeLinter: sublime_linter.py:444: Linting buffer 26 took 7.00s

System information:

  • OSX 10.12.6
  • Sublime Text 3.1.1 Build 3176
  • SublimeLinter v4.7.2

I’m happy to assist if you need more information.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
LeEnnocommented, Aug 14, 2018

Thx for your response. I thought I read a comment from Sublime’s creator adding some callback and everyone wildly celebrating that and referencing the corresponding issue. Dream or memory? 🤔 Never mind.

You’re correct, I’m using rvm. The current situation sucks but at least we have a fix, so thank you.

I don’t know if this is expected but:

  1. I had to make sure GEM_PATH was set correctly.
  2. The executable needs to be rvm-auto-ruby, no matter what linter. So my config looks like this right now (exactly the same for all linters):
{
  "linters": {
      "hamllint": {
        "env": {"GEM_PATH":"/Users/Enno/.rvm/gems/ruby-2.3.1"},
        "executable": "/Users/Enno/.rvm/bin/rvm-auto-ruby"
      },
      "rubocop": {
        "env": {"GEM_PATH":"/Users/Enno/.rvm/gems/ruby-2.3.1"},
        "executable": "/Users/Enno/.rvm/bin/rvm-auto-ruby"
      },
      "reek": {
        "env": {"GEM_PATH":"/Users/Enno/.rvm/gems/ruby-2.3.1"},
        "executable": "/Users/Enno/.rvm/bin/rvm-auto-ruby"
      }
  }
}

Is that the way it’s intended? Or did I stumble upon another wird behavior?

1reaction
LeEnnocommented, Aug 22, 2018

This seems to work on every start now:

"env": {
  "GEM_PATH": "/Users/Enno/.rvm/gems/ruby-2.3.1:/Users/Enno/.rvm/gems/ruby-2.3.1@global",
  "PATH": "/Users/Enno/.rvm/gems/ruby-2.3.1/bin:/Users/Enno/.rvm/gems/ruby-2.3.1@global/bin:/Users/Enno/.rvm/rubies/ruby-2.3.1/bin:/Users/Enno/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
},
"executable": "/Users/Enno/.rvm/rubies/ruby-2.3.1/bin/ruby"
Read more comments on GitHub >

github_iconTop Results From Across the Web

My computer does not start unless I restart it multiple times
If you are encountering this issue after installing new hardware on a computer, it is also possible that the power supply is no...
Read more >
Computer not booting even after several restarts
I tried to reboot several times and only after pressing Windows tab on key board did the screen light up and show the...
Read more >
No signal on first two restarts but always works on the third
1 Answer · 1) Ensure your PC is off. · 2) Press the power button to turn on your PC, and then hold...
Read more >
10 ways to fix a computer that keeps restarting - The Spectrum
Check for faulty power supply by starting your device with another power source. If it works perfectly without restarting, then there is an ......
Read more >
How to Fix Computer that Keeps Restarting? PC Rebooting ...
In this video, you will see solutions for the continuous rebooting issue. Is your computer keeps restarting ? It could be due to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found