Giter VIP home page Giter VIP logo

linter's Introduction

Linter

Slack Badge Build Status Plugin installs! Package version! Dependencies! OpenCollective OpenCollective

Linter is a base linter provider for the hackable Atom Editor. Additionally, you need to install a specific linter for your language. You will find a full list on atomlinter.github.io.

It provides a top-level API to its consumer so that they can visualize errors and other types of messages with ease.

Preview

How to / Installation

You can install through the CLI by doing:

$ apm install linter

Or you can install from Settings view by searching for Base Linter, (this package might not show up when searching for Linter).

Linter automatically installs linter-ui-default, which is required for the functionality of this package.

API Documentation

Please navigate to steelbrain.me/linter for Linter v2 documentation.

Contribute

Stick to imposed codestyle:

  • $ npm i
  • $ npm lint
  • $ npm test

linter's People

Contributors

aminya avatar arcanemagus avatar asaayers avatar asutherland avatar blakeembrey avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar despairblue avatar devoncarew avatar ericcornelissen avatar fusion809 avatar greenkeeper[bot] avatar greenkeeperio-bot avatar hansonw avatar hd-deman avatar iam4x avatar icecream17 avatar joefitzgerald avatar johnmurga avatar josa42 avatar keplersj avatar levity avatar lierdakil avatar samueloph avatar shaungrady avatar simurai avatar steelbrain avatar vinkla avatar yitzchak 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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

linter's Issues

debounce linting on modified

It would improve performance and reduce the flickering of the errors while typing if the linter were to debounce the 'lint on modified'.

Just a thought. :)

On Linux, need to make tmp folder HOME path to work

Let me shorten the story. Telling you the cause

  1. We are using temp 0.6.0 version to open a temp file

  2. temp 0.6.0 version is using osenv 0.0.3 version to get os.tmpdir.

    the packages.json file for temp 0.6.0: https://github.com/bruce/node-temp/blob/v0.6.0/package.json

  3. osenv has a bug to return /home/{username}/tmp as temp folder on Linux

    the related bug: npm/osenv#4

  4. Finally, we are using /home/{username}/tmp to store the temp data, which is often does not exists. An error is thrown.

Resolve method:

Simply update the temp package from 0.6.0 to 0.8.0, which is not dependent on osenv any more. It is using nodejs pure os.tmpdir to get temp folder, which is /tmp on Linux.

I will send a RP soon. Feel free to verify the bug.

toggle causes error

I'm not sure if this is the same issue as #1. But I don't get any warning. In fact I'm not not sure if this is a problem anyway. It's just I get an error when starting the editor saying that there is no method toggle() defined on the linter plugin.

That's the line of code

  # Activate the plugin
  activate: ->
    atom.workspaceView.command 'linter:toggle', => @toggle()
    @linterViews = []

The error is

Uncaught TypeError: Object #<Object> has no method 'toggle'

Linter Causing error every time it lints

Linting causes a "Uncaught TypeError: Cannot call method 'tokenAtBufferColumn' of undefined " in "/Applications/Atom.app/Contents/Resources/app/src/tokenized-buffer.js:406".

accountcontroller_php_-__users_mattharmon_documents_dev_workspace_myfitness

Config should be camel case

When you observe a config value, it will be added into the atom.config and it not seems to be a good behavior to have not camel case config name.

screen shot 2014-05-30 at 3 21 15 pm

Permission denied on `/var/folders/..`

While finishing the linter-pylint I ended up in the following shell-error during linter-execution:

"/bin/sh: /var/folders/2r/mdqjbmzs5vlb3c7g2qj3g1j80000gn/T/114421-6791-1gz3frjsource.python: Permission denied↡"

Does anybody know where it comes from? The var-folders should be accessible in general. And if they aren't shouldn't we check that?

Installation fails on Windows

EDIT: Sorry for the buzz, Upon further inspection, this seems to be an issue with Atom itself.

> [email protected] install C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl\node_modules\linter\node_modules\copy-paste\node_modules\execSync
> node-gyp rebuild


C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl\node_modules\linter\node_modules\copy-paste\node_modules\execSync>node "c:\Program Files\Atom\resources\app\apm\node_modules\atom-package-manager\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild 

