mac Atom php静态代码检查phpcs,phpmd

首先 你的mac 得安装atom

你的mac有PHP环境

linter-phpcs 主要检查格式 linter-phpmd主要检查语法

1、sudo  pear install PHP_CodeSniffer

如果一切正常的话,你执行phpcs --version可以看到版本号了。
执行phpcs -i可以看到它已经预先安装好一些标准了:

The installed coding standards are MySource, PEAR, PHPCS, PSR1, PSR2, Squiz, Zend

一般第一次会遇到


Warning: include_once(PHP/CodeSniffer/CLI.php): failed to open stream: No such file or directory in /usr/local/bin/phpcs on line 21

Warning: include_once(): Failed opening 'PHP/CodeSniffer/CLI.php' for inclusion (include_path='.:') in /usr/local/bin/phpcs on line 21

Fatal error: Class 'PHP_CodeSniffer_CLI' not found in /usr/local/bin/phpcs on line 24

用以下命令找出路径

pear config-get php_dir

我的执行结果是:‘/usr/lib/php/pear’

然后修改php.ini,添加或修改一行

include_path = ".:/usr/lib/php/pear"

再执行phpcs -i 就正常了。

 

配置文件: /usr/lib/php/pear/data/PHP_CodeSniffer/CodeSniffer.conf

这样PHP_CodeSniffer就安装好了 。

接下来就是配置Atom 插件了。

安装linter-phpcs 插件。启用  这样就可以用了 。(无需配置)

系统中安装phpmd

composer global require phpmd/phpmd

系统中安装linter-phpmd插件

apm install linter-phpmd

安装完后来测试可以看到系统中。有了phpmd命令。
这时再Atom中编辑php文件就会自动检查了。

在linter-phpmd安装的过程中我的出现了如下故障:

[Linter] Error running PHPMD Error: Failed to spawn command `phpmd`. Make sure `phpmd` is installed and on your PATH(…)

解决方法:

找到本地phpmd 的安装路径:我的/Users/eric/.composer/vendor/bin

然后 

也可以直接编辑  ~/.atom/init.coffee这个文件。

 

最终效果

 

phpstorm 上安装这些插件参考:http://confluence.jetbrains.com/display/PhpStorm/PHP+Mess+Detector+in+PhpStorm#PHPMessDetectorinPhpStorm-1.EnablePHPMessDetectorintegrationinPhpStorm

编辑自定义规则参考:http://www.kancloud.cn/bajiao/phpmd/128478

