Skip to content

Commit

Permalink
Create draft of Sublime Text plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Suchow authored and suchow committed Sep 27, 2015
1 parent 48b2fd1 commit 8a715b3
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/sublime/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
14 changes: 14 additions & 0 deletions plugins/sublime/.sublimelinterrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"@python": 3,
"linters": {
"flake8": {
"max-line-length": 120
},
"pep257": {
"ignore": ["D202"]
},
"pep8": {
"max-line-length": 120
}
}
}
11 changes: 11 additions & 0 deletions plugins/sublime/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: python
python:
- "3.3"
# command to install dependencies
install:
- pip install flake8
- pip install pep257
# command to run tests
script:
- flake8 . --max-line-length=120
- pep257 . --ignore=D202
17 changes: 17 additions & 0 deletions plugins/sublime/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
73 changes: 73 additions & 0 deletions plugins/sublime/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
SublimeLinter-contrib-proselint
================================

[![Build Status](https://travis-ci.org/SublimeLinter/SublimeLinter-contrib-proselint.svg?branch=master)](https://travis-ci.org/SublimeLinter/SublimeLinter-contrib-proselint)
very unique
This linter plugin for [SublimeLinter][docs] provides an interface to [proselint](__linter_homepage__). It will be used with files that have the “__syntax__” syntax.

## Installation
SublimeLinter 3 must be installed in order to use this plugin. If SublimeLinter 3 is not installed, please follow the instructions [here][installation].
abbeviatable
### Linter installation
Before using this plugin, you must ensure that `proselint` is installed on your system. To install `proselint`, do the following:

1. Install [Python](http://python.org/download/) and [pip](http://www.pip-installer.org/en/latest/installing.html).

1. Install `proselint` by typing the following in a terminal:
```
[sudo] pip install proselint
```


**Note:** This plugin requires `proselint` __version__ or later.

### Linter configuration
In order for `proselint` to be executed by SublimeLinter, you must ensure that its path is available to SublimeLinter. Before going any further, please read and follow the steps in [“Finding a linter executable”](http://sublimelinter.readthedocs.org/en/latest/troubleshooting.html#finding-a-linter-executable) through “Validating your PATH” in the documentation.

Once you have installed and configured `proselint`, you can proceed to install the SublimeLinter-contrib-proselint plugin if it is not yet installed.

### Plugin installation
Please use [Package Control][pc] to install the linter plugin. This will ensure that the plugin will be updated when new versions are available. If you want to install from source so you can modify the source code, you probably know what you are doing so we won’t cover that here.

To install via Package Control, do the following:

1. Within Sublime Text, bring up the [Command Palette][cmd] and type `install`. Among the commands you should see `Package Control: Install Package`. If that command is not highlighted, use the keyboard or mouse to select it. There will be a pause of a few seconds while Package Control fetches the list of available plugins.

1. When the plugin list appears, type `proselint`. Among the entries you should see `SublimeLinter-contrib-proselint`. If that entry is not highlighted, use the keyboard or mouse to select it.

## Settings
For general information on how SublimeLinter works with settings, please see [Settings][settings]. For information on generic linter settings, please see [Linter Settings][linter-settings].

In addition to the standard SublimeLinter settings, SublimeLinter-contrib-proselint provides its own settings. Those marked as “Inline Setting” or “Inline Override” may also be [used inline][inline-settings].

|Setting|Description|Inline Setting|Inline Override|
|:------|:----------|:------------:|:-------------:|
|foo|Something.|✓| |
|bar|Something else.| |✓|

## Contributing
If you would like to contribute enhancements or fixes, please do the following:

1. Fork the plugin repository.
1. Hack on a separate topic branch created from the latest `master`.
1. Commit and push the topic branch.
1. Make a pull request.
1. Be patient. ;-)

Please note that modifications should follow these coding guidelines:

- Indent is 4 spaces.
- Code should pass flake8 and pep257 linters.
- Vertical whitespace helps readability, don’t be afraid to use it.
- Please use descriptive variable names, no abbreviations unless they are very well known.

Thank you for helping out!

[docs]: http://sublimelinter.readthedocs.org
[installation]: http://sublimelinter.readthedocs.org/en/latest/installation.html
[locating-executables]: http://sublimelinter.readthedocs.org/en/latest/usage.html#how-linter-executables-are-located
[pc]: https://sublime.wbond.net/installation
[cmd]: http://docs.sublimetext.info/en/sublime-text-3/extensibility/command_palette.html
[settings]: http://sublimelinter.readthedocs.org/en/latest/settings.html
[linter-settings]: http://sublimelinter.readthedocs.org/en/latest/linter_settings.html
[inline-settings]: http://sublimelinter.readthedocs.org/en/latest/settings.html#inline-settings
37 changes: 37 additions & 0 deletions plugins/sublime/linter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jordan Suchow
# Copyright (c) 2015 Jordan Suchow
#
# License: MIT
#

"""This module exports the Proselint plugin class."""

from SublimeLinter.lint import Linter, util


class Proselint(Linter):

"""Provides an interface to proselint."""

syntax = ('html', 'markdown', 'plain text')
cmd = 'proselint'
executable = None
version_args = '--version'
version_re = r'(?P<version>\d+\.\d+\.\d+)'
version_requirement = '>= 0.0.0'
regex = (
r'^.+?:(?P<line>\d+):(?P<col>\d+): (?P<message>.+)'
)
multiline = True
line_col_base = (1, 1)
tempfile_suffix = 'pltmp'
selectors = {}
word_re = None
defaults = {}
inline_settings = None
inline_overrides = None
comment_re = None
3 changes: 3 additions & 0 deletions plugins/sublime/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"install": "messages/install.txt"
}
10 changes: 10 additions & 0 deletions plugins/sublime/messages/install.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
SublimeLinter-contrib-proselint
-------------------------------
This linter plugin for SublimeLinter provides an interface to proselint.

** IMPORTANT! **

Before this plugin will activate, you *must*
follow the installation instructions here:

https://github.com/Jordan Suchow/SublimeLinter-contrib-proselint

0 comments on commit 8a715b3

Please sign in to comment.