npm http GET https://registry.npmjs.org/copy-paste
npm http GET https://registry.npmjs.org/emissary
npm http GET https://registry.npmjs.org/font-awesome/4.0.3
npm http GET https://registry.npmjs.org/shelljs
npm http GET https://registry.npmjs.org/temp/0.6.0
npm http GET https://registry.npmjs.org/jshint
npm http GET https://registry.npmjs.org/lodash
npm http GET https://registry.npmjs.org/xregexp/2.0.0
npm http 304 https://registry.npmjs.org/shelljs
npm http 304 https://registry.npmjs.org/temp/0.6.0
npm http 304 https://registry.npmjs.org/copy-paste
npm http 304 https://registry.npmjs.org/emissary
npm http 304 https://registry.npmjs.org/jshint
npm http 304 https://registry.npmjs.org/lodash
npm http 304 https://registry.npmjs.org/xregexp/2.0.0
npm http 304 https://registry.npmjs.org/font-awesome/4.0.3
npm http GET https://registry.npmjs.org/execSync
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/osenv/0.0.3
npm http GET https://registry.npmjs.org/underscore-plus
npm http GET https://registry.npmjs.org/mixto
npm http GET https://registry.npmjs.org/property-accessors
npm http 304 https://registry.npmjs.org/execSync
npm ERR! Error: ENOENT, lstat 'C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl\node_modules\linter\node_modules\shelljs\src\chmod.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "c:\\Program Files\\Atom\\resources\\app\\apm\\node_modules\\atom-package-manager\\bin\\\\node.exe" "c:\\Program Files\\Atom\\resources\\app\\apm\\node_modules\\atom-package-manager\\node_modules\\npm\\bin\\npm-cli.js" "--globalconfig" "c:\\Program Files\\Atom\\resources\\app\\apm\\node_modules\\atom-package-manager\\.apmrc" "--userconfig" "C:\\Users\\Jan\\.atom\\.apmrc" "install" "C:\\Users\\Jan\\.atom\\.node-gyp\\.atom\\.apm\\linter\\0.4.9\\package.tgz" "--target=0.11.10" "--arch=ia32" "--msvs_version=2012"
npm ERR! cwd C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.4
npm ERR! path C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl\node_modules\linter\node_modules\shelljs\src\chmod.js
npm ERR! fstream_path C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl\node_modules\linter\node_modules\shelljs\src\chmod.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack c:\Program Files\Atom\resources\app\apm\node_modules\atom-package-manager\node_modules\npm\node_modules\fstream\lib\writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat 'C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl\node_modules\linter\node_modules\font-awesome\src\3.2.1\assets\font-awesome\css\font-awesome-ie7.min.css'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "c:\\Program Files\\Atom\\resources\\app\\apm\\node_modules\\atom-package-manager\\bin\\\\node.exe" "c:\\Program Files\\Atom\\resources\\app\\apm\\node_modules\\atom-package-manager\\node_modules\\npm\\bin\\npm-cli.js" "--globalconfig" "c:\\Program Files\\Atom\\resources\\app\\apm\\node_modules\\atom-package-manager\\.apmrc" "--userconfig" "C:\\Users\\Jan\\.atom\\.apmrc" "install" "C:\\Users\\Jan\\.atom\\.node-gyp\\.atom\\.apm\\linter\\0.4.9\\package.tgz" "--target=0.11.10" "--arch=ia32" "--msvs_version=2012"
npm ERR! cwd C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.4
npm ERR! path C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl\node_modules\linter\node_modules\font-awesome\src\3.2.1\assets\font-awesome\css\font-awesome-ie7.min.css
npm ERR! fstream_path C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl\node_modules\linter\node_modules\font-awesome\src\3.2.1\assets\font-awesome\css\font-awesome-ie7.min.css
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack c:\Program Files\Atom\resources\app\apm\node_modules\atom-package-manager\node_modules\npm\node_modules\fstream\lib\writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat 'C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl\node_modules\linter\node_modules\jshint\data\non-ascii-identifier-start.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "c:\\Program Files\\Atom\\resources\\app\\apm\\node_modules\\atom-package-manager\\bin\\\\node.exe" "c:\\Program Files\\Atom\\resources\\app\\apm\\node_modules\\atom-package-manager\\node_modules\\npm\\bin\\npm-cli.js" "--globalconfig" "c:\\Program Files\\Atom\\resources\\app\\apm\\node_modules\\atom-package-manager\\.apmrc" "--userconfig" "C:\\Users\\Jan\\.atom\\.apmrc" "install" "C:\\Users\\Jan\\.atom\\.node-gyp\\.atom\\.apm\\linter\\0.4.9\\package.tgz" "--target=0.11.10" "--arch=ia32" "--msvs_version=2012"
npm ERR! cwd C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.4
npm ERR! path C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl\node_modules\linter\node_modules\jshint\data\non-ascii-identifier-start.js
npm ERR! fstream_path C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl\node_modules\linter\node_modules\jshint\data\non-ascii-identifier-start.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack c:\Program Files\Atom\resources\app\apm\node_modules\atom-package-manager\node_modules\npm\node_modules\fstream\lib\writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm http 304 https://registry.npmjs.org/rimraf
npm ERR! Error: ENOENT, lstat 'C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl\node_modules\linter\node_modules\lodash\dist\lodash.compat.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "c:\\Program Files\\Atom\\resources\\app\\apm\\node_modules\\atom-package-manager\\bin\\\\node.exe" "c:\\Program Files\\Atom\\resources\\app\\apm\\node_modules\\atom-package-manager\\node_modules\\npm\\bin\\npm-cli.js" "--globalconfig" "c:\\Program Files\\Atom\\resources\\app\\apm\\node_modules\\atom-package-manager\\.apmrc" "--userconfig" "C:\\Users\\Jan\\.atom\\.apmrc" "install" "C:\\Users\\Jan\\.atom\\.node-gyp\\.atom\\.apm\\linter\\0.4.9\\package.tgz" "--target=0.11.10" "--arch=ia32" "--msvs_version=2012"
npm ERR! cwd C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.4
npm ERR! path C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl\node_modules\linter\node_modules\lodash\dist\lodash.compat.js
npm ERR! fstream_path C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl\node_modules\linter\node_modules\lodash\dist\lodash.compat.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack c:\Program Files\Atom\resources\app\apm\node_modules\atom-package-manager\node_modules\npm\node_modules\fstream\lib\writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm http GET https://registry.npmjs.org/temp
npm http 304 https://registry.npmjs.org/mixto
npm http 304 https://registry.npmjs.org/underscore-plus
npm http 304 https://registry.npmjs.org/property-accessors
npm ERR! not found: git
npm ERR! 
npm ERR! Failed using git.
npm ERR! This is most likely not a problem with npm itself.
npm ERR! Please check if you have git installed and in your PATH.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "c:\\Program Files\\Atom\\resources\\app\\apm\\node_modules\\atom-package-manager\\bin\\\\node.exe" "c:\\Program Files\\Atom\\resources\\app\\apm\\node_modules\\atom-package-manager\\node_modules\\npm\\bin\\npm-cli.js" "--globalconfig" "c:\\Program Files\\Atom\\resources\\app\\apm\\node_modules\\atom-package-manager\\.apmrc" "--userconfig" "C:\\Users\\Jan\\.atom\\.apmrc" "install" "C:\\Users\\Jan\\.atom\\.node-gyp\\.atom\\.apm\\linter\\0.4.9\\package.tgz" "--target=0.11.10" "--arch=ia32" "--msvs_version=2012"
npm ERR! cwd C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.4
npm ERR! code ENOGIT
npm http 304 https://registry.npmjs.org/osenv/0.0.3
npm http GET https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/temp
gyp: binding.gyp not found (cwd: C:\Users\Jan\AppData\Local\Temp\apm-install-dir-11459-8088-191nofl\node_modules\linter\node_modules\copy-paste\node_modules\execSync)
gypnpm WARN optional dep failed, continuing [email protected]
npm

