AtomLinter / linter-haml

Atom linter plugin for HAML, using haml-lint
4 stars 8 forks source link

parser warning breaks linter-haml #117

Closed goranovs closed 5 years ago

goranovs commented 8 years ago

For some reason linter-haml is not working when this warning is there. It is a warning not an error. haml-lint its working in iTerm (same warning there).

screen shot 2016-10-26 at 6 20 18 pm
Error: warning: parser/current is loading parser/ruby22, which recognizes warning: 2.2.5-compliant syntax, but you are running 2.2.2. warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.

Error: warning: parser/current is loading parser/ruby22, which recognizes
warning: 2.2.5-compliant syntax, but you are running 2.2.2.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
    at ChildProcess.<anonymous> (/Users/samuilgoranov/.atom/packages/linter-haml/node_modules/sb-exec/lib/index.js:56:20)
    at emitTwo (events.js:100:13)
    at ChildProcess.emit (events.js:185:7)
    at maybeClose (internal/child_process.js:850:16)
    at Socket.<anonymous> (internal/child_process.js:323:11)
    at emitOne (events.js:90:13)
    at Socket.emit (events.js:182:7)
    at Pipe._onclose (net.js:477:12)
unmultimedio commented 7 years ago

Same here, this appears everytime I hit save on a *.haml file.

screen shot 2016-11-30 at 12 24 45

But when in terminal:

» ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]

I had to disable temporary.

Arcanemagus commented 7 years ago

@unmultimedio it sounds like your Atom environment is different from your shell, you may need to manually specify the path to haml-lint.

@Zaifor interesting, looks like putting a try/catch block around here and translating that into a linter message (somewhat like what was done here) is probably the right way to go.

If you want to put up a PR implementing that I'd be happy to review it, as I don't use this linter myself though it will be a while before I can get to it. Unless you want to tackle it @jschroeder9000?

lukecartledge commented 7 years ago

Similar issue for myself.

screen shot 2017-02-07 at 15 40 19

Is there a suggested fix other than disabling?

Arcanemagus commented 7 years ago

@lukecartledge The fix is to read the warning, then update your Ruby install like it's telling you to do 😛.

lukecartledge commented 7 years ago

@Arcanemagus Unfortunately, this is part of a project with a specified (2.2.3) Ruby version. I had already tried installing that version as was suggested in the warning.

sentience commented 7 years ago

I resolved this by altering the binstub generated by Bundler (see bundle binstubs) for haml-lint to run Ruby with a -W0 argument to suppress warnings:

#!/usr/bin/env ruby -W0
#
# This file was generated by Bundler.
#
# The application 'haml-lint' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('haml_lint', 'haml-lint')

Then I pointed linter-haml at this binstub rather than at the haml-lint binary.

westoque commented 7 years ago

@sentience that did it for me. but we do need a better solution. if i have time this weekend i'll probably dive into the code and fix.