Debug PHP in vim and assemble PHP code_sniffer,php-md. Phpqa.vim

Source: Internet
Author: User
Tags imagemagick
Debug PHP in vim and install PHP CODE_SNIFFER,PHP-MD. Phpqa.vim

1: Install PHP code sniffer and PHP MD

PHP Code Sniffer

of the A:centos department.

#yum Install Php-pear

#yum Install Imagemagick-devel

#pear Install Php_codesniffer

#pear Channel-discover pear.phpmd.org

#pear Channel-discover pear.pdepend.org

#pear Install--alldeps PHPMD/PHP_PMD

Modify php.ini file, join extension=imagick.so


of the Debian department.

#apt-get Install Php-pear

#apt-get Install Php5-imagick ImageMagick

Back and above CentOS,

Just do not need to modify php.ini to join the Imagick extension.


2:vim inside

:!php-l% This is the check the current PHP file syntax parameters

:p HPCs, this is code sniffer.

:p HPMD This is mess detector, need an XML rule file if not set

:p HPCC This shows the code coverage. Also need an XML rule file if not set


3: Install Phpqa.vim

Https://github.com/rainysia/vimrc/commits/master

To clone down, put in $~.vim inside, notice is user below. Vim

Add in. vimrc

Let G:phpqa_codesniffer_args = "--standard=zend" let g:phpqa_codesniffer_cmd  = '/usr/bin/phpcs ' let G:phpqa_ Codesniffer_autorun = 1        "  default =1 on Savelet g:phpqa_messdetector_ruleset = ' let G:phpqa_messdetector_cmd = ' /USR/BIN/PHPMD ' Let G:phpqa_messdetector_autorun = 0
Where CMD these two are the first steps above the type out of the path after installation,

#type Phpcs

/usr/bin/phpcs

Autorun = 1 is automatically turned on, when you save it will automatically run the prompt

 
   
  
   
    Sebastian Bergmann ' s ruleset
   
    
  
   
    
  
   
    
  
   
    
  
   
    
  
   
    
  
   
    
  
   
    
  
   
    
  
   
    
  
   
    
  
   
    
  
   
    
  
   
    
  
   
  
 

Now do the next test, open the VIM input and then: w save, prompt error, said PHP can not be closed. It seems that the grammar requirements are very strict. Remove the?> and save it without error.

 
  



Specific can be used in the shell-H view

Reference URL

http://phpmd.org/download/index.html installation PHPMD

http://pear.php.net/package/PHP_CodeSniffer/redirected PHP Code Sniffer

http://blog.csdn.net/xinhaozheng/article/details/3324796 Use of PHP code sniffer

Http://developer.51cto.com/art/201105/261292.htm the use of PHP mess Detor

http://coreymaynard.com/blog/finding-what-stinks-and-cleaning-up-the-mess/Related XML declarations

http://joncairns.com/2012/05/using-vim-as-a-php-ide/#comment -133 Phpqa Articles

Https://github.com/joonty/vim-phpqa is still phpqa.


  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.