Lint errors break hotkeys on lines

I have linter-jshint installed at the moment and sometimes when an error is found on a line, I can't use hotkeys on that line. I've been running into it a lot when commenting out lines. If I comment out an assignment of a variable and get the "not defined" error on a line using that variable, I can't comment it out.

Linter causes Uncaught TypeError on Atom 0.99.0

When linting it displays Uncaught TypeError: First argument must be a file descriptor

captura de pantalla de 2014-05-27 09 52 18

apm list
Built-in Atom packages (74)
β”œβ”€β”€ [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]
└── [email protected]

/home/carlos/.atom/packages (3)
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
└── [email protected]

Temporary file is being created in $HOME/tmp instead of just /tmp (TypeError)

Hi! I built Atom on Ubuntu 14.04 and I get the following error when the linter runs (on any supported file):

>>> Uncaught TypeError: First argument must be file descriptor     fs.js:503

The root of the error is in

~/.atom/packages/linter/node_modules/temp/lib/temp.js:152

Exactly here, in the open function:

var filePath = generateName(affixes, 'f-')

The generated path has the user's home as root so it tries to create the temporary file in

/home/username/tmp/[...] // No tmp directory present by default in a user's home -> error

instead of just

/tmp/[...]

My workaround was to add a line to clean the path

var filePath = generateName(affixes, 'f-')
filePath = filePath.substr(filePath.indexOf('/tmp'));

