Browse Source

initial working vhdl-tool linter interface

VHDL Tool 5 years ago
commit
b2d4cbf968
8 changed files with 155 additions and 0 deletions
  1. 1 0
      .gitignore
  2. 14 0
      .sublimelinterrc
  3. 11 0
      .travis.yml
  4. 17 0
      LICENSE
  5. 60 0
      README.md
  6. 39 0
      linter.py
  7. 3 0
      messages.json
  8. 10 0
      messages/install.txt

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
1
+.DS_Store

+ 14 - 0
.sublimelinterrc

@@ -0,0 +1,14 @@
1
+{
2
+    "@python": 3,
3
+    "linters": {
4
+        "flake8": {
5
+            "max-line-length": 120
6
+        },
7
+        "pep257": {
8
+            "add-ignore": ["D202"]
9
+        },
10
+        "pep8": {
11
+            "max-line-length": 120
12
+        }
13
+    }
14
+}

+ 11 - 0
.travis.yml

@@ -0,0 +1,11 @@
1
+language: python
2
+python:
3
+  - "3.3"
4
+# command to install dependencies
5
+install:
6
+  - pip install flake8
7
+  - pip install pydocstyle
8
+# command to run tests
9
+script:
10
+  - flake8 . --max-line-length=120
11
+  - pydocstyle . --add-ignore=D202

+ 17 - 0
LICENSE

@@ -0,0 +1,17 @@
1
+Permission is hereby granted, free of charge, to any person obtaining a copy
2
+of this software and associated documentation files (the "Software"), to deal
3
+in the Software without restriction, including without limitation the rights
4
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5
+copies of the Software, and to permit persons to whom the Software is
6
+furnished to do so, subject to the following conditions:
7
+
8
+The above copyright notice and this permission notice shall be included in
9
+all copies or substantial portions of the Software.
10
+
11
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17
+THE SOFTWARE.

+ 60 - 0
README.md

@@ -0,0 +1,60 @@
1
+SublimeLinter-contrib-vhdl-tool
2
+================================
3
+
4
+This linter plugin for [SublimeLinter][docs] provides an interface to [vhdl-tool](http://www.vhdltool.com). It will be used with files that have the “VHDL” syntax.
5
+
6
+## Installation
7
+SublimeLinter 3 must be installed in order to use this plugin. If SublimeLinter 3 is not installed, please follow the instructions [here][installation].
8
+
9
+### Linter installation
10
+Before using this plugin, you must ensure that `vhdl-tool` is installed on your system. To install `vhdl-tool`, do the following:
11
+
12
+1. Download the VHDL-Tool binary from [here](http://www.vhdltool.com/download).
13
+2. Put the downloaded vhdl-tool binary somewhere in your PATH.
14
+3. Create a vhdltool-config.yaml configuration file by folowing the instructions [here](http://www.vhdltool.com/configuration).
15
+
16
+**Note:** This plugin requires `vhdl-tool` 0.0.1 or later.
17
+
18
+### Linter configuration
19
+In order for `vhdl-tool` 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.
20
+
21
+Once you have installed and configured `vhdl-tool`, you can proceed to install the SublimeLinter-contrib-vhdl-tool plugin if it is not yet installed.
22
+
23
+### Plugin installation
24
+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.
25
+
26
+To install via Package Control, do the following:
27
+
28
+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.
29
+
30
+1. When the plugin list appears, type `vhdl-tool`. Among the entries you should see `SublimeLinter-contrib-vhdl-tool`. If that entry is not highlighted, use the keyboard or mouse to select it.
31
+
32
+## Settings
33
+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].
34
+
35
+## Contributing
36
+If you would like to contribute enhancements or fixes, please do the following:
37
+
38
+1. Fork the plugin repository.
39
+1. Hack on a separate topic branch created from the latest `master`.
40
+1. Commit and push the topic branch.
41
+1. Make a pull request.
42
+1. Be patient.  ;-)
43
+
44
+Please note that modifications should follow these coding guidelines:
45
+
46
+- Indent is 4 spaces.
47
+- Code should pass flake8 and pep257 linters.
48
+- Vertical whitespace helps readability, don’t be afraid to use it.
49
+- Please use descriptive variable names, no abbreviations unless they are very well known.
50
+
51
+Thank you for helping out!
52
+
53
+[docs]: http://sublimelinter.readthedocs.org
54
+[installation]: http://sublimelinter.readthedocs.org/en/latest/installation.html
55
+[locating-executables]: http://sublimelinter.readthedocs.org/en/latest/usage.html#how-linter-executables-are-located
56
+[pc]: https://sublime.wbond.net/installation
57
+[cmd]: http://docs.sublimetext.info/en/sublime-text-3/extensibility/command_palette.html
58
+[settings]: http://sublimelinter.readthedocs.org/en/latest/settings.html
59
+[linter-settings]: http://sublimelinter.readthedocs.org/en/latest/linter_settings.html
60
+[inline-settings]: http://sublimelinter.readthedocs.org/en/latest/settings.html#inline-settings

+ 39 - 0
linter.py

@@ -0,0 +1,39 @@
1
+#
2
+# linter.py
3
+# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
4
+#
5
+# Written by VHDL-Tool
6
+# Copyright (c) 2016 VHDL-Tool
7
+#
8
+# License: MIT
9
+#
10
+
11
+"""This module exports the VhdlTool plugin class."""
12
+
13
+from SublimeLinter.lint import Linter, util
14
+
15
+
16
+class VhdlTool(Linter):
17
+    """Provides an interface to vhdl-tool."""
18
+
19
+    syntax = 'vhdl'
20
+    cmd = 'vhdl-tool client lint --compact --stdin -f @'
21
+    executable = None
22
+    version_args = '--version'
23
+    version_re = r'(?P<version>\d+\.\d+\.\d+)'
24
+    version_requirement = '>= 0.0'
25
+    regex = (
26
+        r'^.+?:(?P<line>\d+):(?P<col>\d+):'
27
+        r'(?:(?P<error>[e])|(?P<warning>[w])):'
28
+        r'(?P<message>.+)'
29
+    )
30
+    multiline = False
31
+    line_col_base = (1, 1)
32
+    error_stream = util.STREAM_BOTH
33
+    selectors = {}
34
+    word_re = None
35
+    defaults = {}
36
+    inline_settings = None
37
+    inline_overrides = None
38
+    comment_re = None
39
+

+ 3 - 0
messages.json

@@ -0,0 +1,3 @@
1
+{
2
+    "install": "messages/install.txt"
3
+}

+ 10 - 0
messages/install.txt

@@ -0,0 +1,10 @@
1
+SublimeLinter-contrib-vhdl-tool
2
+-------------------------------
3
+This linter plugin for SublimeLinter provides an interface to vhdl-tool.
4
+
5
+** IMPORTANT! **
6
+
7
+Before this plugin will activate, you *must*
8
+follow the installation instructions here:
9
+
10
+https://github.com//SublimeLinter-contrib-vhdl-tool