SublimeLinter / SublimeLinter-flake8

SublimeLinter plugin for python, using flake8.
MIT License
184 stars 28 forks source link

flake8 `max-line-length` no longer works #84

Closed craigds closed 6 years ago

craigds commented 6 years ago

The max-line-length for flake8 seems to no longer work.

Here are my settings:

    "linters": {
        "flake8": {
            "python": null,
            "disable": false,
            "excludes": [],
            "ignore": "E741",
            "max-complexity": -1,
            "select": "",

            // doesn't actually seem to work
            //"max-line-length": 120,
            // workaround:
            "args": ["--max-line-length", "120"],
        }
    }

These were copied and populated from the commented-out sample config in the Default settings file when I upgraded to 4.0.0. So either the plugin is broken, or the config has changed and the sample config is wrong.

I'm fairly sure this was working before 4.0.0, with these settings:

        "linters": {
            "flake8": {
                "@disable": false,
                "args": [],
                "builtins": "",
                "excludes": [],
                "executable": "",
                "ignore": "E741",
                "jobs": "1",
                "max-complexity": -1,
                "max-line-length": 120,
                "select": "",
                "show-code": false
            }
        }
kaste commented 6 years ago

These settings have been removed (last week/two weeks ago?). You have to use args now.

craigds commented 6 years ago

Should that be in some documentation somewhere? I was unable to find anything about it.

Also presumably the sample config needs to be updated.

kaste commented 6 years ago

Happy to take a PR for the README

ptim commented 6 years ago

ah, thanks! this had me confused, too...

The following now works for me:

{
    "folders": [...],

    "SublimeLinter": {
        "linters": {
            "flake8": {
                "args": [
                    "--max-line-length=120",
                    "--exclude=.git,__pycache__,.direnv,node_modules",
                ]
            }
        }
    },
}

Linter settings: http://sublimelinter.readthedocs.org/en/latest/linter_settings.html

kaste commented 6 years ago

Note that SublimeLinter has also an excludes setting which would be more efficient here to use. (Bc then we don't run the linter at all for such files.)