After this modification the linter runs perfectly fine. Hope you can fix the problem. A thousand thanks for your effort! πŸ‘

SBT daemon linter

So I built https://github.com/rockymadden/linter-sbt

One of the larger cons to this linter is the startup time involved with SBT itself (~6s). However, SBT has the ability to watch for project filesystem changes and automatically compile via sbt '~ compile', all of which is fast (~250ms).

I am running rudimentary version of this concept on my local workstation where essentially sbt '~ compile' is spawned just once for all of Atom and the linter essentially looks for events in the stdout stream coming out from it.

While I still use parts of Linter, some code essentially circumvents it entirely to handle for this scenario. To the end user, they cannot tell. However, I was curious if you had run into such a scenarios before (perhaps with Sublime linters) and if there is a more graceful way you might suggest going about it?

Changelog?

Do you think you can either create a changelog file or add a page to the wiki with a changelog of the package?

Refactoring for tests and advanced debugging

I could imagine a refactoring of the Linter, to have a more robust interface, detecting weaknesses in the linters (providing a usable debug-information, which may be reported), being fully test-suited and well-documented. As long as the whole system isn't too big it should be done in effortable time.

❓

Project-wide config-file?

I'm currently implementing more possibilities to change the behaviour of the linter. One important thing in the java-world is linting for specific versions. Currently i'm going to offer an additional package-setting to achieve that.

But I think it would be better to put this in a project-wide config-file. F.e. into .editorconfig. What do you think?

Distracting UI when editing end of file

When I'm editing the end of a file and linter warnings/errors pop up, some annoying things happen, in varying degrees:

  • The status bar sometimes covers up what I'm typing
  • The editor window jerks up and down as errors appear and disappear while I type

I have the change interval set to the default 1000ms since I want to see my errors quickly, so increasing this isn't a great solution, and even if I did this, what I just typed would still get covered up by the status bar. Ideally, the status bar would never appear in the area where I'm typing, perhaps similar to how the status bar in Chrome moves to avoid the mouse.

Gutters marks not showing

Im not a huge fan of how "Show Highlighting" marks the errors, so i prefer to keep just the gutter marks active. Currently though, the plugin isn't showing anything in the gutter area.

Linter crashes on init if linter packages are disabled

If I have several linter packages installed and disable one in the settings, linter will crash on init with
Failed to activate package named 'linter' TypeError: Cannot read property 'metadata' of undefined

I think that atom.packages.getAvailablePackageNames() gives all package names even if they're disabled.

Temporary file from buffer is deleted before linting

Hi @hd-deman

Sometimes the file is deleted before it can be linted (occurs often when I first open the file)
screen shot 2014-05-13 at 6 07 43 pm

It's arround the line 90 on linter-view.coffee.

And I see you use temp.track() also, why not use temp.cleanup() instead of fs.unlink() as you do?

Didn't really find out what was going wrong, so if you have an idea.

Support linting subgrammars

Files in atom can have multiple grammars listed. Like javascript in an html page, or ruby erb templates. The grammar for ruby.erb looks like this

https://github.com/atom/language-ruby/blob/master/grammars/html%20(ruby%20-%20erb).cson

It creates sub scopes for the places where the ruby grammar should be used. The linter should be able to inspect the editor grammar, recursively find syntax definintions, and lint the sub ranges of the file with the correct linter.

Then we wouldn't need to depend upon support in the base linter being able to parse within a container file, such as how jshint needs --extract=auto to parse within html files.

