Giter VIP home page Giter VIP logo

Comments (32)

iam4x avatar iam4x commented on June 18, 2024

Hi @jaresty I'll look into it,
Can you provide a gist of an example file to lint?

And the output of:

  • $ rubocop --version
  • $ ruby --version

I have ruby 2.0.0p451 installed with rvm and gem rubocop v0.22.0 and no issues.

from linter.

jaresty avatar jaresty commented on June 18, 2024

It happens with any ruby file at all. I'm not sure if it's a
linter-rubocop issue or a linter issue.

Thanks,
Josh

2014年5月26日月曜日、Maxime [email protected]さんは書きました:

Hi @jaresty https://github.com/jaresty I'll look into it,
Can you provide a gist of an example file to lint?

Thank's


Reply to this email directly or view it on GitHubhttps://github.com//issues/57#issuecomment-44177051
.

Best,
Josh Aresty
Web Developer
The MathWorks

from linter.

iam4x avatar iam4x commented on June 18, 2024

@jaresty I edited my message, as you answered by mail you didn't noticed it.

It seems more an issue with your installation of rubocop can you give me your ruby --version and rubocop --version.

Also can you try to lint a file with the command line directly in shell with: $ rubocop path/to/file.rb and give me the result.

from linter.

jaresty avatar jaresty commented on June 18, 2024
% rubocop --version
0.21.0

% ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]

/Users/jaresty/.rvm/gems/ruby-2.1.2/bin/rubocop --format emacs /var/folders/2_/7s_9bc4s5q586np5tmjh3tn80000gr/T/114421-34216-1eagftfsource.ruby
No such file or directory @ rb_sysopen - /var/folders/2_/7s_9bc4s5q586np5tmjh3tn80000gr/T/114421-34216-1eagftfsource.ruby
/Users/jaresty/.rvm/gems/ruby-2.1.2/gems/rubocop-0.21.0/lib/rubocop/source_parser.rb:10:in `read'
/Users/jaresty/.rvm/gems/ruby-2.1.2/gems/rubocop-0.21.0/lib/rubocop/source_parser.rb:10:in `parse_file'
/Users/jaresty/.rvm/gems/ruby-2.1.2/gems/rubocop-0.21.0/lib/rubocop/file_inspector.rb:86:in `process_source'
/Users/jaresty/.rvm/gems/ruby-2.1.2/gems/rubocop-0.21.0/lib/rubocop/file_inspector.rb:52:in `process_file'
/Users/jaresty/.rvm/gems/ruby-2.1.2/gems/rubocop-0.21.0/lib/rubocop/file_inspector.rb:23:in `block in process_files'
/Users/jaresty/.rvm/gems/ruby-2.1.2/gems/rubocop-0.21.0/lib/rubocop/file_inspector.rb:21:in `each'
/Users/jaresty/.rvm/gems/ruby-2.1.2/gems/rubocop-0.21.0/lib/rubocop/file_inspector.rb:21:in `process_files'
/Users/jaresty/.rvm/gems/ruby-2.1.2/gems/rubocop-0.21.0/lib/rubocop/cli.rb:31:in `run'
/Users/jaresty/.rvm/gems/ruby-2.1.2/gems/rubocop-0.21.0/bin/rubocop:14:in `block in <top (required)>'
/Users/jaresty/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
/Users/jaresty/.rvm/gems/ruby-2.1.2/gems/rubocop-0.21.0/bin/rubocop:13:in `<top (required)>'
/Users/jaresty/.rvm/gems/ruby-2.1.2/bin/rubocop:23:in `load'
/Users/jaresty/.rvm/gems/ruby-2.1.2/bin/rubocop:23:in `<main>'
/Users/jaresty/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
/Users/jaresty/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'