165 thoughts on “mac Atom php静态代码检查phpcs,phpmd

  1. Pingback: calgary scrap car removal

  2. Pingback: cash for scrap cars calgary (403) 390-0585

  3. Pingback: professional hairdressing scissor brands

  4. Pingback: sex drug

  5. Pingback: elite chinese scissors

  6. Pingback: CBD gummies

  7. Pingback: best CBD oil

  8. Pingback: CBD gummies

  9. Pingback: education

  10. Pingback: scraping api

  11. Pingback: best Royal CBD oil

  12. Pingback: CBD oil

  13. Pingback: CBD oil for sale

  14. Pingback: CBD oil

  15. Pingback: best CBD gummies

  16. Pingback: CBD gummies

  17. Pingback: best CBD capsules

  18. Pingback: Royal CBD

  19. Pingback: Royal CBD

  20. Pingback: CBD products

  21. Pingback: carte prepagate

  22. Pingback: CBD

  23. Pingback: paddle board

  24. Pingback: Nairobiwire

  25. Pingback: apps for pc download

  26. Pingback: app for pc download

  27. Pingback: dispensaries near me

  28. Pingback: what to do in quarantine

  29. Pingback: finger vibe

  30. Pingback: thrusting massager

  31. Pingback: belladonnas pocket stroker

  32. Pingback: best male masturbation toy

  33. Pingback: remote control bullet

  34. Pingback: CBD capsules

  35. Pingback: CBD store

  36. Pingback: CBD for sale

  37. Pingback: CBD gummies

  38. Pingback: CBD oil

  39. Pingback: CBD gummies

  40. Pingback: CBD capsules

  41. Pingback: CBD gummies

  42. Pingback: Cannabis oil for sale

  43. Pingback: beginner strap on

  44. Pingback: CBD cream

  45. Pingback: anal play

  46. Pingback: Atta chakki

  47. Pingback: extender sleeve

  48. Pingback: dank vapes

  49. Pingback: CBD products

  50. Pingback: Royal CBD

  51. Pingback: CBD oil

  52. Pingback: doctor7online.com

  53. Pingback: ventolin inhaler without an rx

  54. Pingback: best cbd cream for pain

  55. Pingback: best cbd cream for pain

  56. Pingback: Cockatoo

  57. Pingback: Buy Dmt

  58. Pingback: Grand Power Stribog

  59. Pingback: Buy Marijuana Online

  60. Pingback: Research Chemicals for Sale

  61. Pingback: cialis 20mg

  62. Pingback: keflex antibiotic cipro

  63. Pingback: viagra 100mg

  64. Pingback: buy viagra online

  65. Pingback: dildo and balls

  66. Pingback: jelly dildos

  67. Pingback: sex toys for men

  68. Pingback: Dank vapes carts

  69. Pingback: can you buy naltrexone over the counter

  70. Pingback: Consultant SEO

  71. Pingback: crystal meth for sale

  72. Pingback: buy hydrocodone online

  73. Pingback: Exotic carts

  74. Pingback: where to buy xanax online

  75. Pingback: هاي مصر

  76. Pingback: English bulldog puppies for sale

  77. Pingback: buy CBD oil

  78. Pingback: best CBD oil for arthritis

  79. Pingback: MALWAREBYTES BROWSER EXTENSION

  80. Pingback: best CBD oil for dogs

  81. Pingback: best CBD oil for sleep

  82. Pingback: best CBD oil for pain

  83. Pingback: best CBD oil

  84. Pingback: best CBD oil for dogs

  85. Pingback: best CBD oil for sleep

  86. Pingback: best CBD cream for arthritis pain

  87. Pingback: buy CBD oil

  88. Pingback: best CBD oil for sleep

  89. Pingback: best CBD oil for arthritis

  90. Pingback: CBD oil for anxiety

  91. Pingback: best CBD oil for pain

  92. Pingback: best CBD oil for anxiety

  93. Pingback: best CBD capsules

  94. Pingback: best CBD oil

  95. Pingback: best CBD capsules

  96. Pingback: best CBD oil

  97. Pingback: best CBD oil

  98. Pingback: best CBD oil

  99. Pingback: best CBD gummies

  100. Pingback: best CBD oil

  101. Pingback: equate acetaminophen 500 mg

  102. Pingback: best CBD gummies

  103. Pingback: best CBD oil

  104. Pingback: best CBD gummies

  105. Pingback: best CBD oil

  106. Pingback: best CBD gummies

  107. Pingback: best CBD gummies

  108. Pingback: games free download for windows 10

  109. Pingback: free download for pc windows

  110. Pingback: apk download for windows 8

  111. Pingback: free download for windows pc

  112. Pingback: app free download for windows 8

  113. Pingback: free download for windows 7

  114. Pingback: free download for windows 8

  115. Pingback: app for pc

  116. Pingback: free download for laptop

  117. Pingback: apps for pc download

  118. Pingback: pc games

  119. Pingback: free app for pc download

  120. Pingback: app for pc download

  121. Pingback: free games download for windows 8

  122. Pingback: free download for laptop pc

  123. Pingback: free download for pc windows

  124. Pingback: free app for pc download

  125. Pingback: apps download for windows 7

  126. Pingback: free download for windows 7

  127. Pingback: app for pc

  128. Pingback: app download for pc

  129. Pingback: free app for pc download

  130. Pingback: free games download for windows 8

  131. Pingback: vape shop near me

  132. Pingback: make money online

  133. Pingback: roulette software

  134. Pingback: knight rider kitt for sale

  135. Pingback: how to win at roulette

  136. Pingback: win at online roulette

  137. Pingback: best roulette software

  138. Pingback: seo service

  139. Pingback: kratom near me

  140. Pingback: CBD oils

  141. Pingback: CBD oils UK

  142. Pingback: bàn học cho bé trai

  143. Pingback: CBD

  144. Pingback: best CBD oils UK

  145. Pingback: buy CBD oil

  146. Pingback: CBD oil UK

  147. Pingback: CBD oil UK

  148. Pingback: CBD oil for arthritis

  149. Pingback: CBD oil for depression

  150. Pingback: CBD oil for depression

  151. Pingback: best CBD oil UK

  152. Pingback: buy CBD oil

  153. Pingback: free instagram followers

  154. Pingback: Buy research chemicals online

  155. Pingback: Xanax bars for sale cheap

  156. Pingback: file transfer

  157. Pingback: online brands

  158. Pingback: White Shepherd dogs for sale

  159. Pingback: industry

  160. Pingback: Work from Home Jobs

  161. Pingback: Make Money from Home

  162. Pingback: Make Money from Home

  163. Pingback: Make Money from Home

  164. Pingback: Make Money from Home

  165. Pingback: bitcoin slots