Code Monkey home page Code Monkey logo

linter-rubocop's Introduction

linter-rubocop

Gitter Build Status Plugin installs! Package version! Dependencies!

This linter plugin for Linter provides an interface to rubocop. It will be used with files that have the “Ruby” syntax.

Installation

Linter package must be installed in order to use this plugin. If Linter is not installed, please follow the instructions here.

rubocop installation

Before using this plugin, you must ensure that rubocop, version 0.37 or greater, is installed on your system. To install rubocop, do the following:

  1. Install ruby.

  2. Install rubocop by typing the following in a terminal:

    gem install rubocop

Now you can proceed to install the linter-rubocop plugin.

Plugin installation

apm install linter-rubocop

Settings

You can configure linter-rubocop by editing ~/.atom/config.cson (choose Open Your Config in Atom menu):

Using RVM

If you're using RVM and receiving errors in Atom that indicate Rubocop can't be found, you may need to change /bin to /wrappers in the path that gets returned from which rubocop before using it as your command setting. For example, change:

"linter-rubocop":
  command: "/Users/JohnDoe/.rvm/gems/ruby-2.2.4@global/bin/rubocop"

To:

"linter-rubocop":
  command: "/Users/JohnDoe/.rvm/gems/ruby-2.2.4@global/wrappers/rubocop"

Using rbenv

If you're using rbenv, it's recommended that you set your command to point to the Rubocop shim. This way, when you upgrade Ruby, the command will be a pointer to a Rubocop executable, regardless of your current Ruby version.

"linter-rubocop":
  command: "/Users/JohnDoe/.rbenv/shims/rubocop"

Using chruby

If you're using chruby , it's recommended that you set your command to execute chruby-exec to set version and run rubocop. Alternatively, you can reference the full intended path.

"linter-rubocop":
  command: "/usr/local/bin/chruby-exec 2.5.0 -- rubocop"

or

"linter-rubocop":
  command: "/Users/JohnDoe/.gem/ruby/2.5.1/bin/rubocop"

linter-rubocop's People

Contributors

andrew-stripe avatar arcanemagus avatar carlosbaraza avatar caseywebdev avatar darthsim avatar defeated avatar dmnd avatar erikboesen avatar greenkeeper[bot] avatar greenkeeperio-bot avatar hd-deman avatar jamieconnolly avatar keplersj avatar kreeger avatar maletor avatar maschwenk avatar nokutu avatar oeoeaio avatar pborreli avatar renovate-bot avatar semantic-release-bot avatar soumyaray avatar steelbrain avatar tbroadley avatar tobiashm avatar tomasz avatar vzamanillo avatar wakematta avatar walles avatar ykpythemind avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

linter-rubocop's Issues

Rubocop Executable Path shows up two times in settings

On Atom 0.201 and linter-rubocop 0.2.7

When I started Atom I got notified that the rubocop executable was not found. When I checked the settings I found that there are two fields for the path.

screen shot 2015-05-22 at 14 20 55

I set the path in the empty field but linter-rubocop still does nothing.

Config.unobserve is deprecated.

Config::unobserve no longer does anything. Call .dispose() on the object returned by Config::observe instead.

Config.unobserve (/Applications/Atom.app/Contents/Resources/app.asar/src/config.js:1060:19)
LinterRubocop.destroy (/Users/Percipio/.atom/packages/linter-rubocop/lib/linter-rubocop.coffee:36:16)
LinterView.remove (/Users/Percipio/.atom/packages/linter/lib/linter-view.coffee:252:6)
<unknown> (/Users/Percipio/.atom/packages/linter/lib/linter-view.coffee:124:7)

LinterRubocop.Linter is deprecated.

AtomLinter v0.X.Y API has been deprecated. Please refer to the Linter docs to update and the latest API: https://github.com/AtomLinter/Linter/wiki/Migrating-to-the-new-API

