Giter Club home page Giter Club logo

sublimelinter-salt-lint's Introduction

SublimeLinter-salt-lint

Build Status

This linter plugin for SublimeLinter provides an interface to salt-lint, a command-line utility that checks for best practices in SaltStack. It will be used with Salt State files (SLS) files.

Installation

SublimeLinter must be installed in order to use this plugin.

Please use Package Control to install the linter plugin.

Before installing this plugin, you must ensure that salt-lint is installed on your system.

In order for salt-lint to be executed by SublimeLinter, you must ensure that its path is available to SublimeLinter. The docs cover troubleshooting PATH configuration.

Settings

sublimelinter-salt-lint's People

Contributors

braver avatar kaste avatar roaldnefs avatar zachu avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sublimelinter-salt-lint's Issues

Errors and warnings showing doubled

Console shows SublimeLinter running the lint as follows:

$ cat path/to/file/init.sls | /home/zachu/.local/bin/salt-lint --nocolour --severity /full/path/to/file/init.sls

This makes the salt-lint to run the linting for both to stdin file as well as the file from input. And this in turn shows the error messages doubled.

I tried to compare this linter to for example https://github.com/thomasmeeus/SublimeLinter-contrib-yamllint which doesn't seem to cat the source files into the linter and the code from https://github.com/SublimeLinter/SublimeLinter/blob/master/lint/linter.py and I believe yamllint works correctly because of tempfile_suffix = 'yaml' being provided and therefore making SublimeLinter first create tempfile for the code. So maybe this linter should also provide some tempfile_suffix?

Other possible fixes I could think of are removing the ${file} from the cmd or setting tempfile_suffix to - as is stated in https://github.com/SublimeLinter/SublimeLinter/blob/master/lint/linter.py#L672.

Permission error on temporary file

I get these error messages in the Sublime console for every SLS file I open:

SublimeLinter: linter.py:1127         salt-lint: Checking lint mode 'background' vs lint reason 'on_load'.  Ok.
INFO:SublimeLinter.plugin.salt-lint:salt-lint: Checking lint mode 'background' vs lint reason 'on_load'.  Ok.
SublimeLinter: #37 linter.py:1144     salt-lint: linting 'init.sls'
INFO:SublimeLinter.plugin.salt-lint:salt-lint: linting 'init.sls'
SublimeLinter: #37 linter.py:1699     Running ...

  C:\Users\amendlik\develop\paragon\salt-policy  (working dir)
  > type states\wordpress\init.sls | C:\Users\amendlik\AppData\Local\Programs\Python\Python38\Scripts\salt-lint.EXE --nocolour --severity

INFO:SublimeLinter.plugin.salt-lint:Running ...

  C:\Users\amendlik\develop\paragon\salt-policy  (working dir)
  > type states\wordpress\init.sls | C:\Users\amendlik\AppData\Local\Programs\Python\Python38\Scripts\salt-lint.EXE --nocolour --severity

SublimeLinter: #37 linter.py:808      WARNING: salt-lint output:
Traceback (most recent call last):
  File "c:\users\amendlik\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\amendlik\appdata\local\programs\python\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\amendlik\AppData\Local\Programs\Python\Python38\Scripts\salt-lint.EXE\__main__.py", line 7, in <module>
  File "c:\users\amendlik\appdata\local\programs\python\python38\lib\site-packages\saltlint\cli.py", line 72, in run
    os.unlink(stdin_file.name)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\amendlik\\AppData\\Local\\Temp\\tmplq8m50a9.sls'

WARNING:SublimeLinter.plugin.salt-lint:salt-lint output:
Traceback (most recent call last):
  File "c:\users\amendlik\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\amendlik\appdata\local\programs\python\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\amendlik\AppData\Local\Programs\Python\Python38\Scripts\salt-lint.EXE\__main__.py", line 7, in <module>
  File "c:\users\amendlik\appdata\local\programs\python\python38\lib\site-packages\saltlint\cli.py", line 72, in run
    os.unlink(stdin_file.name)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\amendlik\\AppData\\Local\\Temp\\tmplq8m50a9.sls'

SublimeLinter: #37 linter.py:810      Note: above warning will become an error in the future. Implement `on_stderr` if you think this is wrong.
INFO:SublimeLinter.plugin.salt-lint:Note: above warning will become an error in the future. Implement `on_stderr` if you think this is wrong.
SublimeLinter: #37 linter.py:1220     salt-lint: no output
INFO:SublimeLinter.plugin.salt-lint:salt-lint: no output
SublimeLinter: sublime_linter.py:593  Linting 'init.sls' took 0.19s
INFO:SublimeLinter.sublime_linter:Linting 'init.sls' took 0.19s

Feature: add option for salt-lint arguments

Right now, ignoring rules and other command-line arguments can be passed to salt-lint using the args option:

"salt-lint":
{
	"args": ["-x", "201", "203"],
},

However, it would be nice to have this, and other options, natively added, s.t. they can be used as:

"salt-lint":
{
	"ignore": ["201", "203"],
},

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.