Switch from PHP_Beautifier to php-cs-fixer
This commit is contained in:
parent
41bad3c891
commit
c5f64d1a47
|
@ -1,24 +1,27 @@
|
||||||
###
|
###
|
||||||
Requires http://pear.php.net/package/PHP_Beautifier
|
Requires https://github.com/FriendsOfPHP/PHP-CS-Fixer
|
||||||
###
|
###
|
||||||
getCmd = (inputPath, outputPath, options) ->
|
getCmd = (inputPath, outputPath, options) ->
|
||||||
phpBeautifierPath = options.beautifier_path # jshint ignore: line
|
phpCsFixerPath = options.beautifier_path # jshint ignore: line
|
||||||
filters = options.filters
|
fixers = options.fixers
|
||||||
directoryFilters = options.directory_filters # jshint ignore: line
|
level = options.level # jshint ignore: line
|
||||||
|
|
||||||
cmd = "--input \"#{inputPath}\" --output \"#{outputPath}\""
|
levelOption = ""
|
||||||
|
fixerOption = ""
|
||||||
|
|
||||||
if filters
|
if level
|
||||||
cmd += " --filters \"#{filters}\""
|
levelOption = " --level=#{level} "
|
||||||
if directoryFilters
|
if fixers
|
||||||
cmd += " --directory_filters \"#{directoryFilters}\""
|
fixerOption = " --fixers=#{fixers}"
|
||||||
|
|
||||||
if phpBeautifierPath
|
cmd = "#{levelOption} #{fixerOption} \"#{inputPath}\") || (mv \"#{inputPath}\" \"#{outputPath}\")"
|
||||||
|
|
||||||
|
if phpCsFixerPath
|
||||||
# Use absolute path
|
# Use absolute path
|
||||||
"php \"#{phpBeautifierPath}\" #{cmd}"
|
"(php \"#{phpCsFixerPath}\" fix #{cmd}"
|
||||||
else
|
else
|
||||||
# Use command available in $PATH
|
# Use command available in $PATH
|
||||||
"php_beautifier #{cmd}"
|
"(php-cs-fixer fix #{cmd}"
|
||||||
|
|
||||||
"use strict"
|
"use strict"
|
||||||
cliBeautify = require("./cli-beautify")
|
cliBeautify = require("./cli-beautify")
|
||||||
|
|
|
@ -275,15 +275,15 @@ module.exports =
|
||||||
php_beautifier_path:
|
php_beautifier_path:
|
||||||
type: 'string'
|
type: 'string'
|
||||||
default: ""
|
default: ""
|
||||||
description: "Path to the `PHP_Beautifier` CLI executable"
|
description: "Path to the `php-cs-fixer` CLI executable"
|
||||||
php_filters:
|
php_fixers:
|
||||||
type: 'string'
|
type: 'string'
|
||||||
default: ""
|
default: ""
|
||||||
description: "Add filter(s). i.e. \"Filter1(setting1=value1,setting2=value2) Filter2()\""
|
description: "Add fixer(s). i.e. linefeed,-short_tag,indentation"
|
||||||
php_directory_filters:
|
php_level:
|
||||||
type: 'string'
|
type: 'string'
|
||||||
default: ""
|
default: ""
|
||||||
description: "Include dirs for filters"
|
description: "By default, all PSR-2 fixers and some additional ones are run."
|
||||||
|
|
||||||
# Python
|
# Python
|
||||||
python_autopep8_path:
|
python_autopep8_path:
|
||||||
|
|
Loading…
Reference in New Issue