4

I'm having difficulty setting user settings for SublimeLinter in SublimeText3. I've checked here: http://www.sublimelinter.com/en/latest/settings.html

I've tried setting my user settings, and setting "max-line-length" to 80 (the default is 100):

{
    "user": {
        "debug": false,
        "delay": 0.25,
        "error_color": "D02000",
        "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
        "gutter_theme_excludes": [],
        "lint_mode": "background",
        "linters": {
            "pylint": {
                "@disable": false,
                "args": [],
                "disable": "",
                "enable": "",
                "excludes": [],
                "max-line-length": 80,
                "paths": [],
                "rcfile": "",
                "show-codes": false
            }
        },
        "mark_style": "outline",
        "no_column_highlights_line": true,
        "passive_warnings": false,
        "paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },
        "python_paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },
        "rc_search_limit": 3,
        "shell_timeout": 10,
        "show_errors_on_save": false,
        "show_marks_in_minimap": true,
        "syntax_map": {
            "html (django)": "html",
            "html (rails)": "html",
            "html 5": "html",
            "php": "html",
            "python django": "python"
        },
        "warning_color": "DDB700",
        "wrap_find": true
    }
}

However, this setting is not applied. I have closed and re-opened sublime text. How do I get this setting to be applied? Thanks.

Alan Liang
  • 358
  • 2
  • 15

2 Answers2

10

The syntax you are using seems to work for some linters, however, as far as I know it doesn't works for pylint.

Anyway, for using pylint from Sublime Text you can use the command argument --max-line-length=N, so change

"args": []

for

"args": ["--max-line-length=90"]

In addition, if you do this, remove the max-line-length property.


Edit: where to place SublimeLinter settings.

You can learn about it in the SublimeLinter settings documentation

I used the user-settings-file, that you can usually find using the following menu option: Preferences > Package Settings > SublimeLinter > Settings-User. For this purpose you need to add the option inside linters/pylint:

{
    "user": {
        "linters": {
            "pylint": {
                // "exampleOtion": "exampleValue",
                "args": ["--max-line-length=90"]
            }
        }
    }
}

Please note that probably your config file is similar to the one in the question, so you just need to add the new option inside "pylint" without breaking the JSON format

sergioFC
  • 5,926
  • 3
  • 40
  • 54
  • Voted down as the answer does not say where to put the config option, also, adding the config option doesn't do anything. – Jeff Davenport Jan 01 '17 at 22:50
  • @JeffDavenport I've updated my answer to add that info. And I've just tested this and it works. If you have any problem with this, feel free to let me know it so I can help you. – sergioFC Jan 01 '17 at 23:34
  • Thanks, upvoted, however it appears that this option is only applicable for pylint and does not seem to have any affect in the SublimeLinter-haml-lint package – Jeff Davenport Jan 03 '17 at 03:28
  • If you're adding this to your `users` file, you need to remove the `"users": {` definition. Copying and pasting the above doesn't work. This does: ```{ "linters": { "pylint": { "args": ["--max-line-length=125"] } } }``` – toast Apr 13 '19 at 06:14
0

As this message continues to appear regularly on the first page of Google and SublimeLinter has changed a lot, here is my solution:

I enter "pref lint" or "preferences linter" in the Command Palette in sublime text 3 (screenshot) to open the preferences file.

Here's the SublimeLinter.sublime-settings default config file I am using (W0312 is for using tabs instead of spaces):

// SublimeLinter Settings - User
{
    "linters": {
        "pylint": {
            "filter_errors": ["warning:", "W0312"]
        }
    }
}

I use pylint-messages to find the right error/warning codes, with the help of the search box.

sodimel
  • 864
  • 2
  • 11
  • 24