Merge pull request #2069 from szeck87/rubocop-exe
Update Rubocop to be an executable
This commit is contained in:
commit
6bc36884eb
|
@ -128,7 +128,7 @@ Some of the supported beautifiers are developed for Node.js and are automaticall
|
||||||
| puppet-lint | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):<br/>1. Install [puppet-lint (`puppet-lint`)](http://puppet-lint.com/) with `docker pull unibeautify/puppet-lint`<br/><br/>:bookmark_tabs: Manually:<br/>1. Install [puppet-lint (`puppet-lint`)](http://puppet-lint.com/) by following http://puppet-lint.com/<br/> |
|
| puppet-lint | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):<br/>1. Install [puppet-lint (`puppet-lint`)](http://puppet-lint.com/) with `docker pull unibeautify/puppet-lint`<br/><br/>:bookmark_tabs: Manually:<br/>1. Install [puppet-lint (`puppet-lint`)](http://puppet-lint.com/) by following http://puppet-lint.com/<br/> |
|
||||||
| pybeautifier | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/guyskk/pybeautifier and follow the instructions. |
|
| pybeautifier | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/guyskk/pybeautifier and follow the instructions. |
|
||||||
| Remark | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
|
| Remark | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
|
||||||
| Rubocop | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/bbatsov/rubocop and follow the instructions. |
|
| Rubocop | :warning: 1 executable | :x: No Docker support | :bookmark_tabs: Manually:<br/>1. Install [Rubocop (`rubocop`)](http://rubocop.readthedocs.io/) by following http://rubocop.readthedocs.io/en/latest/installation/<br/> |
|
||||||
| Ruby Beautify | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/erniebrodeur/ruby-beautify and follow the instructions. |
|
| Ruby Beautify | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/erniebrodeur/ruby-beautify and follow the instructions. |
|
||||||
| rustfmt | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/rust-lang-nursery/rustfmt and follow the instructions. |
|
| rustfmt | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/rust-lang-nursery/rustfmt and follow the instructions. |
|
||||||
| SassConvert | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):<br/>1. Install [SassConvert (`sass-convert`)](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) with `docker pull unibeautify/sass-convert`<br/><br/>:bookmark_tabs: Manually:<br/>1. Install [SassConvert (`sass-convert`)](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) by following http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax<br/> |
|
| SassConvert | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):<br/>1. Install [SassConvert (`sass-convert`)](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) with `docker pull unibeautify/sass-convert`<br/><br/>:bookmark_tabs: Manually:<br/>1. Install [SassConvert (`sass-convert`)](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) by following http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax<br/> |
|
||||||
|
|
|
@ -402,6 +402,23 @@ Options for Rscript executable.
|
||||||
2. Go into *Packages* and search for "*Atom Beautify*" package.
|
2. Go into *Packages* and search for "*Atom Beautify*" package.
|
||||||
3. Find the option "*Rscript*" and change it to your desired configuration.
|
3. Find the option "*Rscript*" and change it to your desired configuration.
|
||||||
|
|
||||||
|
##### [Rubocop](#rubocop)
|
||||||
|
|
||||||
|
**Important**: This option is only configurable from within Atom Beautify's setting panel.
|
||||||
|
|
||||||
|
**Type**: `object`
|
||||||
|
|
||||||
|
**Description**:
|
||||||
|
|
||||||
|
Options for Rubocop executable.
|
||||||
|
|
||||||
|
**How to Configure**
|
||||||
|
|
||||||
|
1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to
|
||||||
|
*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*.
|
||||||
|
2. Go into *Packages* and search for "*Atom Beautify*" package.
|
||||||
|
3. Find the option "*Rubocop*" and change it to your desired configuration.
|
||||||
|
|
||||||
##### [SassConvert](#sassconvert)
|
##### [SassConvert](#sassconvert)
|
||||||
|
|
||||||
**Important**: This option is only configurable from within Atom Beautify's setting panel.
|
**Important**: This option is only configurable from within Atom Beautify's setting panel.
|
||||||
|
|
|
@ -15,6 +15,6 @@ hash = { hosts: [
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
logger: mylog, # This enables callback logging!
|
logger: mylog, # This enables callback logging!
|
||||||
|
|
||||||
max_reconnect_attempts: 5 }
|
max_reconnect_attempts: 5 }
|
||||||
|
|
|
@ -18,7 +18,7 @@ hash = { :hosts => [
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
:logger => mylog, # This enables callback logging!
|
:logger => mylog, # This enables callback logging!
|
||||||
|
|
||||||
:max_reconnect_attempts => 5,
|
:max_reconnect_attempts => 5,
|
||||||
|
|
|
@ -483,4 +483,4 @@
|
||||||
"prettydiff2"
|
"prettydiff2"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -17,10 +17,26 @@ module.exports = class Rubocop extends Beautifier
|
||||||
rubocop_path: true
|
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) ->
|
beautify: (text, language, options, context) ->
|
||||||
fullPath = context.filePath or ""
|
fullPath = context.filePath or ""
|
||||||
[projectPath, _relativePath] = atom.project.relativizePath(fullPath)
|
[projectPath, _relativePath] = atom.project.relativizePath(fullPath)
|
||||||
|
|
||||||
|
# Deprecate options.rubocop_path
|
||||||
|
if options.rubocop_path
|
||||||
|
@deprecateOptionForExecutable("Rubocop", "Ruby - Rubocop Path (rubocop_path)", "Path")
|
||||||
|
|
||||||
# Find the rubocop path
|
# Find the rubocop path
|
||||||
@Promise.all([
|
@Promise.all([
|
||||||
@which(options.rubocop_path) if options.rubocop_path
|
@which(options.rubocop_path) if options.rubocop_path
|
||||||
|
@ -48,14 +64,18 @@ module.exports = class Rubocop extends Beautifier
|
||||||
"--force-exclusion"
|
"--force-exclusion"
|
||||||
"--stdin", "atom-beautify.rb" # filename is required but not used
|
"--stdin", "atom-beautify.rb" # filename is required but not used
|
||||||
]
|
]
|
||||||
|
exeOptions = {
|
||||||
|
ignoreReturnCode: true,
|
||||||
|
cwd: projectPath if configFile?,
|
||||||
|
onStdin: (stdin) -> stdin.end text
|
||||||
|
}
|
||||||
rubocopArguments.push("--config", tempConfig) if tempConfig?
|
rubocopArguments.push("--config", tempConfig) if tempConfig?
|
||||||
@debug("rubocop arguments", rubocopArguments)
|
@debug("rubocop arguments", rubocopArguments)
|
||||||
|
|
||||||
@run(rubocopPath, rubocopArguments, {
|
(if options.rubocop_path then \
|
||||||
ignoreReturnCode: true,
|
@run(rubocopPath, rubocopArguments, exeOptions) else \
|
||||||
cwd: projectPath,
|
@exe("rubocop").run(rubocopArguments, exeOptions)
|
||||||
onStdin: (stdin) -> stdin.end text
|
).then((stdout) =>
|
||||||
}).then((stdout) =>
|
|
||||||
@debug("rubocop output", stdout)
|
@debug("rubocop output", stdout)
|
||||||
# Rubocop output an error if stdout is empty
|
# Rubocop output an error if stdout is empty
|
||||||
return text if stdout.length == 0
|
return text if stdout.length == 0
|
||||||
|
|
|
@ -9278,6 +9278,22 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"rubocop": {
|
||||||
|
"key": "rubocop",
|
||||||
|
"title": "Rubocop",
|
||||||
|
"type": "object",
|
||||||
|
"collapsed": true,
|
||||||
|
"description": "Options for Rubocop executable.",
|
||||||
|
"properties": {
|
||||||
|
"path": {
|
||||||
|
"key": "path",
|
||||||
|
"title": "Binary/Script Path",
|
||||||
|
"type": "string",
|
||||||
|
"default": "",
|
||||||
|
"description": "Absolute path to the \"rubocop\" executable's binary/script."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"sass-convert": {
|
"sass-convert": {
|
||||||
"key": "sass-convert",
|
"key": "sass-convert",
|
||||||
"title": "SassConvert",
|
"title": "SassConvert",
|
||||||
|
|
Loading…
Reference in New Issue