Use local phpcs config file if available.

This commit is contained in:
Daniel Brodin 2016-10-25 10:19:26 +02:00
parent 55dad2903e
commit 85d0f19e37
3 changed files with 10 additions and 2 deletions

View File

@ -114,6 +114,10 @@
{ {
"name": "Victor Uriarte", "name": "Victor Uriarte",
"url": "https://github.com/vmuriart" "url": "https://github.com/vmuriart"
},
{
"name": "Daniel Brodin",
"url": "https://github.com/danielbrodin"
} }
], ],
"engines": { "engines": {
@ -301,4 +305,4 @@
"lint": "coffeelint src/ spec/", "lint": "coffeelint src/ spec/",
"code-docs": "codo && open docs/code/index.html" "code-docs": "codo && open docs/code/index.html"
} }
} }

View File

@ -20,6 +20,10 @@ module.exports = class PHPCBF extends Beautifier
beautify: (text, language, options) -> beautify: (text, language, options) ->
@debug('phpcbf', options) @debug('phpcbf', options)
standardFiles = ['phpcs.xml', 'phpcs.xml.dist', 'phpcs.ruleset.xml', 'ruleset.xml']
standardFile = @findFile(atom.project.getPaths()[0], standardFiles);
options.standard = standardFile if standardFile
isWin = @isWindows isWin = @isWindows
if isWin if isWin

View File

@ -42,6 +42,6 @@ module.exports = {
title: "PHPCBF Standard" title: "PHPCBF Standard"
type: 'string' type: 'string'
default: "", default: "",
description: "Standard name Squiz, PSR2, PSR1, PHPCS, PEAR, Zend, MySource... or path to CS rules" description: "Standard name Squiz, PSR2, PSR1, PHPCS, PEAR, Zend, MySource... or path to CS rules. Will use local `phpcs.xml`, `phpcs.xml.dist`, `phpcs.ruleset.xml` or `ruleset.xml` if found in the project root."
} }