SublimeLinter
=============
SublimeLinter is a plugin that supports "lint" programs (known as "linters"). SublimeLinter highlights
lines of code the linter deems to contain (potential) errors. It also
supports highlighting special annotations (for example: TODO) so that they
can be quickly located.
SublimeLinter has built in linters for the following languages:
* C/C++ - lint via `cppcheck`
* CoffeeScript - lint via `coffee -s -l`
* CSS - lint via built-in [csslint](http://csslint.net)
* Git Commit Messages - lint via built-in module based on [A Note About Git Commit Messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
* Haml - syntax check via `haml -c`
* HTML - lint via `tidy` (actually [tidy for HTML5](http://w3c.github.com/tidy-html5/))
* Java - lint via `javac -Xlint`
* Javascript - lint via built in [jshint](http://jshint.org), [jslint](http://jslint.com), or the [closure linter (gjslint)](https://developers.google.com/closure/utilities/docs/linter_howto) (if installed)
* Lua - syntax check via `luac`
* Objective-J - lint via built-in [capp_lint](https://github.com/aparajita/capp_lint)
* Perl - lint via [Perl:Critic](http://perlcritic.com/) or syntax+deprecation check via `perl -c`
* PHP - syntax check via `php -l`
* Puppet - syntax check via `puppet parser validate`
* Python - native, moderately-complete lint
* Ruby - syntax check via `ruby -wc`
* XML - lint via `xmllint`
Installing
----------
**With the Package Control plugin:** The easiest way to install SublimeLinter is through Package Control, which can be found at this site: http://wbond.net/sublime_packages/package_control
Once you install Package Control, restart ST2 and bring up the Command Palette (`Command+Shift+P` on OS X, `Control+Shift+P` on Linux/Windows). Select "Package Control: Install Package", wait while Package Control fetches the latest package list, then select SublimeLinter when the list appears. The advantage of using this method is that Package Control will automatically keep SublimeLinter up to date with the latest version.
**Without Git:** Download the latest source from [GitHub](https://github.com/SublimeLinter/SublimeLinter) and copy the SublimeLinter folder to your Sublime Text "Packages" directory.
**With Git:** Clone the repository in your Sublime Text "Packages" directory:
git clone https://github.com/SublimeLinter/SublimeLinter.git
The "Packages" directory is located at:
* OS X:
~/Library/Application Support/Sublime Text 2/Packages/
* Linux:
~/.config/sublime-text-2/Packages/
* Windows:
%APPDATA%/Sublime Text 2/Packages/
### Javascript-based linters
If you plan to edit files that use a Javascript-based linter (Javascript, CSS), your system
must have a Javascript engine installed. Mac OS X comes with a preinstalled Javascript engine called
JavaScriptCore, which is used if Node.js is not installed. On Windows, you **must** install the
Javascript engine Node.js, which can be downloaded from [the Node.js site](http://nodejs.org/#download).
On Mac OS X, you **must** install Node.js if you plan to edit Javascript or CSS files that
use non-ASCII characters in strings or comments, because JavaScriptCore is not Unicode-aware.
After installing Node.js, if the Node.js executable ("node" on Mac OS X, "node.exe" on Windows)
cannot be found by SublimeLinter, you may have to set the path to the executable in the
"sublimelinter\_executable\_map" setting. See the "Configuring" section below for info on
SublimeLinter settings.
Configuring
-----------
There are a number of settings available to customize the behavior of SublimeLinter and its linters. For the latest information on what settings are available, select the menu item `Preferences->Package Settings->SublimeLinter->Settings - Default`.
Do **NOT** edit the default SublimeLinter settings. Your changes will be lost when SublimeLinter is updated. ALWAYS edit the user SublimeLinter settings by selecting `Preferences->Package Settings->SublimeLinter->Settings - User`. Note that individual settings you include in your user settings will _completely_ replace the corresponding default setting, so you must provide that setting in its entirety.
### Linter-specific notes
Following are notes specific to individual linters that you should be aware of:
* **C/C++** - The default C/C++ linter is [cppcheck](http://cppcheck.sourceforge.net/), however Google's [cpplint.py](http://google-styleguide.googlecode.com/svn/trunk/cpplint/) is also supported.
To swap `cppcheck` out for `cpplint.py` you will need to adjust `sublimelinter_syntax_map` and possibly `sublimelinter_executable_map` also. First change the _linter language_ for `C` and `C++` to `c_cpplint` via `sublimelinter_syntax_map`. If `cpplint.py` is not on your system `PATH`, then add an entry for `c_cpplint` into `sublimelinter_executable_map` with the path to the file. As usual add these adjustments to the SublimeLinter **User Settings** file. An example:
"sublimelinter_syntax_map":
{
"Python Django": "python",
"Ruby on Rails": "ruby",
"C++": "c_cpplint",
"C": "c_cpplint"
},
"sublimelinter_executable_map":
{
"c_cpplint": "/Users/[my username]/Desktop/cpplint.py"
}
* **CSS** - This linter runs [csslint](http://csslint.net). This linter requires a Javascript engine (like Node.js) to be installed (see notes above for the JavaScript linters: "jshint" or "jslint").
By default all CSSLint settings are turned on. You may customize CSSLint behavior with the "csslint_options" setting. Please select `Preferences->Package Settings->SublimeLinter->Settings - Default` for more information on turning off or adjusting severity of tests. For more information about options available to CSSLint, see https://github.com/stubbornella/csslint/wiki/Rules.
* **HTML** - This linter will not run unless you have a version of tidy with HTML5 support. To use this linter, please see: https://github.com/w3c/tidy-html5
* **Java** - Because it uses `javac` to do linting, each time you run the linter the entire dependency graph of the current file will be checked. Depending on the number of classes you import, this can be **extremely** slow. Also note that you **must** provide the `-sourcepath`, `-classpath`, `-Xlint` and `{filename}` arguments to `javac` in your per-project settings. See "Per-project settings" below for more information.
* **JavaScript** - If the "javascript_linter" setting is "jshint" or "jslint", this linter runs [jshint](http://jshint.org) (or [jslint](http://jslint.com) respectively) using Node.js. See "Javascript-based linters" above for information on how to install Node.js.
If the "javascript_linter" setting is "gjslint", this linter runs the [closure linter (gjslint)](https://developers.google.com/closure/utilities/docs/linter_howto). After installation, if gjslint cannot be found by SublimeLinter, you may have to set the path to gjslint in the "sublimelinter\_executable\_map" setting.
You may want to modify the options passed to jshint, jslint, or gjslint. This can be done by using the **jshint_options**, **jslint_options**, or **gjslint_options** setting. Refer to the jshint.org site, the jslint.com site, or run `gjslint --help` for more information on the configuration options available.
SublimeLinter supports `.jshintrc` files. If using JSHint, SublimeLinter will recursively search the directory tree (from the file location to the file-system root directory). This functionality is specified in the [JSHint README](https://github.com/jshint/node-jshint/#within-your-projects-directory-tree).
* **Perl** - Due to a vulnerability (issue [#77](https://github.com/SublimeLinter/SublimeLinter/issues/77)) with the Perl linter, Perl syntax checking is no longer enabled by default. The default linter for Perl has been replaced by Perl::Critic. The standard Perl syntax checker can still be invoked by switching the "perl_lin
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
sublime text2 插件包1 (140个子文件)
config 167B
.gitignore 38B
.gitignore 33B
SideBar Results.hidden-tmLanguage 1KB
csslint-node.js 293KB
jslint.js 218KB
jshint.js 167KB
linter.js 1KB
jsc.js 1KB
node.js 976B
linter.js 482B
linter.js 467B
package_control.json 942B
messages.json 637B
package-metadata.json 170B
package-metadata.json 149B
LICENSE 1KB
README.md 23KB
readme.md 7KB
PKG-INFO 2KB
pep8.py 48KB
SideBar.py 45KB
capp_lint.py 42KB
SublimeLinter.py 30KB
checker.py 21KB
dialog.py 17KB
base_linter.py 16KB
SideBarItem.py 13KB
python.py 11KB
__init__.py 9KB
windows.py 8KB
SideBarSelection.py 5KB
plat_other.py 5KB
loader.py 5KB
git_commit_message.py 4KB
SideBarProject.py 4KB
javascript.py 3KB
messages.py 3KB
objective-j.py 2KB
sublime_pylint.py 2KB
perl.py 2KB
notes.py 2KB
filesize.py 2KB
java.py 2KB
plat_osx.py 2KB
plat_win.py 2KB
html.py 1KB
puppet.py 1KB
c.py 1KB
css.py 1KB
coffeescript.py 1008B
c_cpplint.py 824B
php.py 772B
xml.py 691B
haml.py 685B
ruby.py 682B
lua.py 677B
StatusBarModifiedTime.py 645B
StatusBarFileSize.py 583B
__init__.py 468B
__init__.py 23B
__init__.py 0B
__init__.py 0B
__init__.py 0B
__init__.py 0B
SideBar.pyc 54KB
pep8.pyc 42KB
capp_lint.pyc 30KB
SublimeLinter.pyc 27KB
checker.pyc 20KB
SideBarItem.pyc 17KB
base_linter.pyc 12KB
__init__.pyc 9KB
python.pyc 9KB
SideBarSelection.pyc 6KB
messages.pyc 5KB
SideBarProject.pyc 5KB
loader.pyc 4KB
javascript.pyc 3KB
git_commit_message.pyc 3KB
sublime_pylint.pyc 3KB
filesize.pyc 3KB
perl.pyc 3KB
notes.pyc 2KB
java.pyc 2KB
css.pyc 2KB
html.pyc 2KB
puppet.pyc 2KB
c.pyc 1KB
objective-j.pyc 1KB
StatusBarModifiedTime.pyc 1KB
coffeescript.pyc 1KB
StatusBarFileSize.pyc 1KB
c_cpplint.pyc 1KB
php.pyc 1KB
xml.pyc 1KB
haml.pyc 1KB
ruby.pyc 1KB
lua.pyc 1KB
__init__.pyc 141B
共 140 条
- 1
- 2
hcl1687
- 粉丝: 20
- 资源: 19
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页