Switch from PHP_Beautifier to php-cs-fixer

This commit is contained in:
Ryan Rushton 2015-03-18 21:01:57 -07:00
parent 41bad3c891
commit c5f64d1a47
2 changed files with 20 additions and 17 deletions

View File

@ -1,24 +1,27 @@
###
Requires http://pear.php.net/package/PHP_Beautifier
Requires https://github.com/FriendsOfPHP/PHP-CS-Fixer
###
getCmd = (inputPath, outputPath, options) ->
phpBeautifierPath = options.beautifier_path # jshint ignore: line
filters = options.filters
directoryFilters = options.directory_filters # jshint ignore: line
phpCsFixerPath = options.beautifier_path # jshint ignore: line
fixers = options.fixers
level = options.level # jshint ignore: line
cmd = "--input \"#{inputPath}\" --output \"#{outputPath}\""
levelOption = ""
fixerOption = ""
if filters
cmd += " --filters \"#{filters}\""
if directoryFilters
cmd += " --directory_filters \"#{directoryFilters}\""
if level
levelOption = " --level=#{level} "
if fixers
fixerOption = " --fixers=#{fixers}"
if phpBeautifierPath
cmd = "#{levelOption} #{fixerOption} \"#{inputPath}\") || (mv \"#{inputPath}\" \"#{outputPath}\")"
if phpCsFixerPath
# Use absolute path
"php \"#{phpBeautifierPath}\" #{cmd}"
"(php \"#{phpCsFixerPath}\" fix #{cmd}"
else
# Use command available in $PATH
"php_beautifier #{cmd}"
"(php-cs-fixer fix #{cmd}"
"use strict"
cliBeautify = require("./cli-beautify")

View File

@ -275,15 +275,15 @@ module.exports =
php_beautifier_path:
type: 'string'
default: ""
description: "Path to the `PHP_Beautifier` CLI executable"
php_filters:
description: "Path to the `php-cs-fixer` CLI executable"
php_fixers:
type: 'string'
default: ""
description: "Add filter(s). i.e. \"Filter1(setting1=value1,setting2=value2) Filter2()\""
php_directory_filters:
description: "Add fixer(s). i.e. linefeed,-short_tag,indentation"
php_level:
type: 'string'
default: ""
description: "Include dirs for filters"
description: "By default, all PSR-2 fixers and some additional ones are run."
# Python
python_autopep8_path: