Alan Liang
Alan Liang

Reputation: 358

SublimeLinter "max-line-length" setting not applied

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.

Upvotes: 4

Views: 4555

Answers (2)

sodimel
sodimel

Reputation: 916

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.

Upvotes: 0

sergioFC
sergioFC

Reputation: 6016

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

Upvotes: 10

Related Questions