Skip to content

Commit

Permalink
Merge pull request #3 from BrandonDusseau/master
Browse files Browse the repository at this point in the history
Added sample editor configurations to readme
  • Loading branch information
solonrice committed Nov 30, 2015
2 parents 4fdaa20 + 07aa107 commit b581443
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,60 @@ The Barracuda coding standards follow PSR-1 and PSR-2 standards closely with a f
INSTALLATION
------------

Install [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer#installation)
1. Install [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer#installation)

2. Install your editor plugin.
- For Sublime Text, this is `Phpcs` in Package Control.
- For Atom, install `linter` and `linter-phpcs`

SETUP
-----

When running `phpcs` or `phpcbf` point it to the location where you cloned this repo with the `--standard=/path/to/this/repo/PHP_CodeSniffer/Barracuda/ruleset.xml`

Below are some sample configurations for various editors:

### Sublime Text 2 & 3
There is an example .sublime-project file for Sublime Text in the config directory. You'll need to rename it to .sublime-project and place it in your repo directories.

{
"phpcs_additional_args": {

// self-explanatory
"--standard": "/absolute/path/to/commonstandards/Barracuda/ruleset.xml",

// this allows us to continue to use tabs (part of our standard)
"--tab-width": "4",

// this silences notices and yells only about important stuff
"-n": ""
},

// self-explanatory
"phpcs_executable_path": "/absolute/path/to/phpcs"
}

### Atom
For Atom, the following configuration should be added to ~/.atom/Config.cson. It can also be configured in the `linter-phpcs` settings page.

"linter-phpcs":
codeStandardOrConfigFile: "/absolute/path/to/commonstandards/Barracuda/ruleset.xml"
executablePath: "/absolute/path/to/phpcs"
tabWidth: 4
warningSeverity: 0

### vim
It is suggested to use [Syntastic](https://github.com/scrooloose/syntastic) for vim.
This supports phpcs for php checking as well as many other languages
The following config should do php linting as well as code sniffing

" Use the following for checking php files
let g:syntastic_php_checkers = ['php', 'phpcs']
" Aggregate all the errors together
let g:syntastic_aggregate_errors = 1
" Set phpcs args
let g:syntastic_php_phpcs_args="--standard=/path/to/common-standards/Barracuda"

TODO
----
- require newline or opening brace before // comments
Expand Down

0 comments on commit b581443

Please sign in to comment.