% /Users/jaresty/.rvm/gems/ruby-2.1.2/bin/rubocop --format emacs ~/Desktop/roley-poley/player.rb
/Users/jaresty/Desktop/roley-poley/player.rb:1:80: C: Line is too long. [85/79]
/Users/jaresty/Desktop/roley-poley/player.rb:3:80: C: Line is too long. [123/79]
/Users/jaresty/Desktop/roley-poley/player.rb:5:1: C: Missing top-level class documentation comment.
/Users/jaresty/Desktop/roley-poley/player.rb:12:3: C: Use `attr_reader` to define trivial reader methods.
/Users/jaresty/Desktop/roley-poley/player.rb:17:1: C: Missing top-level module documentation comment.
/Users/jaresty/Desktop/roley-poley/player.rb:23:1: C: Missing top-level class documentation comment.
/Users/jaresty/Desktop/roley-poley/player.rb:33:5: C: Use self-assignment shorthand `+=`.
/Users/jaresty/Desktop/roley-poley/player.rb:37:1: C: Missing top-level class documentation comment.
/Users/jaresty/Desktop/roley-poley/player.rb:38:3: C: Missing top-level class documentation comment.
/Users/jaresty/Desktop/roley-poley/player.rb:40:31: W: Ambiguous negative number operator. Parenthesize the method arguments if it's surely a negative number operator, or add a whitespace to the right of the `-` if it should be a subtraction.
/Users/jaresty/Desktop/roley-poley/player.rb:44:3: C: Missing top-level class documentation comment.
/Users/jaresty/Desktop/roley-poley/player.rb:62:4: C: Prefer `$PROGRAM_NAME` over `$0`.
/Users/jaresty/Desktop/roley-poley/player.rb:67:80: C: Line is too long. [102/79]
/Users/jaresty/Desktop/roley-poley/player.rb:72:80: C: Line is too long. [101/79]

I'm seeing some new errors in the console:

editorView.editor.getGrammar().scopeNametext.plain.null-grammar init.coffee:44
linter: run commands linter-view.coffee:109
linter: lintOnModified linter-view.coffee:104
linter: run commands linter-view.coffee:109
Failed to load resource: the server responded with a status of 404 (Not Found) https://api.travis-ci.org/MatthewMueller/cheerio.svg?branch=master
Failed to load resource: the server responded with a status of 404 (Not Found) https://api.travis-ci.org/MatthewMueller/cheerio.png?branch=master
linter: grammar changed init.coffee:34
linter: run commands linter-view.coffee:109
linter: run linter command linter.coffee:77
/Users/jaresty/.rvm/gems/ruby-2.1.2/bin/rubocop --format emacs /var/folders/2_/7s_9bc4s5q586np5tmjh3tn80000gr/T/114426-47784-10jbyahsource.ruby linter.coffee:78
/Users/jaresty/Desktop/roley-poley linter.coffee:79
env: ruby_executable_hooks: No such file or directory

from linter.

iam4x avatar iam4x commented on June 18, 2024

First try to update rubocop version 0.22.0 is out now.

I'm looking into it.

from linter.

jaresty avatar jaresty commented on June 18, 2024

Did you install ruby with rvm? I will update rubocop as soon as I get back
home (I'm out for the day now)

2014年5月26日月曜日、Maxime [email protected]さんは書きました:

First try to update rubocop it's on version 0.22.0

I'm looking into it.


Reply to this email directly or view it on GitHubhttps://github.com//issues/57#issuecomment-44192135
.

Best,
Josh Aresty
Web Developer
The MathWorks

from linter.

iam4x avatar iam4x commented on June 18, 2024

Yes, installed with rvm too ;)

btw co-workers are telling me that https://github.com/sstephenson/rbenv is better now than RVM (fyi)

Can I have an example file with his extension which fails? Into a gist.

from linter.

iam4x avatar iam4x commented on June 18, 2024

It's looking for /var/folders/2_/7s_9bc4s5q586np5tmjh3tn80000gr/T/114421-34216-1eagftfsource.ruby which doesn't seems to exists. And the extension of the file is kinda weird.

from linter.

