Commit Graph

7 Commits

Author SHA1 Message Date
Junegunn Choi bc1cf285c2
Rubocop: Show cop name 2017-08-02 13:55:54 +09:00
w0rp b50ae96413 #769 Ignore stderr output and output without JSON we can read for rubocop 2017-07-13 22:47:43 +01:00
Eddie Lebow dcbb0ffee5 Rubocop: handle empty 'files' array in output
The handler previously assumed there would be at least one entry in the
'files' array in the output JSON. It looks like this in the normal case:

  "files":[{"path":"app/models/image.rb","offenses":[]}]

But if RuboCop's config excludes the specified input files, causing no
files to be linted, the output is emptier:

  "files":[]

This change causes the handler to treat that case correctly, and also
exit early if the reported offense_count is zero.
2017-07-12 19:53:58 -04:00
w0rp 5885954197 Fix #760 - Report problems with configuration files for rubocop 2017-07-12 22:41:06 +01:00
Eddie Lebow ab0e76dbd5 Use rubocop's JSON output format (resolves #339) (#738)
* Use rubocop's JSON output format (resolves #339)

Rubocop's emacs formatter seems to have changed format in some
not-so-ancient version. The JSON formatter should provide a more stable
interface than parsing lines with a regex.

The JSON formatter was introduced in mid-2013, so it should be safe to
assume available in any reasonably-modern environment. The oldest
currently-supported version of ruby (according to ruby-lang.org) was
not supported by rubocop until 2014.

* Rubocop: Use global function for GetType

* Rubocop: Use scope prefix in GetType

* Rubocop: Update command_callback test

* Rubocop: add end_col to Handle
2017-07-09 15:48:04 +01:00
w0rp bdad25eefd Add a function for getting matches, and use it to simplify a lot of code 2017-04-18 00:35:53 +01:00
w0rp 4abefc189c Cover the rubocop handler with tests 2017-03-27 19:53:12 +01:00