sublime使用sublimelint-luacheck屏蔽指定警告

在成功安装SublimeLinter-lua与luacheck以后,如果没有语法error,则会进行警告提示.

如下图

 

waring: line contains trailing whitespace.

这样的警告在项目代码里太多了,虽然sublime能够自动去除trailing,但是考虑到其他同事是看不见这些字符,

如果改掉svn里会有大量文件变化,没必要.于是屏蔽掉这些恼人的警告.

 

在菜单栏--package setting -- SublimeLinter -- setting user

会自动编辑SublimeLinter.sublime-settings文件

 1         "linters": {
 2             "luacheck": {
 3                 "@disable": false,
 4                 "args": [],
 5                 "excludes": [],
 6                 "ignore_match":[
 7                     ".*trailing whitespace.*",
 8                     ".*only whitespace",
 9                     ".*line is too long",
10                     ".*inconsistent indentation",
11                 ],
12                 // "ignore": "W612,W631,W621,W611,"
13             }
14         },

 

通过 ignore_match(使用python正则来匹配)来 忽略不感兴趣的警告.

 

2018-3-8更新. sublimelinter 更新了 上面的格式竟然不能使用了!!! 下面是新的可用格式..

{
        "debug": true,
        "delay": 0.25,
        "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
        "lint_mode": "background",
        "linters": {
            "json": {
                "@disable": false,
                "args": [],
                "excludes": [],
                "strict": true
            },
            "lua": {
                "@disable": false,
                "args": [],
                "excludes": []
            },
            "luacheck": {
                "@disable": false,
                "args": "--ignore 631 621 614 611 111 612 ",
                "excludes": [],
                "ignore" : "",
            },
            "luaglobals": {
                "@disable": false,
                "args": [],
                "excludes": []
            }
        },
        "no_column_highlights_line": false,
        "paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },
        "shell_timeout": 10,
        "show_marks_in_minimap": true,
        "syntax_map": {
            "html (django)": "html",
            "html (rails)": "html",
            "html 5": "html",
            "javascript (babel)": "javascript",
            "magicpython": "python",
            "php": "html",
            "python django": "python",
            "pythonimproved": "python"
        },
}

  

重点是 这一行 "args": "--ignore 631 621 614 611 111 612 ",

这样又可以愉快的编代码啦~~ 希望大家用sublime 写 lua 愉快~~

 

参考网站:

http://sublimelinter.readthedocs.io/en/latest/linter_settings.html

备注:

参考网站上说可以使用 "ignore":"W612" 忽略警告的方式,但我没有成功~

 

posted on 2017-03-20 23:44  MorePower  阅读(1605)  评论(0编辑  收藏  举报

导航