I get a file not found error from rubocop (using linter-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

Doesn't seem to load. And 'toggle' causes an error.

Uncaught TypeError: Object #<Object> has no method 'toggle' 
init.coffee:12

And I get this warning before that

Failed to activate package named 'linter' TypeError: Cannot read property 'metadata' of undefined
  at Object.module.exports.activate (/Users/yisraeldov/.atom/packages/linter/lib/init.coffee:18:55)
  at Package.module.exports.Package.activateNow (/Applications/Atom.app/Contents/Resources/app/src/package.js:161:27)
  at /Applications/Atom.app/Contents/Resources/app/src/package.js:147:28
  at Package.module.exports.Package.measure (/Applications/Atom.app/Contents/Resources/app/src/package.js:95:15)
  at Package.module.exports.Package.activate (/Applications/Atom.app/Contents/Resources/app/src/package.js:141:14)
  at PackageManager.module.exports.PackageManager.activatePackage (/Applications/Atom.app/Contents/Resources/app/src/package-manager.js:101:21)
  at PackageManager.module.exports.PackageManager.activatePackages (/Applications/Atom.app/Contents/Resources/app/src/package-manager.js:90:14)
  at PackageManager.module.exports.PackageManager.activate (/Applications/Atom.app/Contents/Resources/app/src/package-manager.js:77:19)
  at Atom.module.exports.Atom.startEditorWindow (/Applications/Atom.app/Contents/Resources/app/src/atom.js:345:21)
  at Object.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/window-bootstrap.js:14:8)
  at Object.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/window-bootstrap.js:20:4)
  at Module._compile (module.js:455:26)
  at Object.Module._extensions..js (module.js:473:10)
  at Module.load (/Applications/Atom.app/Contents/Resources/app/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:311:12)
  at Module.require (module.js:363:17)
  at require (module.js:379:17)
  at window.onload (file:///Applications/Atom.app/Contents/Resources/app/static/index.js:20:5)

Make linter package expose base linter classes when included as a node dependency

Right now all the linters extract the base linter capabilities using the following code

linterPath = atom.packages.getLoadedPackage("linter").path
Linter = require "#{linterPath}/lib/linter"
findFile = require "#{linterPath}/lib/util"

We should be able to make this more like...

{Linter, findFile) = require "linter"

By exposing the public classes across the node package. (not sure how we need to bind in to make require "linter" work though, thus why no pull request yet.

If anyone has any good ideas let me know.

Linter-results shown twice

screenshot 2014-05-19 at 09 56 38

In some cases the linter-results are shown twice.

This happens because the tool-panel is added twice.

I'm going to do further investigations.

.py files give a cannot read property `displayBuffer` of undefined

Love this linter. ❀️

Python linting seems to be having an issue. I am putting this under Linter because it seemed at first like at least one other linter (coffeescript) was having the same issue, but I cannot reproduce it now – only python.

I have Linter package is enabled, with Lint on Modified, Lint on Save, Show Gutters, Show Highlighting, Show Messages Around Cursor.

Looking at the Atom console, when I open a .py file I notice the error traceback:

Uncaught TypeError: Cannot read property 'displayBuffer' of undefined linter.coffee:156
Linter.computeRange linter.coffee:156
Linter.createMessage linter.coffee:129
(anonymous function) linter.coffee:99
self.forEach /Users/bmh/Dropbox/Apps/Atom/packages/linter/node_modules/xregexp/xregexp-all.js:542
Linter.processMessage linter.coffee:97
(anonymous function) linter.coffee:85
exithandler child_process.js:713
EventEmitter.emit events.js:104
maybeClose child_process.js:821
(anonymous function) child_process.js:1038
EventEmitter.emit events.js:101
(anonymous function) net.js:459

I am on Atom 0.96.0, and my packages are:

$ apm list
... 
/Users/bmh/.atom/packages (26)
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected] (disabled)
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected] (disabled)
β”œβ”€β”€ [email protected] (disabled)
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected] (disabled)
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected] (disabled)
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected] (disabled)
β”œβ”€β”€ [email protected] (disabled)
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
└── [email protected]

Let me know if I can be of further assistance.

Cheers.

Linter expose node exec bug in Windows

There is node bug will truncate stdout from child process.

With this bug, lint-jscs does not work fine in Windows, every time, it only returns 2 lines

<?xml version="1.0" encoding="utf-8"?>
<checkstyle version="4.3">

But, when I run the command directly in cmd, it will return:

