首页
免费后端云服务
关于
Search
1
小程序后端入门系列视频教程【一-微信开发工具介绍】
9,812 阅读
2
微信小程序三级联动之多列选择器
9,710 阅读
3
小程序开发免费后端之神秘利器分享
9,632 阅读
4
Golang-开发企业级资源权限管理【第一步表设计】-1
9,174 阅读
5
学会微信服务端开发第一步
9,049 阅读
日常记录
日常
随笔
Bmob后端云
从零开始学物联网
Serverless实战驾校小程序
心邮
Serverless
向量数据库
登录
Search
Typecho
累计撰写
124
篇文章
累计收到
22
条评论
首页
栏目
日常记录
日常
随笔
Bmob后端云
从零开始学物联网
Serverless实战驾校小程序
心邮
Serverless
向量数据库
页面
免费后端云服务
关于
搜索到
1
篇与
的结果
2016-03-26
Unix、Linux、mac 内核系统 Sublime 2、3 配置php code sniffer插件
好久没更新自己博客了,今天正好给同事们写一篇sublime 如何配置php code sniffer,发现国内还没有一个比较完善的教程,所以把它放到网上。 一、windows PHPSTORM 配置php code sniffer插件。二、MAC OS PHPSTORM 配置php code sniffer插件。三、MAC OS Sublime 3 配置php code sniffer插件。一、windows PHPSTORM 配置php code sniffer插件。1. 点击菜单:File->Settings 或 按快捷键 Ctrl+Alt+S2. 选择Project Settings下的:PHP->Code Sniffer3. 设置PHP Code Sniffer(phpcs) path为:E:\wamp\bin\pear\phpcs.bat(根据自己电脑情况设置)4. 点击Validate按钮,可以看到如下提示,说明设置OK为知笔记图片5. 选择Project Settings下的Inspections,展开PHP,勾选PHP Code Sniffer validation为知笔记图片6. 第一次打开的时候,需要点击一下刷新的按钮可以获取已安装的代码规范,如果无法获取到代码规范的话,先执行 phpcs -i命令查看PHP_CodeSniffer中已经安装的编码风格,确定有之后,尝试重启一下PhpStorm在刷新看看7. 选择一个你习惯的编码风格,然后Apply配置为知笔记图片 8. 打开一个PHP文件,就可以看到不符合规则的提示为知笔记图片二、MAC OS PHPSTORM 配置php code sniffer插件。设置PHP Code Sniffer(phpcs) path为:/usr/local/bin/phpcs2. 点击Validate按钮,可以看到如下提示,说明设置OK为知笔记图片3.启用代码风格为知笔记图片4.演示效果为知笔记图片三、MAC OS Sublime 3 配置php code sniffer插件。1.系统安装PHP_CodeSniffer、phpmd、php-cs-fixer pear install PHP_CodeSniffer brew install phpmd sudo curl -o /usr/local/bin/php-cs-fixer sudo chmod a+x /usr/local/bin/php-cs-fixer 2.sublime 2 安装 phpcs插件(安装方法(Ctrl+Shift+P->pi(packageinstall)->phpcs,安装成功后右键即可看到PHP Code Sniffer选项))为知笔记图片3.刚刚安装好的插件,sniff this file 显示的是灰色的,修改下配置文件(这是 Sublime 2的配置) Sublime3的配置有所区别,请自行检查。 1. { 2. // *nix based systems, Mac OS X and Linux 3. // - All commands on and using PATHS 4. 5. // We want debugging on 6. "show_debug": true, 7. 8. // Only execute for .php files 9. "extensions_to_execute": ["php"], 10. 11. // Do not execute for twig files 12. "extensions_to_blacklist": ["twig.php"], 13. 14. // Execute the sniffer on file save 15. "phpcs_execute_on_save": false, 16. 17. // Show the error list after save. 18. "phpcs_show_errors_on_save": true, 19. 20. // Show the errors in the gutter 21. "phpcs_show_gutter_marks": true, 22. 23. // Show outline for errors 24. "phpcs_outline_for_errors": true, 25. 26. // Show the errors in the status bar 27. "phpcs_show_errors_in_status": true, 28. 29. // Show the errors in the quick panel so you can then goto line 30. "phpcs_show_quick_panel": true, 31. 32. 33. // PHP_CodeSniffer settings 34. // Run the PHP_CodeSniffer 35. "phpcs_sniffer_run": true, 36. 37. // Execute PHP_CodeSniffer on save 38. "phpcs_command_on_save": true, 39. 40. // Path to phpcs 41. "phpcs_executable_path": "/usr/local/bin/phpcs", 42. 43. // Run the PEAR standard without warnings 44. "phpcs_additional_args": { 45. "--standard": "PEAR", 46. "-n": "" 47. }, 48. 49. 50. // PHP-CS-Fixer settings 51. // Do not automatically fix the errors 52. "php_cs_fixer_on_save": false, 53. 54. // Show the fixes in the quick panel 55. "php_cs_fixer_show_quick_panel": true, 56. 57. // Path to where php-cs-fixer.phar is 58. "php_cs_fixer_executable_path": "/usr/local/bin/php-cs-fixer", 59. 60. // Run all levels of fixing 61. "php_cs_fixer_additional_args": { 62. }, 63. 64. 65. // PHP Linter settings 66. // Lint each file 67. "phpcs_linter_run": true, 68. 69. // Execute the linter on save 70. "phpcs_linter_command_on_save": true, 71. 72. // Use the $PATH version of php 73. "phpcs_php_path": "/usr/local/bin/phpcs", 74. 75. // Regex for the errors the linter produces 76. "phpcs_linter_regex": "(?P.*) on line (?P\d+)", 77. 78. 79. // PHP Mess Detector settings 80. // Execute phpmd 81. "phpmd_run": true, 82. 83. // Execute the phpmd on file save 84. "phpmd_command_on_save": true, 85. 86. // Path to where the phpmd application is 87. "phpmd_executable_path": "/usr/local/bin/phpmd", 88. 89. // What args I want to pass to phpmd 90. "phpmd_additional_args": { 91. "codesize,unusedcode,naming": "" 92. }, 93. 94. // PHP Scheck settings 95. // Execute scheck 96. "scheck_run": false, 97. 98. // Execute the scheck on file save 99. "scheck_command_on_save": false, 100. 101. // It seems python/sublime cannot always find the scheck application 102. // If empty, then use PATH version of scheck, else use the set value 103. "scheck_executable_path": "", 104. 105. // Additional arguments you can specify into the application 106. "scheck_additional_args": { 107. "-strict" : "" 108. } 109. } 4.完成为知笔记图片PS:如submit 出现报错,可显示调试信息调试具体问题 Ctrl+~;如再有问题,可联系我。 为知笔记图片
2016年03月26日
37 阅读
0 评论
0 点赞