jaresty avatar jaresty commented on June 18, 2024

Right: I don't know where that file name is coming from; I assumed it was
something internal to atom or the linter plugin.

2014年5月26日月曜日、Maxime [email protected]さんは書きました:

It's looking for
/var/folders/2_/7s_9bc4s5q586np5tmjh3tn80000gr/T/114421-34216-1eagftfsource.rubywhich doesn't seems to exists. And the extension of the file is kinda weird.


Reply to this email directly or view it on GitHubhttps://github.com//issues/57#issuecomment-44192773
.

Best,
Josh Aresty
Web Developer
The MathWorks

from linter.

iam4x avatar iam4x commented on June 18, 2024

@jaresty Yep, it's intern to Linter plugin. To lint on modify, we copy the text buffer into a temporary file which will be used by the specific linter.

Normally it should add the correct extension to the file, so something is going wrong. When you have time, give me a not working example file ;)

from linter.

jaresty avatar jaresty commented on June 18, 2024

Could you send me an example file that works for you too?

2014年5月26日月曜日、Maxime [email protected]さんは書きました:

@jaresty https://github.com/jaresty Yep, it's intern to Linter plugin.
To lint on modify, we copy the text buffer into a temporary file which will
be used by the specific linter.

Normally it should add the correct extension to the file, so something is
going wrong. When you have time, give me a not working exemple file ;)


Reply to this email directly or view it on GitHubhttps://github.com//issues/57#issuecomment-44193288
.

Best,
Josh Aresty
Web Developer
The MathWorks

from linter.

jaresty avatar jaresty commented on June 18, 2024

This file is named player.rb, and produces the error when loaded into the linter. It happens actually with any .rb file I try to use.

# Different take on delegation--always have an identified original message recipient.
#
# Inspired by: http://www.saturnflyer.com/blog/jim/2012/07/06/the-gang-of-four-is-wrong-and-you-dont-understand-delegation/

class Role
  def initialize(delegate)
    @delegate = delegate
  end

  private

  def delegate
    @delegate
  end
end

module ActsAs
  def as(role_class)
    role_class.new self
  end
end

class Account
  include ActsAs

  attr_reader :balance

  def initialize(balance)
    @balance = balance
  end

  def update_balance(amount)
    @balance = @balance + amount
  end
end

class TransferMoney
  class Source < Role
    def withdraw(amount)
      delegate.update_balance -amount
    end
  end

  class Destination < Role
    def deposit(amount)
      delegate.update_balance amount
    end
  end

  def initialize(amount, source, destination)
    @amount      = amount
    @source      = source.as Source
    @destination = destination.as Destination
  end

  def run
    @source.withdraw @amount
    @destination.deposit @amount
  end
end

if $0 == __FILE__

  savings  = Account.new 300
  checking = Account.new 100

  puts "Before transfer, savings contains $#{savings.balance}, checking contains $#{checking.balance}"

  transfer = TransferMoney.new 100, savings, checking
  transfer.run

  puts "After transfer, savings contains $#{savings.balance}, checking contains $#{checking.balance}"

end

from linter.

iam4x avatar iam4x commented on June 18, 2024

Hi @jaresty I add so much work this week, gonna look more into it today. But I have problem to reproduce :/

With your file, on OSX 10.9.3, ruby 2.0.0p451, rubocop 0.22.0 I have no errors:

screen shot 2014-05-30 at 10 36 00 am

from linter.

jaresty avatar jaresty commented on June 18, 2024

Would it help if I could show you? I can screen share with google plus I
think.

2014年5月30日金曜日、Maxime [email protected]さんは書きました:

Hi @jaresty https://github.com/jaresty I add so much work this week,
gonna look more into it today. But I have problem to reproduce :/


Reply to this email directly or view it on GitHub
#57 (comment).

Best,
Josh Aresty
Web Developer
The MathWorks

from linter.

iam4x avatar iam4x commented on June 18, 2024