<?xml version="1.0" encoding="utf-8"?>
<checkstyle version="4.3">
    <file name="c:\Users\junlel\Repositories\Ymarks\app.js">
        <error line="27" column="31" severity="error" message="Operator + should not stick to preceding expression" source="jscs" />
        <error line="27" column="31" severity="error" message="Operator + should not stick to following expression" source="jscs" />
        <error line="27" column="35" severity="error" message="Operator + should not stick to preceding expression" source="jscs" />
        <error line="27" column="35" severity="error" message="Operator + should not stick to following expression" source="jscs" />
    </file>
</checkstyle>

Is there a way to avoid use child process exec to run linter? Any idea on this issue?

Failed to activate package named 'linter'

I get the following error with linter on startup. I'm running the latest version of linter and Atom 0.9.6.0.

Failed to activate package named 'linter' TypeError: Cannot read property 'metadata' of undefined
  at Object.module.exports.activate (/Users/iansoper/.atom/packages/linter/lib/init.coffee:17:55)
  at Package.module.exports.Package.activateNow (/Applications/Atom.app/Contents/Resources/app/src/package.js:161:27)
  at /Applications/Atom.app/Contents/Resources/app/src/package.js:147:28
  at Package.module.exports.Package.measure (/Applications/Atom.app/Contents/Resources/app/src/package.js:95:15)
  at Package.module.exports.Package.activate (/Applications/Atom.app/Contents/Resources/app/src/package.js:141:14)
  at PackageManager.module.exports.PackageManager.activatePackage (/Applications/Atom.app/Contents/Resources/app/src/package-manager.js:109:21)
  at PackageManager.module.exports.PackageManager.activatePackages (/Applications/Atom.app/Contents/Resources/app/src/package-manager.js:98:14)
  at PackageManager.module.exports.PackageManager.activate (/Applications/Atom.app/Contents/Resources/app/src/package-manager.js:85:19)
  at Atom.module.exports.Atom.startEditorWindow (/Applications/Atom.app/Contents/Resources/app/src/atom.js:349:21)
  at Object.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/window-bootstrap.js:14:8)
  at Object.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/window-bootstrap.js:20:4)
  at Module._compile (module.js:455:26)
  at Object.Module._extensions..js (module.js:473:10)
  at Module.load (/Applications/Atom.app/Contents/Resources/app/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:311:12)
  at Module.require (module.js:363:17)
  at require (module.js:379:17)
  at window.onload (file:///Applications/Atom.app/Contents/Resources/app/static/index.js:20:5)

Treeview linter integration

Linter should highlight files that have lint errors in the tree view.

In supporting this it should be considered that compilation tools such as grunt, or rake may output errors for specific files when running. It should be possible for tools supporting build processes to report errors to the shared core.

Make release 0.4.9

Came to here to trim out a console.log that was inundating my console only to find out its already been fixed. Release 0.4.9?

Also, thanks for "ending the linter war". ;)

Would like to integrate a Perl lint

On a basic level, I can use
perl -MO=Lint
to check the syntax of a perl file.

Results look like:

syntax error at line 9, near "my &ref"
Global symbol "$hash_" requires explicit package name at line 14.
syntax error at line 15, near "system"
BEGIN not safe after errors--compilation aborted at line 20.

I think that i understand how you create the individual linters, but I don't understand

@syntax: ['source.js', 'source.js.jquery', 'text.html.basic']

Or at least I'm not sure how to target perl files in particular.

I am using the perl grammar at https://github.com/atom/language-perl but I don't see an analogue for specifying perl syntax

Errors without a line/col throw exception

Uncaught TypeError: Cannot call method 'tokenAtBufferColumn' of undefined

Similar to the issue with some linters returning line 0, some linters do not return any position information at all for some errors. e.g. csslint has a few rules:

https://github.com/CSSLint/csslint/blob/master/src/rules/important.js
https://github.com/CSSLint/csslint/blob/master/src/rules/font-sizes.js

The error occurs here: https://github.com/AtomLinter/Linter/blob/master/lib/linter.coffee#L190

The calculated rowStart ends up being NaN due to the undefined lineStart and line properties. Changing to:

rowStart = parseInt(match.lineStart ? match.line ? 0) - 1

Seems to fix it but I'm not sure if this breaks anything else.

Clean console log

Hi @hd-deman and @park9140,

I think we should clean every console.log and use the only when we are working on the code. I don't like to have my code polluted with logs in 'production'

Do you agree guys? Can I delete all these console.log :D ?

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.