-1

The linter I'm using outputs errors in the following format:

origin:PycodestyleBear (E501):file:/Users/Virtualenv/testme.py:line:2:column:81:end_line:2:end_column:81:severity:1:severity_str:NORMAL:message:E501 line too long (164 > 80 characters)'

It is apparent that the format contains several parts:

  1. Type of bear used
  2. Error number
  3. File name
  4. line number (start)
  5. column number (start)
  6. line number (end)
  7. column number (end)
  8. Type of error message
  9. Error message itself

I'm writing the plugin of my linter for syntastic, and this is causing issues with the output string, how can I configure it to match the requirements?

I've tried let errorformat = 'L%l\\:%m' with no luck

HumanTorch
  • 349
  • 2
  • 5
  • 16

1 Answers1

1

Looking at Coala's documentation, it looks like you can pass:

  • the --json flag to output JSON (which I hear is now supported by Syntastic),
  • or the --format flag to define your desired output format.
romainl
  • 186,200
  • 21
  • 280
  • 313
  • the output I've posted is a result of using '--format'. That doesn't answer the question. Also, json cannot be parsed by errorformat. Note that there's no advantage of using json anyways since the output in the log doesn't give the file name, line number, etc. As is the case with '--format' on coala. – HumanTorch Apr 24 '17 at 02:38
  • The point of `--format` is to let you define the output however you want it so you simply have to format your output according to a simple `efm` like the classic `%f:%l:%c:%m` which will almost certainly work with: `--format {file}:{line}:{column}:{message}` (maybe with quotes). – romainl Apr 24 '17 at 05:36
  • @romainl The problem with `--format {file}:{line}:{column}:{message}` is that it will print `None` for `column` if the corresponding bear (who came up with that name anyway?) doesn't provide column information. Syntastic can deal with that, as well as with JSON, but the way to do it doesn't fit the OP's approach of development by copy & waste. The bigger problem is that line and column information is 0-based for some bears and 1-based for others. Syntastic can deal with that too; it's just that you'd have to do it for 100+ bears. Talk about bearing the weight of being a coder. – lcd047 Apr 24 '17 at 09:23