@jaresty Okey It seems to doesn't find the temporary file created from the buffer, on what OSX version are you working? They may be an issue while creating the temp file.

from linter.

jaresty avatar jaresty commented on June 18, 2024

I'm on Mavericks (10.9), but this happened on my work machine running 10.8
too.

Best,
Josh Aresty
Web Developer
The MathWorks

On Fri, May 30, 2014 at 10:31 AM, Maxime Tyler [email protected]
wrote:

@jaresty https://github.com/jaresty Okey It seems to doesn't find the
temporary file created from the buffer, on what OSX version are you
working? They may be an issue while creating the temp file.


Reply to this email directly or view it on GitHub
#57 (comment).

from linter.

iam4x avatar iam4x commented on June 18, 2024

Are other linters working? Like the jshint or coffeelint ?

from linter.

jaresty avatar jaresty commented on June 18, 2024

jshint doesn't seem to throw errors, but I don't see any visible linting
feedback so I'm not sure if it's really working.

Best,
Josh Aresty
Web Developer
The MathWorks

On Fri, May 30, 2014 at 10:35 AM, Maxime Tyler [email protected]
wrote:

Are other linters working? Like the jshint or coffeelint ?


Reply to this email directly or view it on GitHub
#57 (comment).

from linter.

iam4x avatar iam4x commented on June 18, 2024

@jaresty Looks like you are the only one who can debug this! Can you check if the https://www.npmjs.org/package/temp package works on your system? Sounds like it doesn't create the file from the editor buffer.

I can help you with this if you don't have any experience into node and javascript.

from linter.

jaresty avatar jaresty commented on June 18, 2024

What command should I run to test the package?

2014年5月30日金曜日、Maxime [email protected]さんは書きました:

@jaresty https://github.com/jaresty Looks like you are the only one who
can debug this! Can you check if the https://www.npmjs.org/package/temp
package works on your system? Sounds like it doesn't create the file from
the editor buffer.

I can help you with this if you don't have any experience into node and
javascript.


Reply to this email directly or view it on GitHub
#57 (comment).

Best,
Josh Aresty
Web Developer
The MathWorks

from linter.

iam4x avatar iam4x commented on June 18, 2024

@jaresty You should try to create a little nodejs script using the module. Creating a temporary file and see if it's working on your system. I'm not sure how to help you.

If someone has an idea? @park9140 @hd-deman

from linter.

jaresty avatar jaresty commented on June 18, 2024

Is there some sample code I could look to to get a specific example? Where
in the package is the tempfile code used? It would help if I could make my
example as close to the package's usage as possible.

Thanks,

Josh

Best,
Josh Aresty
Web Developer
The MathWorks

On Mon, Jun 2, 2014 at 9:34 AM, Maxime Tyler [email protected]
wrote:

@jaresty https://github.com/jaresty You should try to create a little
nodejs script using the module. Creating a temporary file and see if it's
working on your system. I'm not sure how to help you.

If someone has an idea? @park9140 https://github.com/park9140 @hd-deman
https://github.com/hd-deman


Reply to this email directly or view it on GitHub
#57 (comment).

from linter.

jaresty avatar jaresty commented on June 18, 2024

I used the example I found on the module website, copied and pasted into
the console in atom, and didn't get any errors:

// Fake data
var myData = "foo\nbar\nfoo\nbaz";

// Process the data (note: error handling omitted)
temp.open('myprefix', function(err, info) {
if (!err) {
fs.write(info.fd, myData);
fs.close(info.fd, function(err) {
exec("grep foo '" + info.path + "' | wc -l", function(err, stdout) {
console.log(stdout.trim());
});
});
}
});

undefined
2

Best,
Josh Aresty
Web Developer
The MathWorks

On Mon, Jun 2, 2014 at 11:15 AM, Josh Aresty [email protected] wrote:

Is there some sample code I could look to to get a specific example?
Where in the package is the tempfile code used? It would help if I could
make my example as close to the package's usage as possible.

