Giter Site home page Giter Site logo

linter-rust's Introduction

linter-rust Build Status

Linting your Rust-files in Atom, using rustc and cargo. Files will be checked when you open or save them.

Installation

Other available linters

There are other linters available - take a look at the linters mainpage.

linter-rust's People

Contributors

alexheretic avatar alkorang avatar aomader avatar arcanemagus avatar arthurprs avatar benstreb avatar chriskrycho avatar colin-kiegel avatar gluxon avatar gmist avatar greenkeeper[bot] avatar greenkeeperio-bot avatar hybrideidolon avatar hyeonupark avatar jmquigs avatar jviide avatar keplersj avatar legneato avatar lhecker avatar nadejin avatar psfried avatar renovate-bot avatar semantic-release-bot avatar snirkimmington avatar steelbrain avatar utkarshkukreti avatar whatisaphone avatar white-oak 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linter-rust's Issues

Speed improvements for cargo based linting

Instead of using cargo build to generate the lint messages, it might make sense to use cargo rustc in combination with -Z no-trans, as it is already done with rustc based linting. The downside of this approach is, that one has to specify which target to build, .i.e., --lib, --bin NAME, etc, which might require multiple runs to really get all messages.

Compling via Terminal Forces the Dependencies to Compile.

Not sure if this is the expected behaviour as it is telling me there is a file lock. I have confirmed that the issue is with this linter, that is, when I disable the linter the problem resolves itself. Not sure if there is anything else I can add.

Lint errors make it difficult to see code

screenshot from 2016-10-08 22-03-30

This is a screenshot of a function I'm in the middle of writing.

Here's the actual code in question:

    fn match_advanced_token(&mut self, start: char) -> TokenResult {
        if start.is_whitespace() {
            let spaces = String::new();

            let mut next_char = Some(start);
            while next_char.is_some() {
                let c = next_char.unwrap();
                if !c.is_whitespace() {
                    break;
                }

                spaces.push(c);
                next_char = self.scanner.get_char();
            }

            Ok(Token::Whitespace(spaces))
        }
    }

I'm not done writing the function yet, so there are a number of problems with it. The error being shown is complaining that not every return path results in the expected return type. This is a valid complaint, but because the error takes over the entire function and the bubble is impossible to dismiss, it's really difficult to write code.

Would it be possible to make the bubble dismissable somehow? Like just hit esc or something and tell it to leave me alone. Also, instead of highlighting every line in the function, could you just highlight one part and tell me the error?

For this specific error for example, you could just highlight the return type or the function name and complain that I'm not returning the same type in every control path. This is what a lot of linters like ESLint do.

Error not shown at the appropriate place when the error is in a macro invocation

Steps to reproduce:

$ cargo new a --bin
$ cd a
$ atom .
# edit src/main.rs
$ cat src/main.rs
fn main() {
    assert_eq!("one", 1);
}

Run linter in Atom in any of these modes: build, check, test, rustc, and you'll see the following error inserted by this package:

screen shot 2016-10-25 at 12 50 02 pm

Both the line numbers and the file name are wrong. Clicking on the at line 5 col 6 ... link takes me to a new file buffer with name <std macros>.

This is the output of cargo test:

cargo test
   Compiling a v0.1.0 (file:///private/tmp/a)
error[E0277]: the trait bound `&str: std::cmp::PartialEq<{integer}>` is not satisfied
 --> src/main.rs:2:5
  |
2 |     assert_eq!("one", 1);
  |     ^^^^^^^^^^^^^^^^^^^^^ trait `&str: std::cmp::PartialEq<{integer}>` not satisfied
  |
  = help: the following implementations were found:
  = help:   <str as std::cmp::PartialEq<std::ffi::OsString>>
  = help:   <str as std::cmp::PartialEq<std::ffi::OsStr>>
  = help:   <str as std::cmp::PartialEq<std::string::String>>
  = help:   <&'a str as std::cmp::PartialEq<std::string::String>>
  = help: and 3 others
  = note: this error originates in a macro outside of the current crate

error: aborting due to previous error

error: Could not compile `a`.

To learn more, run the command again with --verbose.

which does include the appropriate place to insert the error: src/main.rs:2:5.

Spawning rustc process on every save

It seems like this plug-in is spawning a new rustc process on every save (or modification?) often causing multiple instances of it to run in parallel.

At some point I had 13 different rustc instances running in the background effectively saturating my processor for 5 minutes, making everything unusable.

Package.getActivationCommands is deprecated.

atom -v 0.196.0
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"]
  }
Package.getActivationCommands (C:\Users\lokiCML\AppData\Local\atom\app-0.196.0\resources\app.asar\src\package.js:790:9)
Package.hasActivationCommands (C:\Users\lokiCML\AppData\Local\atom\app-0.196.0\resources\app.asar\src\package.js:715:20)
<unknown> (C:\Users\lokiCML\AppData\Local\atom\app-0.196.0\resources\app.asar\src\package.js:169:24)
Package.measure (C:\Users\lokiCML\AppData\Local\atom\app-0.196.0\resources\app.asar\src\package.js:147:15)

Failed to activate the linter-rust package

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.0.0
System: Ubuntu 15.04
Thrown From: linter-rust package, v0.2.0

Stack Trace

Failed to activate the linter-rust package

At Cannot read property 'path' of undefined

TypeError: Cannot read property 'path' of undefined
    at Object.<anonymous> (/home/lizhe/.atom/packages/linter-rust/lib/linter-rust.coffee:5:56)
    at Object.<anonymous> (/home/lizhe/.atom/packages/linter-rust/lib/linter-rust.coffee:116:4)
    at Module._compile (module.js:452:26)
    at Object.requireCoffeeScript (/opt/atom/resources/app.asar/node_modules/coffee-cash/lib/coffee-cash.js:85:19)
    at Module.load (module.js:347:32)
    at Function.Module._load (module.js:302:12)
    at Module.require (module.js:357:17)
    at require (module.js:376:17)
    at Object.module.exports.provideLinter (/home/lizhe/.atom/packages/linter-rust/lib/init.coffee:69:20)
    at Package.module.exports.Package.activateServices (/opt/atom/resources/app.asar/src/package.js:369:69)

Commands

Config

{
  "core": {
    "ignoredNames": [
      ".git"
    ],
    "autoHideMenuBar": true
  }
}

Installed Packages

# User
file-icons, v1.5.8
highlight-selected, v0.10.1
linter-rust, v0.2.0
minimap, v4.10.1
minimap-git-diff, v4.1.3
minimap-highlight-selected, v4.3.0
pretty-json, v0.4.1

# Dev
No dev packages

Error When Building with Language Rust Enabled

[Enter steps to reproduce below:]

  1. Install Atom
  2. Install Linter Rust
  3. Install cargo build and build
  4. Restart Atom
  5. Build Any Project

Only errors the first time you build from each file. Error goes away when you disable language rust. When you renable language rust you can error from each file that you build from again.

Atom Version: 1.9.8
System: Ubuntu 16.04.1
Thrown From: linter-rust package, v0.5.2

Stack Trace

Uncaught ReferenceError: handle is not defined

At /home/yelikubuntu/.atom/packages/linter-rust/lib/linter-rust.coffee:37

ReferenceError: handle is not defined
    at stderr (/home/yelikubuntu/.atom/packages/linter-rust/lib/linter-rust.coffee:37:11)
    at Socket.<anonymous> (/usr/share/atom/resources/app.asar/src/buffered-process.js:87:13)
    at emitOne (events.js:90:13)
    at Socket.emit (events.js:182:7)
    at readableAddChunk (_stream_readable.js:153:18)
    at Socket.Readable.push (_stream_readable.js:111:10)
    at Pipe.onread (net.js:531:20)

