Update Rubocop to run as an exe

This commit is contained in:
Steven Zeck 2018-03-05 10:18:51 -06:00
parent bf971abc7f
commit 4ecd668208
No known key found for this signature in database
GPG Key ID: 621B374B29AA814A
2 changed files with 14 additions and 2 deletions

View File

@ -17,6 +17,18 @@ module.exports = class Rubocop extends Beautifier
rubocop_path: true
}
executables: [
{
name: "Rubocop"
cmd: "rubocop"
homepage: "http://rubocop.readthedocs.io/"
installation: "http://rubocop.readthedocs.io/en/latest/installation/"
version: {
parse: (text) -> text.match(/(\d+\.\d+\.\d+)/)[1]
}
}
]
beautify: (text, language, options, context) ->
fullPath = context.filePath or ""
[projectPath, _relativePath] = atom.project.relativizePath(fullPath)
@ -51,9 +63,9 @@ module.exports = class Rubocop extends Beautifier
rubocopArguments.push("--config", tempConfig) if tempConfig?
@debug("rubocop arguments", rubocopArguments)
@run(rubocopPath, rubocopArguments, {
@exe("rubocop").run(rubocopArguments, {
ignoreReturnCode: true,
cwd: projectPath,
cwd: projectPath if configFile?,
onStdin: (stdin) -> stdin.end text
}).then((stdout) =>
@debug("rubocop output", stdout)