Skip to content

Commit

Permalink
Make first version
Browse files Browse the repository at this point in the history
  • Loading branch information
roadhump committed May 22, 2015
1 parent 7441d35 commit 4487ad1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 25 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
SublimeLinter-contrib-mdl
================================
# SublimeLinter-contrib-mdl

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

This linter plugin for [SublimeLinter][docs] provides an interface to [mdl](__linter_homepage__). It will be used with files that have the “__syntax__” syntax.
This linter plugin for [SublimeLinter][docs] provides an interface to [Markdown lint tool (mdl)](https://github.com/mivok/markdownlint). It will be used with files that have the “Markdown” 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].

### Linter installation

Before using this plugin, you must ensure that `mdl` is installed on your system. To install `mdl`, do the following:

1. Install [Ruby](http://www.ruby-lang.org).

1. Install `mdl` by typing the following in a terminal:

```
[sudo] gem install mdl
```

1. If you are using `rbenv` or `rvm`, ensure that they are loaded in your shell’s correct startup file. See [here](http://sublimelinter.readthedocs.org/en/latest/troubleshooting.html#shell-startup-files) for more information.


**Note:** This plugin requires `mdl` __version__ or later.
**Note:** This plugin requires `mdl` 0.2.1 or later.

### Linter configuration

In order for `mdl` 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 `mdl`, you can proceed to install the SublimeLinter-contrib-mdl 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:
Expand All @@ -38,16 +41,17 @@ To install via Package Control, do the following:
1. When the plugin list appears, type `mdl`. Among the entries you should see `SublimeLinter-contrib-mdl`. 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-mdl 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.| |✓|
|bundle-exec|runs mdl as "bundle exec mdl" instead of "mdl"| |✓|

## Contributing

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

1. Fork the plugin repository.
Expand Down
29 changes: 12 additions & 17 deletions linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,35 @@
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by roadhump
# Copyright (c) 2015 roadhump
# Written by Aliaksei Shytkin
# Copyright (c) 2015 Aliaksei Shytkin
#
# License: MIT
#

"""This module exports the Mdl plugin class."""
"""This module exports the mdl plugin class."""

from SublimeLinter.lint import RubyLinter, util
from SublimeLinter.lint import RubyLinter


class Mdl(RubyLinter):

"""Provides an interface to mdl."""

syntax = ('markdown')
syntax = ('markdown', 'markdown gfm', 'multimarkdown')
executable = 'mdl'
version_args = '--version'
version_re = r'(?P<version>\d+\.\d+\.\d+)'
version_requirement = '>= 0.2.1'
regex = r'^.+?:(?P<line>\d+): (?P<message>[^`]*)'
# multiline = True
regex = r'^.+?:(?P<line>\d+): (?P<warning>(?P<message>[^`]*))'
config_file = ('--config', '.mdlrc', '~')
line_col_base = (1, 1)
tempfile_suffix = 'md'
error_stream = util.STREAM_BOTH
selectors = {}
word_re = None
defaults = {}
inline_settings = None
inline_overrides = None
comment_re = r'\s*#'
inline_overrides = ('bundle-exec')

def cmd(self):
if self.get_view_settings().get('bundle-exec', False):
return ('bundle', 'exec', self.executable)
return (self.executable_path)
"""Support bundle-exec."""

if self.get_view_settings().get('bundle-exec', False):
return ('bundle', 'exec', self.executable)
return (self.executable_path)

0 comments on commit 4487ad1

Please sign in to comment.