Commands

  4x -2:56.3.0 core:backspace (atom-text-editor#editor.tabLength.editor.mini.is-focused)
     -2:55.2.0 core:confirm (atom-text-editor#editor.tabLength.editor.mini.is-focused)
 58x -1:59.9.0 core:backspace (atom-text-editor#racer.racerBinPath.editor.mini.is-focused)
  2x -0:50.9.0 core:paste (div.package-detail.panels-item)
  2x -0:45.9.0 core:move-left (atom-text-editor#racer.rustSrcPath.editor.mini.is-focused)
 17x -0:45.3.0 core:delete (atom-text-editor#racer.rustSrcPath.editor.mini.is-focused)
  2x -0:41.5.0 core:backspace (atom-text-editor#racer.rustSrcPath.editor.mini.is-focused)
  2x -0:38.2.0 core:save (atom-text-editor#racer.rustSrcPath.editor.mini.is-focused)

Config

{}

Installed Packages

# User
atom-language-rust, v0.8.1 (active)
autocomplete-glsl, v0.2.3 (active)
build-cargo, v0.16.0 (active)
language-glsl, v2.0.1 (active)
language-rust, v0.4.6 (active)
linter, v1.11.16 (active)
linter-rust, v0.5.2 (active)
racer, v0.20.0 (active)
rust-api-docs-helper, v0.5.1 (active)
atom-dark-syntax, v0.27.0 (inactive)
atom-dark-ui, v0.51.0 (inactive)
atom-light-syntax, v0.28.0 (inactive)
atom-light-ui, v0.43.0 (inactive)
base16-tomorrow-dark-theme, v1.1.0 (inactive)
base16-tomorrow-light-theme, v1.1.1 (inactive)
one-dark-ui, v1.3.2 (active)
one-light-ui, v1.3.2 (inactive)
one-dark-syntax, v1.2.0 (active)
one-light-syntax, v1.2.0 (inactive)
solarized-dark-syntax, v1.0.2 (inactive)
solarized-light-syntax, v1.0.2 (inactive)
about, v1.5.2 (active)
archive-view, v0.61.1 (active)
autocomplete-atom-api, v0.10.0 (active)
autocomplete-css, v0.11.1 (active)
autocomplete-html, v0.7.2 (active)
autocomplete-plus, v2.31.0 (active)
autocomplete-snippets, v1.11.0 (active)
autoflow, v0.27.0 (inactive)
autosave, v0.23.1 (active)
background-tips, v0.26.0 (active)
bookmarks, v0.41.0 (active)
bracket-matcher, v0.82.1 (active)
command-palette, v0.38.0 (inactive)
deprecation-cop, v0.54.1 (active)
dev-live-reload, v0.47.0 (active)
encoding-selector, v0.22.0 (active)
exception-reporting, v0.39.0 (active)
fuzzy-finder, v1.3.0 (active)
git-diff, v1.1.0 (active)
find-and-replace, v0.198.0 (inactive)
go-to-line, v0.31.0 (inactive)
grammar-selector, v0.48.1 (active)
image-view, v0.58.0 (active)
incompatible-packages, v0.26.1 (active)
keybinding-resolver, v0.35.0 (active)
line-ending-selector, v0.5.0 (active)
link, v0.31.1 (inactive)
markdown-preview, v0.158.0 (active)
metrics, v0.53.1 (active)
notifications, v0.64.1 (active)
open-on-github, v1.2.0 (inactive)
package-generator, v1.0.0 (inactive)
settings-view, v0.238.2 (active)
snippets, v1.0.2 (active)
spell-check, v0.67.1 (active)
status-bar, v1.4.1 (active)
styleguide, v0.46.0 (active)
symbols-view, v0.113.0 (inactive)
tabs, v0.98.1 (active)
timecop, v0.33.1 (active)
tree-view, v0.208.0 (active)
update-package-dependencies, v0.10.0 (active)
welcome, v0.34.0 (active)
whitespace, v0.32.2 (active)
wrap-guide, v0.38.1 (active)
language-c, v0.52.1 (active)
language-clojure, v0.21.0 (active)
language-coffee-script, v0.47.0 (active)
language-csharp, v0.12.1 (active)
language-css, v0.36.2 (active)
language-gfm, v0.86.0 (active)
language-git, v0.13.0 (active)
language-go, v0.42.0 (active)
language-html, v0.44.1 (active)
language-hyperlink, v0.16.0 (active)
language-java, v0.22.0 (active)
language-javascript, v0.119.0 (active)
language-json, v0.18.0 (active)
language-less, v0.29.3 (active)
language-make, v0.22.2 (active)
language-mustache, v0.13.0 (active)
language-objective-c, v0.15.1 (active)
language-perl, v0.35.0 (active)
language-php, v0.37.0 (active)
language-property-list, v0.8.0 (active)
language-python, v0.45.0 (active)
language-ruby, v0.68.5 (active)
language-ruby-on-rails, v0.25.0 (active)
language-sass, v0.52.0 (active)
language-shellscript, v0.22.3 (active)
language-source, v0.9.0 (active)
language-sql, v0.21.1 (active)
language-text, v0.7.1 (active)
language-todo, v0.28.0 (active)
language-toml, v0.18.0 (active)
language-xml, v0.34.8 (active)
language-yaml, v0.26.0 (active)

# Dev
No dev packages

JS error and rebuilds triggered

Hi,

I'm not sure why this happens, but for some of my repositories linter-rust triggers a complete rebuild, and then crashes with the following error:

SyntaxError: Unexpected number
    at Object.parse (native)
    at LinterRust.parseJSON (/Users/noren/.atom/packages/linter-rust/lib/linter-rust.coffee:79:24)
    at LinterRust.parseJSON (/Users/noren/.atom/packages/linter-rust/lib/linter-rust.coffee:1:1)
    at exit (/Users/noren/.atom/packages/linter-rust/lib/linter-rust.coffee:54:25)
    at triggerExitCallback (/Applications/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:215:47)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:222:18
    at Socket.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:100:18)
    at emitOne (events.js:95:20)
    at Socket.emit (events.js:182:7)
    at Pipe._onclose (net.js:477:12)

The rebuild also crashes so if I run cargo run after this it needs to build the whole project from scratch.

The only "special" things about these repos that I can think of is that they have a .cargo/config with a bunch of linking statements:

[target.x86_64-pc-windows-gnu.assimp]
rustc-link-search = ["../../pixelport_deps/assimp/v3.2/x86_64-pc-windows-gnu"]
rustc-link-lib = ["assimp", "stdc++"]

Versions

  • rustc 1.13.0-nightly (497d67d70 2016-09-01)
  • linter-rust 0.5.6
  • atom 1.10.2

Can't clear "Specified Features"

The new "Specified Features" setting defaults to "test", and it is impossible to clear it. If you leave the field blank, Atom resets it to the default of "test" again. Cargo fails when passed nonexistent --features arguments, and linter-rust silently ignores the failure and reports "No Errors".

When specifying the full path of rustc on windows, it seems to run rustc incorrectly

If I specify my full path to rustc.exe like:

Rustc path

then whenever I save I get this error:

Error: Command failed: C:\Program Files\Rust\bin\rustc.exe --version
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
    at checkExecSyncError (child_process.js:481:13)
    at Object.execSync (child_process.js:521:13)
    at LinterRust.ableToJSONErrors (file:///C:/Users/admin/.atom/packages/linter-rust/lib/linter-rust.coffee:233:20)
    at LinterRust.ableToJSONErrors (file:///C:/Users/admin/.atom/packages/linter-rust/lib/linter-rust.coffee:1:1)
    at file:///C:/Users/admin/.atom/packages/linter-rust/lib/linter-rust.coffee:33:37
    at LinterRust.lint (file:///C:/Users/admin/.atom/packages/linter-rust/lib/linter-rust.coffee:21:16)
    at Object.lint (file:///C:/Users/admin/.atom/packages/linter-rust/lib/linter-rust.coffee:1:1)
    at promises.push.Promise.then._this.emitter.emit.linter (C:/Users/admin/.atom/packages/linter/lib/linter-registry.js:63:26)
    at C:/Users/admin/.atom/packages/linter/lib/linter-registry.js:62:23
    at Set.forEach (native)
    at LinterRegistry.lint (C:/Users/admin/.atom/packages/linter/lib/linter-registry.js:60:18)
    at file:///C:/Users/admin/.atom/packages/linter/lib/linter.coffee:98:16
    at Function.module.exports.Emitter.simpleDispatch (C:\Users\admin\AppData\Local\atom\app-1.10.2\resources\app.asar\node_modules\event-kit\lib\emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (C:\Users\admin\AppData\Local\atom\app-1.10.2\resources\app.asar\node_modules\event-kit\lib\emitter.js:125:28)
    at C:/Users/admin/.atom/packages/linter/lib/editor-linter.js:30:20
    at Function.module.exports.Emitter.simpleDispatch (C:\Users\admin\AppData\Local\atom\app-1.10.2\resources\app.asar\node_modules\text-buffer\node_modules\event-kit\lib\emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (C:\Users\admin\AppData\Local\atom\app-1.10.2\resources\app.asar\node_modules\text-buffer\node_modules\event-kit\lib\emitter.js:129:28)
    at TextBuffer.module.exports.TextBuffer.saveAs (C:\Users\admin\AppData\Local\atom\app-1.10.2\resources\app.asar\node_modules\text-buffer\lib\text-buffer.js:1156:27)
    at TextBuffer.module.exports.TextBuffer.save (C:\Users\admin\AppData\Local\atom\app-1.10.2\resources\app.asar\node_modules\text-buffer\lib\text-buffer.js:1126:19)
    at TextEditor.module.exports.TextEditor.save (C:\Users\admin\AppData\Local\atom\app-1.10.2\resources\app.asar\src\text-editor.js:755:26)
    at Pane.module.exports.Pane.saveItem (C:\Users\admin\AppData\Local\atom\app-1.10.2\resources\app.asar\src\pane.js:734:18)
    at Pane.saveItem (C:\Users\admin\AppData\Local\atom\app-1.10.2\resources\app.asar\src\pane.js:3:61)
    at Pane.module.exports.Pane.saveActiveItem (C:\Users\admin\AppData\Local\atom\app-1.10.2\resources\app.asar\src\pane.js:717:19)
    at Workspace.module.exports.Workspace.saveActivePaneItem (C:\Users\admin\AppData\Local\atom\app-1.10.2\resources\app.asar\src\workspace.js:695:35)
    at atom-workspace.commandRegistry.add.core:save (C:\Users\admin\AppData\Local\atom\app-1.10.2\resources\app.asar\src\register-default-commands.js:220:32)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\admin\AppData\Local\atom\app-1.10.2\resources\app.asar\src\command-registry.js:260:29)
    at C:\Users\admin\AppData\Local\atom\app-1.10.2\resources\app.asar\src\command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (C:\Users\admin\AppData\Local\atom\app-1.10.2\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:580:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (C:\Users\admin\AppData\Local\atom\app-1.10.2\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:388:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (C:\Users\admin\AppData\Local\atom\app-1.10.2\resources\app.asar\src\window-event-handler.js:98:36)
    at HTMLDocument.<anonymous> (C:\Users\admin\AppData\Local\atom\app-1.10.2\resources\app.asar\src\window-event-handler.js:3:61)

If I just specify "rustc.exe" it seems to work just fine, thought I'd throw this issue up anyway as I'm not sure what's going on

Edit: this is fixed by enclosing the rustc path in quotes, while cargo works fine - if I then enclose cargo's path in quotes I get this in --dev mode:

'""C:\Program' is not recognized as an internal or external command,
operable program or batch file.

Allow using multirust

I’d like to use multirust run nightly cargo as command instead of default cargo, in order to make clippy work

Specify features

Apparently clippy does no longer set the clippy feature flag automatically due to some incompatibilities. I'd like to request an entry in the options menu which lets me specify features passed to the cargo command (space or comma separated list would suffice).
#30 may be related to this.

Invalid arguments when using rust 1.13 (nightly)

Updated rust today, and got an invalid arguments error. Looking into this it seems cargo has a problem with the -- --error-format=json part. Asking in the #rust channel it seems this was never an accepted way to pass commands to rustc via cargo. Using the rustc option however will result in "invalid specified features" errors being spammed for every line of output given from cargo.

Prevents cargo from building while Atom is open

while editing my code with the plugin enabled if I open a command prompt and type "cargo run" the build is blocked until I close atom since the build directory is locked.

Environment info:
Windows 10
Shell used to run the command: cmd.exe

To reproduce: With plugin enabled edit an rs file with Atom in a cargo project then save it. Then without closing the file or Atom, open a command prompt in the cargo project directory and run "cargo run" it should show a teal "blocking" error until Atom is closed. This doesn't occur though if linter-rust is disabled or uninstalled.

Unresolved imports

As mentioned by @jgillich in #1, the linter fails to resolve imports that work fine in the actual cargo build command. I think this deserves its own issue, given that #1 is closed.

linter-rust causing total breakage

Enabling linter-rust causes language-rust to crash, making atom hang until it notices said hanging and shows the Close / Keep Waiting message.

Additionally it causes autocomplete-plus and racer to stop working.

In order to get them working again I have to

  • disable all community packages
  • restart atom
  • enable them again (except linter-rust)
  • restart atom again

after that autocomplete-plus, racer and language-rust are working again, no hanging or anything.

I have linter installed.
Atom version: 0.199.0
OS: Windows 8.1 Pro 64 bit

linter does not work with modules

The linter shows error file not found for module 'mytest' on the module import line.

// main.rs
mod mytest; // causes "error file not found for module `mytest`"

fn main() {
    println!("Hello, world!")
    let x  = mytest::Bla{test : 99};
}
// mytest.rs
pub struct Bla {
  pub test : int
}

Wrong location reporting

I've just installed as a brand new both Atom and linter-rust. For some reason all of my errors get reported as line 1, col 1. Would be nice if that can be fixed.

cargo-check cannot be used with multi-target crate

cargo check cannot be used directly in a multi-target crate, one has to state which target to build (the library or a selected binary).

Fixing this could get a bit tedious since selecting a target binary will be project specific, not a general option for the linter. But targeting the library can be a global option. Therefore I propose to add another command to the drop-down menu dubbed check --lib, which invokes cargo check --lib.

This way people can at least build the library in a multi-target crate for now.

Doesn't seem to be working on Windows

It doesn't seem to be reporting issues anymore. It keeps reporting no issues, even though I deliberately made an issue that cargo warned about.

Versions it doesn't work with:
Linter 1.1.0
linter-rust 0.2.0
Rust 1.1

Versions it doesn't work with:
Linter 1.1.0
linter-rust 0.2.0
Rust 1.0

Versions it does work with:
Linter 1.1.0
linter-rust 0.1.0
Rust 1.0

options.PATH ignored by BufferedProcess

I've been experiencing a bug after upgrading to version 0.4.6 where I'm not getting any error messages from Cargo. After delving into the code and eventually (accidentally) realizing that the issue disappears when Atom is run directly from the command line, I tracked down the issue to this. While making a copy rather than modifying global state definitely seems like a better idea, it seems to be preventing Cargo from being properly run for me because BufferedProcess actually uses the global state—it doesn't even look at options.PATH! The documentation here indicates that the options it uses don't include the path, and in the function definition it calls getCmdPath, which looks directly at process.env. I'm not sure when this change occurred in Atom (I looked back a few commits on the file without seeing anything about the path), but it appears that BufferedProcess has been ignoring the custom path for a while, and using custom paths only worked before due to the fluke of modifying the global state.

Given that this bug will only occur in very specific setups (i.e. not running Atom from the command line and having cargo/rustc installed in non-standard path locations) and that the issue seems to be more with the BufferedReader and not with the package (forcing people to modify global state just seems like bad practice), I can understand if you'd prefer not to change it back to modifying the global state. However, I figured it would still be worth reporting the issue just so you'd be aware that the custom path was being ignored (and due to the off chance that someone else ends up having the same issue as me and wants to know what causes it).

Switching between terminal and Atom with linter-rust causes a clean rebuild

This causes long rebuilds of a full project.
However, if I remain in one environment (say linter-rust) clean rebuilds do not happen.

This was introduced recently, probably, with my change of how environment is passed to cargo.

I will debug this and try to fix, but I'm curious if I'm the only one who encountered this.
Please upvote this or leave a response if you have experienced such an issue.

Failed to run cargo

OS X v10.11.1
Atom v1.2.1

I received the following error on every save

Failed to run cargo
spawn cargo ENOENT

Error: EPERM: operation not permitted, write

When running the linter on a rust file I get the error Error: EPERM: operation not permitted, write. This happens regardless of which cargo command I choose.

I am running atom 1.9.9, windows 10 (with anniversary update), linter-rust 0.5.4 and rust 1.13.

Here is the whole error message.

Error: EPERM: operation not permitted, write
at Error (native)
at Object.fs.writeSync (fs.js:706:20)
at SyncWriteStream.write (fs.js:2064:6)
at Object.execSync (child_process.js:519:20)
at LinterRust.ableToJSONErrors (file:///C:/Users/Magnus/.atom/packages/linter-rust/lib/linter-rust.coffee:218:20)
at LinterRust.ableToJSONErrors (file:///C:/Users/Magnus/.atom/packages/linter-rust/lib/linter-rust.coffee:1:1)
at LinterRust.initCmd (file:///C:/Users/Magnus/.atom/packages/linter-rust/lib/linter-rust.coffee:202:62)
at LinterRust.initCmd (file:///C:/Users/Magnus/.atom/packages/linter-rust/lib/linter-rust.coffee:1:1)
at file:///C:/Users/Magnus/.atom/packages/linter-rust/lib/linter-rust.coffee:21:15
at LinterRust.lint (file:///C:/Users/Magnus/.atom/packages/linter-rust/lib/linter-rust.coffee:19:16)
at Object.lint (file:///C:/Users/Magnus/.atom/packages/linter-rust/lib/linter-rust.coffee:1:1)
at promises.push.Promise.then._this.emitter.emit.linter (C:/Users/Magnus/.atom/packages/linter/lib/linter-registry.js:63:26)
at C:/Users/Magnus/.atom/packages/linter/lib/linter-registry.js:62:23
at Set.forEach (native)
at LinterRegistry.lint (C:/Users/Magnus/.atom/packages/linter/lib/linter-registry.js:60:18)
at file:///C:/Users/Magnus/.atom/packages/linter/lib/linter.coffee:98:16
at Function.module.exports.Emitter.simpleDispatch (C:\Users\Magnus\AppData\Local\atom\app-1.9.9\resources\app.asar\node_modules\event-kit\lib\emitter.js:25:14)
at Emitter.module.exports.Emitter.emit (C:\Users\Magnus\AppData\Local\atom\app-1.9.9\resources\app.asar\node_modules\event-kit\lib\emitter.js:125:28)
at C:/Users/Magnus/.atom/packages/linter/lib/editor-linter.js:30:20
at Function.module.exports.Emitter.simpleDispatch (C:\Users\Magnus\AppData\Local\atom\app-1.9.9\resources\app.asar\node_modules\text-buffer\node_modules\event-kit\lib\emitter.js:25:14)
at Emitter.module.exports.Emitter.emit (C:\Users\Magnus\AppData\Local\atom\app-1.9.9\resources\app.asar\node_modules\text-buffer\node_modules\event-kit\lib\emitter.js:129:28)
at TextBuffer.module.exports.TextBuffer.saveAs (C:\Users\Magnus\AppData\Local\atom\app-1.9.9\resources\app.asar\node_modules\text-buffer\lib\text-buffer.js:1156:27)
at TextBuffer.module.exports.TextBuffer.save (C:\Users\Magnus\AppData\Local\atom\app-1.9.9\resources\app.asar\node_modules\text-buffer\lib\text-buffer.js:1126:19)
at TextEditor.module.exports.TextEditor.save (C:\Users\Magnus\AppData\Local\atom\app-1.9.9\resources\app.asar\src\text-editor.js:755:26)
at Pane.module.exports.Pane.saveItem (C:\Users\Magnus\AppData\Local\atom\app-1.9.9\resources\app.asar\src\pane.js:734:18)
at Pane.saveItem (C:\Users\Magnus\AppData\Local\atom\app-1.9.9\resources\app.asar\src\pane.js:3:61)
at Pane.module.exports.Pane.saveActiveItem (C:\Users\Magnus\AppData\Local\atom\app-1.9.9\resources\app.asar\src\pane.js:717:19)
at Workspace.module.exports.Workspace.saveActivePaneItem (C:\Users\Magnus\AppData\Local\atom\app-1.9.9\resources\app.asar\src\workspace.js:699:35)
at atom-workspace.commandRegistry.add.core:save (C:\Users\Magnus\AppData\Local\atom\app-1.9.9\resources\app.asar\src\register-default-commands.js:220:32)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\Magnus\AppData\Local\atom\app-1.9.9\resources\app.asar\src\command-registry.js:260:29)
at C:\Users\Magnus\AppData\Local\atom\app-1.9.9\resources\app.asar\src\command-registry.js:3:61
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (C:\Users\Magnus\AppData\Local\atom\app-1.9.9\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:580:16)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (C:\Users\Magnus\AppData\Local\atom\app-1.9.9\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:388:22)
at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (C:\Users\Magnus\AppData\Local\atom\app-1.9.9\resources\app.asar\src\window-event-handler.js:98:36)
at HTMLDocument. (C:\Users\Magnus\AppData\Local\atom\app-1.9.9\resources\app.asar\src\window-event-handler.js:3:61)

Multiline lints cut off

Multiline lints, like type mismatches, are cut off when shown inline or below the editor. Only the first line is shown.

All columns reported as 1

All lints always say e.g. “at line 151 col 1”, when Cargo reports “src/lang/parser.rs:151:13: 151:73”. It should say “at line 151 col 13” in this case.

Cargo and PATH environment

When using Cargo for linting, rustc must be somewhere in the PATH. When instead using rustc, it works without setting the PATH. This is confusing and, particularly on OSX, setting the PATH across all ways of launching Atom is not so easy.

This would probably be easier to deal with if you could specify a rust home directory at cargo's command line.

Support for new JSON format in nightly currently unsupported

On OS X, rust-linter does not work with anything newer than nightly-2016-08-09-x86_64-apple-darwin and rust-linter version 0.4.6. Updating either the toolchain or linter-rust and it simply stops linting.

I'm happy to run this down but I do not see how to get debugging logs to understand what is happening. Please advise.

Use Cargo instead of rustc

Hey there!
Thanks for the awesome package, unfortunately it is not very useful yet because most rust projects are built using the Cargo package manager which handles dependencies etc.

Since this package uses rustc you get errors for any external crates, which makes it impractical for any real-world projects :-(

For inspiration you can take a look at the SublimeText 3 package that integrates with Cargo:
SublimeLinter-contrib-rustc

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/seif/.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)

error in imported file is displayed in current file

when linting main.rs, the bad line in mytest.rs causes a lint to be displayed in main.rs at the same line and column.

// main.rs
mod mytest; // causes "error file not found for module `mytest`"

fn main() { // error is shown in this line
    println!("Hello, world!")
    let x  = mytest::Bla{test : 99};
}
// mytest.rs
pub struct Bla {
  pub test : int,
  i am a bug!
}

Slow startup

linter-rust adds 28ms to my startup time, compared to 37ms for linter and 0ms for everything else. This startup time should be <= 5ms.

Doesn't work at all on Windows

rustc.exe is already in my %PATH%.

If left as the default value (empty), I get the following error:
Uncaught Error: ENOENT, no such file or directory '<project directory>\rustc' fs.js:726
If set to where Rust is installed, I get the following error:

Linter-Rust: "C:\Program Files (x86)\Rust\bin\rustc.exe" was not executable: "#1: stderr: 'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
". Please, check executable path in the linter settings.

If set to where Rust is installed with wrapping quotes, I get the following error:
Uncaught Error: ENOENT, no such file or directory '<project directory>\"C:\Program Files (x86)\Rust\bin\rustc.exe"'

Even if I go full workaround mode and set the executable path setting to ../../../../PROGRA~2/Rust/bin/rustc.exe nothing seems to happen.

Error using Rust nightly on Windows.

For some reason, the linter gives this error message on nightly, but not on stable;

Failed to run cargo with exit code 3221225781
with args:
 build -j 2 --manifest-path D:\Projects\tamr\tamr\Cargo.toml --message-format json
See console for more information

If I run the command in the console, this is the error:

cargo build -j 2 --manifest-path D:\Projects\tamr\tamr\Cargo.toml --message-format json
error: the manifest-path must be a path to a Cargo.toml file

The issue seems to be that the manifest path is not surrounded by quotes. It also works fine if I use / instead of \.

What confuses me is that the linter works on stable Rust, even though cargo doesn't accept the unquoted path there, either. Does linter-rust quote the path on stable, but not on nightly?

Dead code warning for main() function.

This code

fn main() {

}

raises a warning

function is never used: `main`, #[warn(dead_code)] on by default at line 1 col 1

during linting. Not to be expected ;).

Using Atom 1.0.2, with linter-rust 0.2.5, linter 1.2.4 on Debian Jessie.

nightly-2016-08-10 breaks error output format

As of 2016-08-10, as specified in this article, nightly rustc switched to the new error output format, which is not supported by the current version of linter-rust.

I see this as a perfect moment to add a support for the JSON error output of rustc, which eventually is going to be stabilised into stable version.

No lints using rustup

I'm not able to get any lint output.

I'm using rustup and rustc nightly:

>  ~/Development/rust/ricem [master] rustup --version
rustup 0.6.3 (a0e2132 2016-08-28)
>  ~/Development/rust/ricem [master] rustc --version
rustc 1.13.0-nightly (2c01bb885 2016-08-31)

Atom isn't showing any errors, is there a way to get some output to figure out whats going on?

>  ~/Development/rust/ricem [master] apm list
...
Community Packages (73) /home/leshow/.atom/packages
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

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.