Thanks,

Josh

Best,
Josh Aresty
Web Developer
The MathWorks

On Mon, Jun 2, 2014 at 9:34 AM, Maxime Tyler [email protected]
wrote:

@jaresty https://github.com/jaresty You should try to create a little
nodejs script using the module. Creating a temporary file and see if it's
working on your system. I'm not sure how to help you.

If someone has an idea? @park9140 https://github.com/park9140 @hd-deman
https://github.com/hd-deman


Reply to this email directly or view it on GitHub
#57 (comment).

from linter.

iam4x avatar iam4x commented on June 18, 2024

Write this in something.js

var temp = require('temp');
temp.track();

// Fake data
var myData = "foo\nbar\nfoo\nbaz";

// Process the data (note: error handling omitted)
temp.open('myprefix', function(err, info) {
  if (!err) {
    fs.write(info.fd, myData);
    fs.close(info.fd, function(err) {
      exec("grep foo '" + info.path + "' | wc -l", function(err, stdout) {
        console.log(stdout.trim());
      });
    });
  }
});

And then run in your shell: $ node something.js

You need to install the module temp by running: $ npm install -g temp

from linter.

jaresty avatar jaresty commented on June 18, 2024

When I run this code, the result is "2". It works on my system.

Best,
Josh Aresty
Web Developer
The MathWorks

On Mon, Jun 2, 2014 at 11:45 AM, Maxime Tyler [email protected]
wrote:

Write this in something.js

var temp = require('temp');
temp.track();

// Fake data
var myData = "foo\nbar\nfoo\nbaz";

// Process the data (note: error handling omitted)
temp.open('myprefix', function(err, info) {
if (!err) {
fs.write(info.fd, myData);
fs.close(info.fd, function(err) {
exec("grep foo '" + info.path + "' | wc -l", function(err, stdout) {
console.log(stdout.trim());
});
});
}
});

And then run in your shell: $ node something.js

You need to install the module temp by running: $ npm install -g temp


Reply to this email directly or view it on GitHub
#57 (comment).

from linter.

jaresty avatar jaresty commented on June 18, 2024

I think I've figured out the issue:

On a mac when you install rubocop using rvm and try to set up the linter-rubocop package to point to the rvm (not the mac-system) rubocop, that file contains the line #! env ruby_executable_hooks, which gives a file-not-found error on the mac since your windowed session does not know how to access rvm.

from linter.

iam4x avatar iam4x commented on June 18, 2024

Mind blown

Waaaahou!

from linter.

park9140 avatar park9140 commented on June 18, 2024

@jaresty, try installing atom command line aliases and then start atom from the command line. This issue exists in a bunch of the linters in sublime as well and that fixes the issue there.

The underlying problem being that certain package managers like nodenv, rbenv, rvm... only install their path in the bash profile, and in osx this file does not get added to the standard application context.

I would suggest that we do an interactive process for discovering a linter location. Each linter could provide guesses for the linter install location, and failing that the base linter could alert the user to input the base linter location so that they are told when the above issue results in not finding the linter executable requirement.

from linter.

johanneswuerbach avatar johanneswuerbach commented on June 18, 2024

Can't the bash_profile not be loaded into the atom / linter environment? This would solve this issue more automatically and terminal commands would also work in linters.

from linter.

park9140 avatar park9140 commented on June 18, 2024

It could, however there are still those among us who do not use bash profile as well. I use fish, and a couple other people around my office use zsh, neither of which use the bash_profile for sourcing path information by default. So even if we pulled the bash profile we would not guarantee access to the correct path data. Though I would love to see atom automatically include the bash profile path info.

from linter.

jaresty avatar jaresty commented on June 18, 2024

@park9140 that did it. Good idea-thanks!

from linter.

dmnd avatar dmnd commented on June 18, 2024

The specific issue here seems to be resolved. Closing, but see #150 for @johanneswuerbach's suggesting of loading the profile into Atom.

from linter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.