Merge branch 'beefsack-master'

This commit is contained in:
Glavin Wiechert 2016-12-30 01:58:31 -04:00
commit 604b6340d6
6 changed files with 49 additions and 15 deletions

View File

@ -101,7 +101,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti
| OCaml | `OCaml` |`.ml` | [`ocp-indent`](https://www.typerex.org/ocp-indent.html) (Default) |
| Pawn | `Pawn` | | [`Uncrustify`](https://github.com/uncrustify/uncrustify) (Default) |
| Perl | `Perl`, `Perl 6` |`.pl` | [`Perltidy`](http://perltidy.sourceforge.net/) (Default) |
| PHP | `PHP` |`.php`, `.module`, `.inc` | [`PHP-CS-Fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) (Default), [`PHPCBF`](http://php.net/manual/en/install.php) |
| PHP | `PHP` |`.php`, `.module`, `.inc` | [`PHP-CS-Fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) (Default), [`PHPCBF`](http://php.net/manual/en/install.php), [`hh_format`](http://hhvm.com/) |
| Puppet | `Puppet` |`.pp` | [`puppet-lint`](http://puppet-lint.com/) (Default) |
| Python | `Python` |`.py` | [`autopep8`](https://github.com/hhatto/autopep8) (Default), [`yapf`](https://github.com/google/yapf) |
| R | `R` |`.r`, `.R` | [`formatR`](https://github.com/yihui/formatR) (Default) |

View File

@ -9043,18 +9043,18 @@ Specify a configuration file which will override the default name of .perltidyrc
#### [PHP](#php)
**Supported Beautifiers**: [`PHP-CS-Fixer`](#php-cs-fixer) [`PHPCBF`](#phpcbf)
**Supported Beautifiers**: [`hh_format`](#hh_format) [`PHP-CS-Fixer`](#php-cs-fixer) [`PHPCBF`](#phpcbf)
| Option | PHP-CS-Fixer | PHPCBF |
| --- | --- | --- |
| `disabled` | :white_check_mark: | :white_check_mark: |
| `default_beautifier` | :white_check_mark: | :white_check_mark: |
| `beautify_on_save` | :white_check_mark: | :white_check_mark: |
| `cs_fixer_path` | :white_check_mark: | :x: |
| `fixers` | :white_check_mark: | :x: |
| `level` | :white_check_mark: | :x: |
| `phpcbf_path` | :white_check_mark: | :x: |
| `standard` | :white_check_mark: | :white_check_mark: |
| Option | PHP-CS-Fixer | PHPCBF | hh_format |
| --- | --- | --- | --- |
| `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `cs_fixer_path` | :white_check_mark: | :x: | :x: |
| `fixers` | :white_check_mark: | :x: | :x: |
| `level` | :white_check_mark: | :x: | :x: |
| `phpcbf_path` | :white_check_mark: | :x: | :x: |
| `standard` | :white_check_mark: | :white_check_mark: | :x: |
**Description**:
@ -9085,7 +9085,7 @@ Disable PHP Beautification
**Type**: `string`
**Enum**: `PHP-CS-Fixer` `PHPCBF`
**Enum**: `hh_format` `PHP-CS-Fixer` `PHPCBF`
**Description**:

View File

@ -290,7 +290,8 @@
"cljfmt",
"bash",
"beautysh",
"glsl"
"glsl",
"hh_format"
],
"devDependencies": {
"coffeelint": "^1.10.1",
@ -304,4 +305,4 @@
"lint": "coffeelint src/ spec/",
"code-docs": "codo && open docs/code/index.html"
}
}
}

View File

@ -0,0 +1,30 @@
###
Requires http://hhvm.com/
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class HhFormat extends Beautifier
name: "hh_format"
link: "http://hhvm.com/"
options:
PHP: false
beautify: (text, language, options) ->
@run("hh_format", [
@tempFile("input", text)
],
{
help: {
link: "http://hhvm.com/"
}
}).then((output) ->
# hh_format can exit with status 0 and no output for some files which
# it doesn't format. In that case we just return original text.
if output.trim()
output
else
@Promise.resolve(new Error("hh_format returned an empty output."))
)

View File

@ -43,6 +43,7 @@ module.exports = class Beautifiers extends EventEmitter
'crystal'
'dfmt'
'elm-format'
'hh_format'
'htmlbeautifier'
'csscomb'
'gherkin'

View File

@ -19,6 +19,8 @@ module.exports = {
"inc"
]
defaultBeautifier: "PHP-CS-Fixer"
options:
cs_fixer_path:
title: "PHP-CS-Fixer Path"