codesniffer

How to setup PHP CodeSniffer that extend WordPress coding standards + autofix errors in VSCode?

泪湿孤枕 提交于 2019-12-10 17:43:17
问题 How to setup PHP CodeSniffer for project with personal rules that extend WordPress coding standards + autofix errors in VSCode on save? I have installed CodeSniffer globally composer global require "squizlabs/php_codesniffer=*" WordPress coding standards are installed inside theme folder (so inside project they are at /wp-content/themes/bideja/wpcs ) git clone -b master https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git wpcs Inside theme folder I have created phpcs

How to use PHP_CodeSniffer with XAMPP?

不问归期 提交于 2019-12-07 06:36:32
问题 I am running XAMPP with windows XP. I just download PHP_CodeSniffer and cannot figure out how to run it. Thank you 回答1: The documentation has it all. EDIT: The first line of phpcs is: #!@php_bin@ you need to replace @php_bin@ with correct path to php to make a meaningful shebang as(In linux): #!/usr/bin/php Since windows does not have the concept of shebang, you can delete the first line of phpcs and then run it as: C:\>path\to\php\bin\php.exe path\to\phpcs path\to\file\to\analyze 来源: https:/

Xdebug triggered by Code Sniffer in PHPStorm

非 Y 不嫁゛ 提交于 2019-12-06 08:02:52
问题 I have both xdebug and Code Sniffer working great on my installation of PHPStorm, but the one really annoying part is that the debugger now seems to be treating Code Sniffer errors as breakpoints and interrupts the code to let me know of style warnings while I'm trying to test out code. What can I do to prevent Code Sniffer from being caught by the remote debugger in PHPStorm? PS: I'm running Apache, using virtual hosts to map certain URLs to folders on my computer, and code sniffer never

How to use PHP_CodeSniffer with XAMPP?

六眼飞鱼酱① 提交于 2019-12-05 10:22:57
I am running XAMPP with windows XP. I just download PHP_CodeSniffer and cannot figure out how to run it. Thank you The documentation has it all. EDIT: The first line of phpcs is: #!@php_bin@ you need to replace @php_bin@ with correct path to php to make a meaningful shebang as(In linux): #!/usr/bin/php Since windows does not have the concept of shebang, you can delete the first line of phpcs and then run it as: C:\>path\to\php\bin\php.exe path\to\phpcs path\to\file\to\analyze 来源: https://stackoverflow.com/questions/3611865/how-to-use-php-codesniffer-with-xampp

PHPCS not running on the command line?

微笑、不失礼 提交于 2019-12-05 05:49:58
问题 When I type in phpcs --version, instead of getting the version number, I get something like this: /Applications/drupal/php/bin/phpcs: line 2: ?php: No such file or directory /Applications/drupal/php/bin/phpcs: line 3: /Applications: is a directory /Applications/drupal/php/bin/phpcs: line 4: Applications: command not found /Applications/drupal/php/bin/phpcs: line 5: Applications: command not found /Applications/drupal/php/bin/phpcs: line 6: Applications: command not found /Applications/drupal

Xdebug triggered by Code Sniffer in PHPStorm

血红的双手。 提交于 2019-12-04 11:42:08
I have both xdebug and Code Sniffer working great on my installation of PHPStorm, but the one really annoying part is that the debugger now seems to be treating Code Sniffer errors as breakpoints and interrupts the code to let me know of style warnings while I'm trying to test out code. What can I do to prevent Code Sniffer from being caught by the remote debugger in PHPStorm? PS: I'm running Apache, using virtual hosts to map certain URLs to folders on my computer, and code sniffer never triggered PHPStorm's remote debugger explicitly, while my site caused PHPStorm to ask me if I wanted to

How to Ignore Line Length PHP_CodeSniffer

荒凉一梦 提交于 2019-12-03 10:40:45
问题 I have been using PHP_CodeSniffer with jenkins, my build.xml was configured for phpcs as below <target name="phpcs"> <exec executable="phpcs"> <arg line="--report=checkstyle --report-file=${basedir}/build/logs/checkstyle.xml --standard=Zend ${source}"/> </exec> </target> And I would like to ignore the following warning FOUND 0 ERROR(S) AND 1 WARNING(S) AFFECTING 1 LINE(S) -------------------------------------------------------------------------------- 117 | WARNING | Line exceeds 80

Git: pre-receive hook with PHP_CodeSniffer

烂漫一生 提交于 2019-12-03 09:06:22
问题 Since switching from SVN to Git, we lost the ability to enforce our coding standards through a pre-commit hook on the subversion server. With Git, you only have pre-commit hooks on the client which cannot be enforced in any way. What makes it worse is that we have developers working with all three main operating systems, thus a pre-commit hook that works on Linux or OS X does not automatically work on Windows. The way to go is implementing a pre-receive hook on the server, but the solution is

How useful is PHP CodeSniffer? Code Standards Enforcement in General? [closed]

烈酒焚心 提交于 2019-12-03 00:51:49
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not

Git: pre-receive hook with PHP_CodeSniffer

六月ゝ 毕业季﹏ 提交于 2019-12-02 23:17:58
Since switching from SVN to Git, we lost the ability to enforce our coding standards through a pre-commit hook on the subversion server. With Git, you only have pre-commit hooks on the client which cannot be enforced in any way. What makes it worse is that we have developers working with all three main operating systems, thus a pre-commit hook that works on Linux or OS X does not automatically work on Windows. The way to go is implementing a pre-receive hook on the server, but the solution is not as easy as it seems: Imagine the developer did 20 commits and wants to push them. All pre-commit