Skip to content

Commit

Permalink
add template files
Browse files Browse the repository at this point in the history
  • Loading branch information
braver committed Jan 15, 2018
0 parents commit 9fff764
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Node installed packages #
###########################
node_modules/*
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: python
python:
- "3.3"
install:
- pip install flake8
script:
- flake8 . --max-line-length=120
38 changes: 38 additions & 0 deletions HOWTO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Creating a Linter Plugin
========================

. Fork this repo to bootstrap your new linter.
. Clone it into Packages.
. Change a linter.py.
. Update the README and replace `__linter__` placeholders.
. Update messages/install.txt and replace `__linter__` placeholders.
. Open a PR in our [package_control repo](https://github.com/SublimeLinter/package_control_channel) to make it available to others.

Additional documentation can be found at [sublimelinter.com](http://sublimelinter.com).


Updating class attributes
--------------------------
Template linter plugins are created with almost all of the Linter class attributes filled in with the default values. To make your new linter plugin functional, at the very least you need to do the following:

- Change the `syntax` attribute to indicate the syntax (or syntaxes) that the linter lints.

- Change the `cmd` attribute to include the executable and arguments you want to include on every run. Or if you are going to implement a `cmd <cmd-method>` method, set the attribute to `None` and set the `executable` attribute to the name of the linter executable.

- Change the `regex` attribute to correctly capture the error output from the linter.

- Change the `multiline` attribute to `True` if the regex parses multiline error messages.

- Determine the minimum/maximum versions of the linter executable that will work with your plugin and change the `version_args`, `version_re` and `version_requirement` attributes accordingly.

- If the linter executable does not accept input via `stdin`, set the `tempfile_suffix` attribute to the filename suffix of the temp files that will be created.

These are the minimum requirements to make a linter plugin functional. However, depending on the features of the linter executable, you may need to configure other class attributes.

- If the linter outputs errors only on `stderr` or `stdout`, set `error_stream` to `util.STREAM_STDERR` or `util.STREAM_STDOUT` respectively.

- If you wish to support embedded syntaxes, set the `selectors` attribute accordingly.

- If the linter subclasses from `PythonLinter`, remove the `module` attribute if you do not plan to use the linter’s python API. If you do, you will need to implement the `check` method.

You should remove attributes that you do not change, as their values will be provided by the superclass.
17 changes: 17 additions & 0 deletions 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.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
This is a template. For "how to make a linter", please check [the HOWTO](HOWTO.md).

-----------------------------------------------------------------

SublimeLinter-contrib-__linter__
================================

[![Build Status](https://travis-ci.org/SublimeLinter/SublimeLinter-contrib-__linter__.svg?branch=master)](https://travis-ci.org/SublimeLinter/SublimeLinter-contrib-__linter__)

This linter plugin for [SublimeLinter](https://github.com/SublimeLinter/SublimeLinter) provides an interface to [__linter__](__linter_homepage__). It will be used with files that have the “__syntax__” syntax.

## Installation
SublimeLinter must be installed in order to use this plugin.

Please use [Package Control](https://packagecontrol.io) to install the linter plugin.

Before installing this plugin, you must ensure that `__linter__` is installed on your system.

In order for `__linter__` to be executed by SublimeLinter, you must ensure that its path is available to SublimeLinter. The docs cover [troubleshooting PATH configuration](http://sublimelinter.readthedocs.io/en/latest/troubleshooting.html#finding-a-linter-executable).

## Settings
- SublimeLinter settings: http://sublimelinter.readthedocs.org/en/latest/settings.html
- Linter settings: http://sublimelinter.readthedocs.org/en/latest/linter_settings.html

Additional SublimeLinter-__linter__ settings:

|Setting|Description |
|:------|:--------------|
|foo |Something. |
|bar |Something else.|
20 changes: 20 additions & 0 deletions linter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from SublimeLinter.lint import __superclass__, util


class __class__(__superclass__):
syntax = ''
cmd = '__cmd__'
executable = None
version_args = '--version'
version_re = r'(?P<version>\d+\.\d+\.\d+)'
version_requirement = '>= 1.0'
regex = r''
multiline = False
line_col_base = (1, 1)
tempfile_suffix = None
error_stream = util.STREAM_BOTH
selectors = {}
word_re = None
defaults = {}
inline_settings = None
inline_overrides = None
3 changes: 3 additions & 0 deletions messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"install": "messages/install.txt"
}
6 changes: 6 additions & 0 deletions messages/install.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SublimeLinter-contrib-__linter__
-------------------------------
This linter plugin for SublimeLinter provides an interface to __linter__.

For more information, please see:
https://github.com/__user__/SublimeLinter-contrib-__linter__

0 comments on commit 9fff764

Please sign in to comment.