LinterRubocop.Linter (/Users/josh/.atom/packages/linter/lib/linter.coffee:60:4)
new LinterRubocop (/Users/josh/.atom/packages/linter-rubocop/lib/linter-rubocop.coffee:25:4)
Object.lint (/Users/josh/.atom/packages/linter/lib/legacy.coffee:61:21)
<unknown> (/Users/josh/.atom/packages/linter/lib/editor-linter.coffee:69:25)
currentLinter (/Users/josh/.atom/packages/linter/lib/editor-linter.coffee:68:19)
<unknown> (/Users/josh/.atom/packages/linter/lib/editor-linter.coffee:82:22)

Run rubocop with different ruby version

Hi,

In my particular case, at work we are maintaining a big rails application developed in Ruby 1.8.7. However, we want to follow the recommendations from Rubocop (which does not support 1.8.7, but 1.9.3). We have some rules configured for our 1.8.7 version.

The problem is that in atom I was receiving this issue message (Obtained from the Linter debug option):

stderr /Users/baraza/.rvm/rubies/ree-1.8.7-2012.02/lib/ruby/site_ruby/1.8/rubygems.rb:900:in `report_activate_error': Could not find RubyGem rubocop (>= 0) (Gem::LoadError)
    from /Users/baraza/.rvm/rubies/ree-1.8.7-2012.02/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `activate'
    from /Users/baraza/.rvm/rubies/ree-1.8.7-2012.02/lib/ruby/site_ruby/1.8/rubygems.rb:1276:in `gem'
    from /Users/baraza/.rvm/gems/ruby-1.9.3-p551/bin/rubocop:22
    from /Users/baraza/.rvm/gems/ree-1.8.7-2012.02/bin/ruby_executable_hooks:15

Then I decided to set the command (cmd) to execute directly on the linter-rubocop.coffee file. And also, not set up the rubocopExecutablePath config option.

cmd: '/Users/baraza/.rvm/rubies/ruby-1.9.3-p551/bin/ruby /Users/baraza/.rvm/gems/ruby-1.9.3-p551/bin/rubocop --format emacs'

However, this will bring another problem. The GEM_PATH environmental variable is not set:

stderr /Users/baraza/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:315:in `to_specs': Could not find 'rubocop' (>= 0) among 151 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/baraza/.rvm/gems/ree-1.8.7-2012.02:/Users/baraza/.rvm/gems/ree-1.8.7-2012.02@global', execute `gem env` for more information
    from /Users/baraza/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:324:in `to_spec'
    from /Users/baraza/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_gem.rb:64:in `gem'
    from /Users/baraza/.rvm/gems/ruby-1.9.3-p551/bin/rubocop:22:in `<main>'

Finally, I solved this issue in the init.coffee adding this line to the activate function.

  activate: ->
    console.log 'activate linter-rubocop'
    process.env['GEM_PATH'] = ['/Users/baraza/.rvm/gems/ruby-1.9.3-p551', process.env['GEM_PATH']].join(':')

Now, I would like to maybe create a fork and solve this issue in a more elegant way. Does anybody has a recommendation on how to proceed with this? I thought about creating an optional config variable for the GEM_PATH, Ruby and Rubocop.

Thank you all for this great plugin.
Carlos.

Uncaught TypeError: undefined is not a function

[Enter steps to reproduce below:]

  1. Started atom with --one
  2. Open any Ruby file

Atom Version: 0.194.0 ⚠️ in 1.0 API Preview Mode ⚠️
System: Mac OS X 10.10.3
Thrown From: linter-rubocop package, v0.2.2

Stack Trace

Uncaught TypeError: undefined is not a function

At /Users/ash/.atom/packages/linter-rubocop/lib/linter-rubocop.coffee:36

TypeError: undefined is not a function
  at LinterRubocop.destroy (/Users/ash/.atom/packages/linter-rubocop/lib/linter-rubocop.coffee:36:17)
  at LinterView.remove (/Users/ash/.atom/packages/linter/lib/linter-view.coffee:252:7)
  at /Users/ash/.atom/packages/linter/lib/linter-view.coffee:124:8
  at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:82:11)
  at TextEditor.module.exports.TextEditor.destroyed (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:279:27)
  at TextEditor.module.exports.Model.destroy (/Applications/Atom.app/Contents/Resources/app.asar/src/model.js:45:58)
  at Pane.module.exports.Pane.destroyItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:444:18)
  at Pane.module.exports.Pane.destroyActiveItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:419:12)
  at Workspace.module.exports.Workspace.destroyActivePaneItem (/Applications/Atom.app/Contents/Resources/app.asar/src/workspace.js:582:35)
  at Workspace.module.exports.Workspace.destroyActivePaneItemOrEmptyPane (/Applications/Atom.app/Contents/Resources/app.asar/src/workspace.js:621:21)
  at atom-workspace.atom.commands.add.core:close (/Applications/Atom.app/Contents/Resources/app.asar/src/workspace-element.js:307:30)
  at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:238:29)
  at /Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61
  at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:519:16)
  at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:354:22)
  at HTMLDocument.module.exports.WindowEventHandler.onKeydown (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:178:20)

Commands

     -1:16.8.0 settings-view:check-for-package-updates (atom-workspace.workspace.scrollbars-visible-always.theme-base16-tomorrow-dark-theme.theme-atom-dark-ui)
  2x -0:08.1.0 core:close (atom-text-editor.editor.vim-mode.command-mode.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "atom-spark-core",
      "welcome",
      "save-session",
      "preview",
      "color-picker"
    ],
    "themes": [
      "atom-dark-ui",
      "base16-tomorrow-dark-theme"
    ],
    "audioBeep": false,
    "followSymlinks": true,
    "projectHome": "/Users/ash/personal"
  }
}

Installed Packages

# User
Atom-Syntax-highlighting-for-Sass, v0.5.0
angularjs, v0.1.0
atom-alignment, v0.12.0
autocomplete-paths, v1.0.2
autocomplete-plus, v2.12.0
editorconfig, v1.0.0
file-icons, v1.5.4
git-tab-status, v1.7.0
highlight-line, v0.10.2
highlight-selected, v0.9.2
jsonlint, v1.1.0
language-arduino, v0.2.1
language-docker, v1.1.3
language-haml, v0.19.0
language-ini, v1.10.0
language-salt, v0.2.0
linter, v0.12.1
linter-rubocop, v0.2.2
linter-ruby, v0.1.4
minimap, v4.7.6
minimap-color-highlight, v4.1.0
minimap-find-and-replace, v4.2.0
minimap-git-diff, v4.1.2
minimap-highlight-selected, v4.2.1
minimap-selection, v4.2.0
open-in-sourcetree, v0.1.2
open-last-project, v0.4.1
pretty-json, v0.3.3
project-manager, v1.15.5
rspec, v0.1.9
set-syntax, v0.2.1
symbols-tree-view, v0.9.2
vim-mode, v0.44.0

# Dev
No dev packages

Not working with [email protected]

It works flawlessly with [email protected], but when using 1.3.0 it just does nothing, no errors are reported and only a deprecation is shown as per #50.

If there is some way I can help debug it please let me know, I'm not really very up to date with developing (and debugging) for Atom, but the developer tools' console doesn't show any error.

I'm running on OSX Yosemite (10.10.3) with various ruby versions (all showing the same behavior) installed with rbenv.

Config.unobserve is deprecated.

Config::unobserve no longer does anything. Call .dispose() on the object returned by Config::observe instead.

Config.unobserve (/Applications/Atom.app/Contents/Resources/app.asar/src/config.js:1060:19)
LinterRubocop.destroy (/Users/ryoutakoganezawa/.atom/packages/linter-rubocop/lib/linter-rubocop.coffee:36:16)
LinterView.remove (/Users/ryoutakoganezawa/.atom/packages/linter/lib/linter-view.coffee:252:6)
<unknown> (/Users/ryoutakoganezawa/.atom/packages/linter/lib/linter-view.coffee:124:7)

Relative path to Rubocop

I have two different computers, both having the Atom folder synched via symlinks over dropbox.

With absolute paths to a Rubocop installation, everything works fine. For one computer, the other one is spawning a lot of read warning boxes.

Long story short, ~/.rvm/gems/ruby-2.2.0/bin/rubocop doens't seem to work. Or am I doing something wrong?

Uncaught Error: spawn ENOTDIR

I'm getting an uncaught error (spawn ENOTDIR) whenever I open a new .rb file.

activate linter-rubocop init.coffee:6
Window load time: 4431ms /Applications/Atom.app/Contents/Resources/app/src/window-bootstrap.js:18
Uncaught Error: spawn ENOTDIR child_process.js:1017
Uncaught Error: spawn ENOTDIR util.js:682
exports._errnoException util.js:682
ChildProcess.spawn child_process.js:1017
exports.spawn child_process.js:801
BufferedProcess /Applications/Atom.app/Contents/Resources/app/src/buffered-process.js:25
Linter.lintFile linter.coffee:114
(anonymous function) linter-view.coffee:133
(anonymous function) fs.js:97
Uncaught Error: spawn ENOTDIR child_process.js:1017

Config.unobserve is deprecated.

Config::unobserve no longer does anything. Call .dispose() on the object returned by Config::observe instead.

Config.unobserve (/Applications/Atom.app/Contents/Resources/app.asar/src/config.js:1060:19)
LinterRubocop.destroy (/Users/keiter/.atom/packages/linter-rubocop/lib/linter-rubocop.coffee:36:16)
LinterView.remove (/Users/keiter/.atom/packages/linter/lib/linter-view.coffee:252:6)
<unknown> (/Users/keiter/.atom/packages/linter/lib/linter-view.coffee:124:7)

Doesn't work on Atom 1.0.0

I have installed linter-rubocop and gave the rubocop path and it is not working on Atom 1.0.0. I am using linter-ruby alternatively.

Stopped working since Yosemite

All my other linters still work but linter-rubocop stopped working since Yosemite upgrade.

Without path set

bildschirmfoto 2014-10-19 um 14 38 53

I get an error message:

bildschirmfoto 2014-10-19 um 14 39 26

With path

I get no error but also no linter results (it just shows nothing).

bildschirmfoto 2014-10-19 um 14 35 30

bildschirmfoto 2014-10-19 um 14 40 08

bildschirmfoto 2014-10-19 um 14 44 34

Crash when active tab is empty and file extension is rb

Uncaught Error: spawn /Users/tvoet/.rbenv/shims/rubocop ENOENT

Atom Version: 0.156.0
System: Mac OS X 10.10.1
Thrown From: Atom Core

Steps To Reproduce

  1. Close Atom with an blank Ruby file as the active tab
  2. Relaunch Atom from the working project directory
  3. Atom restores to the active tab but with the error message that appears below

Stack Trace

At events.js:85

Error: spawn /Users/tvoet/.rbenv/shims/rubocop ENOENT
  at exports._errnoException (util.js:742:11)
  at Process.ChildProcess._handle.onexit (child_process.js:1051:32)
  at child_process.js:1142:20
  at process._tickCallback (node.js:378:11)

Rubocop being run against erbs

Recently I've started experiencing a problem where linter-rubocop runs rubocop against erb files.

Running rubocop from the command line, erb files are skipped as expected.

Is this a known problem? If so is there any workaround for it? I tried adding app/views to the list of excluded files, but I suspect rubocop ignores this when linter-rubocop passes in the filename explicitly.

Thanks,

Paul.

this happens whenever I close a tab

I am using Mac OSX mavericks version 10.9.5. This unfortunately makes rubocop a huge hassel to use! I wish that I could help but I am still just learning the basics of programming.
The console pops up taking up a significant portion of the screen and i get this error below. I had trouble uploading the screen shot I took so i just had to copy paste sorry.

activate linter-rubocop /Users/wjordan213/.atom/packages/linter-rubocop/lib/init.coffee:7
Window load time: 1714ms index.js:46
3Uncaught Error: This TextEditor has been destroyed /Applications/Atom.app/Contents/Resources/app/src/display-buffer.js:989
Uncaught Error: This TextEditor has been destroyed /Applications/Atom.app/Contents/Resources/app/src/display-buffer.js:989module.exports.DisplayBuffer.screenPositionForBufferPosition /Applications/Atom.app/Contents/Resources/app/src/display-buffer.js:989module.exports.Marker.getHeadScreenPosition /Applications/Atom.app/Contents/Resources/app/src/marker.js:211Marker /Applications/Atom.app/Contents/Resources/app/src/marker.js:45module.exports.DisplayBuffer.getMarker /Applications/Atom.app/Contents/Resources/app/src/display-buffer.js:1188module.exports.DisplayBuffer.markBufferRange /Applications/Atom.app/Contents/Resources/app/src/display-buffer.js:1220module.exports.TextEditor.markBufferRange /Applications/Atom.app/Contents/Resources/app/src/text-editor.js:1216LinterView.display linter-view.coffee:180LinterView.processMessage linter-view.coffee:159(anonymous function) linter-view.coffee:1(anonymous function) linter-view.coffee:142Linter.processMessage linter.coffee:151(anonymous function) linter.coffee:127BufferedProcess.triggerExitCallback /Applications/Atom.app/Contents/Resources/app/src/buffered-process.js:52(anonymous function) /Applications/Atom.app/Contents/Resources/app/src/buffered-process.js:59(anonymous function) /Applications/Atom.app/Contents/Resources/app/src/buffered-process.js:105emit events.js:129(anonymous function) net.js:461

errors when starting atom

Hi, When starting atom, linter-rubocop is throwing errors about not being able to find rubocop on my path but from the same shell i launch atom, rubocop shows up just fine. Here are some of the errors in my log:

[7973:1215/090226:INFO:renderer_main.cc(204)] Renderer process started
[7832:1215/090226:INFO:CONSOLE(100)] "Uncaught BufferedProcessError: Failed to spawn command rubocop. Make sure rubocop is installed and on your PATH", source: /opt/atom/resources/app/src/buffered-process.js (100)
[7832:1215/090226:INFO:CONSOLE(100)] "Uncaught BufferedProcessError: Failed to spawn command ruby. Make sure ruby is installed and on your PATH", source: /opt/atom/resources/app/src/buffered-process.js (100)
[7832:1215/090226:INFO:CONSOLE(100)] "Uncaught BufferedProcessError: Failed to spawn command rubocop. Make sure rubocop is installed and on your PATH", source: /opt/atom/resources/app/src/buffered-process.js (100)
[7832:1215/090226:INFO:CONSOLE(100)] "Uncaught BufferedProcessError: Failed to spawn command ruby. Make sure ruby is installed and on your PATH", source: /opt/atom/resources/app/src/buffered-process.js (100)
[7832:1215/090227:INFO:CONSOLE(100)] "Uncaught BufferedProcessError: Failed to spawn command rubocop. Make sure rubocop is installed and on your PATH", source: /opt/atom/resources/app/src/buffered-process.js (100)
[7832:1215/090227:INFO:CONSOLE(100)] "Uncaught BufferedProcessError: Failed to spawn command ruby. Make sure ruby is installed and on your PATH", source: /opt/atom/resources/app/src/buffered-process.js (100)
[7832:1215/090227:INFO:CONSOLE(100)] "Uncaught BufferedProcessError: Failed to spawn command rubocop. Make sure rubocop is installed and on your PATH", source: /opt/atom/resources/app/src/buffered-process.js (100)
[7832:1215/090227:INFO:CONSOLE(100)] "Uncaught BufferedProcessError: Failed to spawn command ruby. Make sure ruby is installed and on your PATH", source: /opt/atom/resources/app/src/buffered-process.js (100)
[8122:1215/090324:INFO:renderer_main.cc(204)] Renderer process started

Any ideas?

Object.activate is deprecated.

AtomLinter v0.X.Y API has been deprecated. Please refer to the Linter docs to update and the latest API: https://github.com/AtomLinter/Linter/wiki/Migrating-to-the-new-API

Object.activate (/Users/egon/.atom/packages/linter/lib/main.coffee:57:8)
Package.activateNow (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:240:19)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:221:30)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:165:15)
Package.activate (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:213:14)
PackageManager.activatePackage (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:452:21)

"The linter binary 'rubocop' cannot be found." error

It works if I manually add /Users/Dan/.gem/ruby/2.0.0/bin/rubocop absolute path under Settings (i.e to config.cson, but why when all of the other linter- packages find the $GEM_HOME/bin directory just fine as it is in my $PATH (and I know that Atom sees my $PATH because as mentioned, other packages that rely on it work fine).

OS X Yosemite 10.10.4
Atom 1.0.0
linter 1.1.0
linter-rubocop 0.2.7

Rubocop command is not found.

[Enter steps to reproduce below:]

...
...

Atom Version: 1.0.0
System: Linux Mint
Thrown From: Atom Core
Stack Trace

Rubocop command is not found.

At When you don't install rubocop yet, Run gem install rubocop first.

If you already installed rubocop, Please check package setting at Rubocop Command Path.

undefined

Commands

Config

{
"core": {
"themes": [
"atom-light-ui",
"atom-dark-syntax"
],
"disabledPackages": [
"ruby-slim",
"ruby-slim",
"ruby-slim",
"linter"
]
},
"editor": {
"invisibles": {},
"showIndentGuide": true,
"showInvisibles": true,
"softWrap": true,
"softWrapAtPreferredLineLength": true
}
}

Installed Packages

User

linter-rubocop, v0.2.7
linter-ruby, v0.1.6
rubocop-auto-correct, v1.0.0

Dev

No dev packages

Ruby version question!

Why do I have to keep changing the Rubocop Executable path whenever I move to another project using a different ruby version shouldn't it still work?

Switch parsing to json format, and display cop name in violations

Currently, this plugin uses the emacs formatting mode. If it were to switch to the json parsing mode, you gain a few things that you couldn't do otherwise:

  • Display the cop name in the error message (Eg: LineLength): This is useful if you need to figure out the name of the cop thats giving you grief, and add it to the ignore file or inline ignore comments
  • Take advantage of JSON: This plugin is written in CoffeeScript. CoffeeScript is javascript. Javascript can parse JSON very easily.
  • Future-proof: While its unlikely the emacs format will change, Rubocop may gain new features that cannot be taken advantage of by the plugin, as they do not show up in the emacs format, but are likely to appear in the JSON format

The biggest attraction for me is the display of cop names

Atom doesn't inherit $PATH

When you open Atom not from the command line, it doesn't inherit PATH. This means that it won't have access to RVM things. The only way I found to solve this was, or just using the command line, or installing a system ruby version with rubocop.

I think that readme should be updated.

Can't save

Error
at C:\Users\gerardo.atom\packages\linter-rubocop\index.coffee:48:27
at FSReqWrap.oncomplete (fs.js:77:15)

Config.unobserve is deprecated.

Atom editor produced this warning message:

Config::unobserve no longer does anything. Call .dispose() on the object returned by Config::observe instead.

Config.unobserve (/Applications/Atom.app/Contents/Resources/app.asar/src/config.js:1060:19)
LinterRubocop.destroy (/Users/jnagro/.atom/packages/linter-rubocop/lib/linter-rubocop.coffee:36:16)
LinterView.remove (/Users/jnagro/.atom/packages/linter/lib/linter-view.coffee:252:6)
<unknown> (/Users/jnagro/.atom/packages/linter/lib/linter-view.coffee:124:7)

Style/FileName fails in Atom, succeeds on command line

This is an edge-case that happens when you configure Rubocop to check Gemfile. It passes on the command line, but fails in Atom with "Use snake_case for source file names."

The check in Rubocop is written so that any filenames that are explicitly included in the configuration are considered "good" and ignored:

https://github.com/bbatsov/rubocop/blob/master/lib/rubocop/cop/style/file_name.rb#L14

return if config.file_to_include?(file_path)

This fails when run within Atom because it uses a temporary file, which doesn't match the glob **/Gemfile.

stdout /var/folders/18/3c9l9tvs5qv9kjg_1nkxtp6m0000gn/T/AtomLinter114111-58971-gmptoasource.ruby.rails/Gemfile:1:1: C: Use snake_case for source file names.

Paths are computed relative to the Rubocop config file, so maybe one solution to this could be to copy the config file to the tmp directory, too, and run it from there. If that sounds like an OK solution to the maintainers, I can work up a patch.

Linter 1.3 Compatibility

The newest version of linter has removed some things that linter-rubocop once used, such as findFile.

Config.unobserve is deprecated.

Config::unobserve no longer does anything. Call .dispose() on the object returned by Config::observe instead.

Config.unobserve (/Applications/Atom.app/Contents/Resources/app/src/config.js:1045:19)
LinterRubocop.destroy (/Users/angelbotto/.atom/packages/linter-rubocop/lib/linter-rubocop.coffee:36:16)

Feature idea: CMD+click on the linter issue starts rubocops with auto-correct option

I would like to see the following feature:

Since rubocop can auto-correct some linter offenses, it would be great if CMD-clicking on an issue would trigger rubocop with the options:

-a --only $COP ...

This would allow selectively auto-correcting some linter warnings in case the cop supports auto-correct.

What would be necessary to achieve this? To get the cop-names there is the -D flag, so i guess all the information is there.
I would be willing to help.

Linter rubocop not lintering.

As the title says it, simply nothing happens as I type code. I tried most troubleshooting tips that you can find out there. Modifying cson file, uninstalling everything (including atom), opening from terminal, etc. Any help appreciated. thank you.

no dependency to linter

The Package does not have a depency to linter and it took me a while to figure that out. So it would be great if you could add it.

Falsely reporting "Use snake_case for source file names"

When running Rubocop from the command line I don't receive errors, however, on pretty much every ruby file I am consistently getting the Rubocop error Use snake_case for source file names.

Sample ruby file that demonstrates the error

class Plan < ActiveRecord::Base
end

Screenshot showing the error

false-positive

Using:

  • Atom v. 0.211.0
  • linter v. 1.0.2
  • linter-rubocop v. 0.2.7

Error popup on each Rubocop run

Ever since updating to the latest version of linter-rubocop, this error pops up on each save:

screen shot 2015-08-10 at 11 30 46 am

Error: warning: parser/current is loading parser/ruby21, which recognizes
warning: 2.1.6-compliant syntax, but you are running 2.1.5.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
{"metadata":{"rubocop_version":"0.32.1","ruby_engine":"ruby","ruby_version":"2.1.5","ruby_patchlevel":"273","ruby_platform":"x86_64-darwin14.0"},"files":[{"path":"../../../../../../var/folders/0_/w17vx8mx5kvgqzhbd59d06qm0000gn/T/69387008a68292900467c23649af55cd91149aacf3403caf7d602e1c7f15c4d4","offenses":[]}],"summary":{"offense_count":0,"target_file_count":1,"inspected_file_count":1}}
  at /Users/tim/.atom/packages/linter-rubocop/index.coffee:42:27
  at FSReqWrap.oncomplete (fs.js:77:15)

I get the same warning running rubocop from the command line, but it never previously appeared as an error popup in the editor.

It looks like the latest version of the plugin tries to append stderr to stdout and parse the entire thing as JSON. I suppose that's what triggers the internal error in Atom.

https://github.com/AtomLinter/linter-rubocop/blob/master/index.coffee#L39
https://github.com/AtomLinter/linter-rubocop/blob/master/index.coffee#L41

Uncaught Error: spawn ENOENT

This error happens when path to rubocop binary is missing or invalid. I installed a few packages at the same time and it took me a while to find out which one was causing this error. Wouldn't it be possible to throw some more detailed error message if rubocop binary can't be found?

RuboCop is not installed

I see RuboCop is not installed in status bar now all of a sudden, it is installed, and I put the path to executable in settings. It was working fine but then it stopped working. I am not sure if this is a caused by atom-lint or linter-rubocop itself. Please advise.

Uncaught Error: spawn EACCES

Just upgraded to 0.103.0 of Atom. Now, whenever I open a .rb file I get this error:

Uncaught Error: spawn EACCES util.js:682
  exports._errnoException util.js:682
  ChildProcess.spawn child_process.js:1017
  exports.spawn child_process.js:801
  BufferedProcess /Applications/Atom.app/Contents/Resources/app/src/buffered-process.js:25
  Linter.lintFile linter.coffee:114
  (anonymous function) linter-view.coffee:133
  (anonymous function) fs.js:97

I get a file not found error from rubocop

When editing a file, I see no linting, but if I open the javascript console I can see an error message that says "env: ruby_executable_hooks: No such file or directory".

  • I have rubocop installed using rvm
  • The command that appears to be run looks like /Users/jaresty/.rvm/gems/ruby-2.1.2/bin/rubocop --format emacs /var/folders/2_/7s_9bc4s5q586np5tmjh3tn80000gr/T/114421-34324-5q1bi0source.ruby

FSReqWrap.oncomplete error

Error
at ~/.atom/packages/linter-rubocop/index.coffee:45:27
at FSReqWrap.oncomplete (fs.js:77:15)

Linter - v1.4.3
Linter-rubocop - v0.3.2
Rubocop - v0.33.0

Expose rubocopExecutablePath in settings-view

Currently, no settings are displayed in the package card view for linter-rubocop in Settings:

image

Since unlike all of the JS linters, linter-rubocop has an external dependency that must be configured (since the default is null), it should expose rubocopExecutablePath in settings-view to make it more obvious and accessible.

Doesn't work for me

When I start Atom whit the package installed I get this:

Use a config schema instead. See the configuration section of https://atom.io/docs/latest/hacking-atom-package-word-count and https://atom.io/docs/api/latest/Config for more details
Called 1 time
Package.activateConfig - /opt/atom/resources/app/src/package.js:250:11
Package.activateNow - /opt/atom/resources/app/src/package.js:221:14
Use activationCommands instead of activationEvents in your package.json Commands should be grouped by selector as follows:
"activationCommands": {
"atom-workspace": ["foo:bar", "foo:baz"],
"atom-text-editor": ["foo:quux"]
}
Called 1 time
Package.getActivationCommands - /opt/atom/resources/app/src/package.js:764:9
Package.hasActivationCommands - /opt/atom/resources/app/src/package.js:689:20

Rubocop linter stopped working

My issue is similar to #61 - it used to work but it's broken with recent versions. I use chruby and specify the executable path explicitly /Users/mrfoto/.gem/ruby/2.2.2/bin/rubocop. But every file I open I get the following error popups and rubocop is not linting:

Error: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in to_specs': Could not find 'rubocop' (>= 0) among 8 total gem(s) (Gem::LoadError) from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:into_spec' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in gem' from /Users/mrfoto/.gem/ruby/2.2.2/bin/rubocop:22:in
'
Error: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'rubocop' (>= 0) among 8 total gem(s) (Gem::LoadError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
    from /Users/mrfoto/.gem/ruby/2.2.2/bin/rubocop:22:in `<main>'
  at /Users/mrfoto/.atom/packages/linter-rubocop/index.coffee:42:27
  at FSReqWrap.oncomplete (fs.js:77:15)

So it is finding the right rubocop as this happens from line 22 of it but it still accesses some system paths where rubocop (or anything else) is not present.

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.