Vim ã® Syntastic 㧠PSR-2 ã³ã¼ãã£ã³ã°è¦ç´ã§ãã§ãã¯ããã話ã
Vim 㧠PHP æ¸ãæã« PSR-2 ã³ã¼ãã£ã³ã°è¦ç´ã«åã£ããã§ãã¯ãè¡ãæ¹æ³ã Syntastic ã¯ã¤ã³ã¹ãã¼ã«æ¸ã¿åæã
PHP_CodeSniffer ãã¤ã³ã¹ãã¼ã«
pear 㧠PHP_CodeSniffer ãã¤ã³ã¹ãã¼ã«ãã
% pear install PHP_CodeSniffer # ã¤ã³ã¹ãã¼ã«ã³ãã³ã % phpcs --version # ãã¼ã¸ã§ã³ãã§ã㯠PHP_CodeSniffer version 1.5.4 (stable) by Squiz (http://www.squiz.net) % phpcs -i # å©ç¨å¯è½ãªã³ã¼ãã£ã³ã°è¦ç´ãåºå The installed coding standards are MySource, PEAR, PHPCS, PSR1, PSR2, Squiz and Zend
Syntastic ã®è¨å®
" for syntastic ----------------------- let g:syntastic_mode_map = { \ 'mode': 'active', \ 'active_filetypes': ['php'] \} let g:syntastic_auto_loc_list = 1 let g:syntastic_php_checkers = ['phpcs'] let g:syntastic_php_phpcs_args='--standard=psr2â
php ã® checker ã¯ããã©ã«ã㧠[âphpâ, âphpcsâ, âphpmdâ]
ã®è¨3ã¤ã
ä¸ã® .vimrc ã®å ´åã¯
syntastic_php_checkers = [âphpcsâ]
ããæå®ãã¦ããªãã®ã§ PHP_CodeSniffer ã®ã¿ã®ãã§ãã¯ã«ãªãã
å
ã
phpcs ã³ãã³ã㯠--standard=psr2
ãªãã·ã§ã³ã§ã³ã¼ãã£ã³ã°è¦ç´ãæå®å¯è½ã
Syntastic å®è¡æã«ãã®ãªãã·ã§ã³ã渡ãçºã« .vimrc å
ã® syntastic_php_phpcs_args
ãã»ãããã¦ããã
以ä¸ã§çµããã
ãã㧠PSR-2 ã³ã¼ãã£ã³ã°è¦ç´ã®ãã§ãã¯ãå¯è½ã«ãªãã¾ãã