If I run flake8
at the terminal, it gives me alphanumeric error codes for every error - like F401 for an unused import:
$ flake8 ~/test.py
/Users/markamery/test.py:1:1: F401 'math' imported but unused
However, when I use SublimeLinter-flake8 to lint code in Sublime, these codes aren't included in the error message shown in the status bar:
How can I make the error codes appear in the status tray, like they do at the terminal?
SublimeLinter's settings file now contains a message template parameter which defaults to showing only the error message, documented as follows in the default settings file:
// Show the messages for problems at your cursor position.
// - {message} will be replaced by the actual messages.
// - {linter} will be replaced by the linter reporting the error.
// - {type} will be replaced by either warning or error.
// - {code} will be replaced by the error code.
// Set to "" to display nothing
"statusbar.messages_template": "{message}",
To show error codes, then, you need to:
Open the SublimeLinter settings file. (On Sublime Text 3 on a Mac, I can access this via Sublime Text -> Preferences -> Package Settings -> Sublime Linter -> Settings; the menus will be slightly different in different environments.)
In the "User" settings in the right-hand-pane of the split window that opens, add a "statusbar.messages_template"
parameter that contains a {code}
placeholder. For example, I use "{type} {code}: {message}"
as my template:
Save, and the messages shown in the status bar by SublimeLinter will henceforth contain the error code: