Questions tagged [phpcodesniffer]

PHP_CodeSniffer is a PHP PEAR package that can be used to tokenise PHP, JavaScript and CSS files and to detect violations of a defined set of coding standards.

PHP_CodeSniffer is a PHP PEAR package that can be used to tokenise PHP, JavaScript and CSS files and to detect violations of a defined set of coding standards. More information can be found here: http://pear.php.net/package/PHP_CodeSniffer/redirected , including documentation and download links.

327 questions
0
votes
1 answer

Test theme with theme Sniffer

it's been a week I'm trying to fix errors generated by Theme Sniffer Plugins. but I have not succeeded, please help here are the code and the errors:

user7874052
0
votes
1 answer

Does PHP CodeSniffer support rule-specific configuration like Rubcop?

With Rubocop I can override rules in a .rubocop.yml file like this: AllCops: RunRailsCops: true # Commonly used screens these days easily fit more than 80 characters. Metrics/LineLength: Max: 120 # Too short methods lead to extraction of…
Tom at FFI
  • 177
  • 12
0
votes
2 answers

How can we customize Wordpress coding standards and use them in VSCode?

How can we customize Wordpress coding standards on Windows and use them with VSCode? I am trying to do this globally so I don't have to do it for every project (I don't think currently that this is a bad idea?) but I guess the same thing can be…
Ivan Topić
  • 3,064
  • 6
  • 34
  • 47
0
votes
1 answer

How to configure PHP CodeSniffer to allow arrays with any indentation?

I have a custom rule set defined in an XML. I am used to hit a tab after each => so that, if my array is multi-line, things will align nicely. It became a habit and I use that for single line arrays also. Therefore, a multi-line array might look…
Stefan Gabos
  • 1,345
  • 13
  • 15
0
votes
1 answer

Error while setuping CodeSniffer in PhpStorm with remote interpreter

I have setup remote interpreter with php7.2. Now I want to setup remote CodeSniffer. I have setup it remotely with pear. However now I PhpStorm does not allow me to select remote interpreter. It shows the following: CodeSniffer is saved in IDE…
FreeLightman
  • 2,224
  • 2
  • 27
  • 42
0
votes
1 answer

Git status not showing my PHP CodeSniffer auto code correction

I am new to PHP CodeSniffer, I have git pulled PHP CodeSniffer in my Mac Machine and kept in /var/www/PHP_CodeSniffer and I have my source code in /var/www/Project1. I have git in /var/www/Project1 and is now pointing to a branch CodeCorrection When…
Vijayanand Premnath
  • 3,415
  • 4
  • 25
  • 42
0
votes
0 answers

codesniffer not working with php 7.0 and netbeans 8.1

I have installed code sniffer with below steps , Download phpcs.phar file from below link https://github.com/squizlabs/PHP_CodeSniffer Go to NetBeans -> Tools -> plugins . install PHPCSMD. Now go to Tools -> options -> PHP, Find “Code Analysis”. Put…
hetal gohel
  • 335
  • 9
  • 21
0
votes
1 answer

PHP CodeSniffer: use of self::$types inside closure

Running PHP CodeSniffer on the below snippet: return array_filter($methods, function ($method) { return in_array( strtolower($method['type']), self::$types ); }); I get this error message: Use of self::$types inside…
Andrea
  • 15,900
  • 18
  • 65
  • 84
0
votes
1 answer

Method name "Media_Content_Taxonomy::mctf_register_media_content_taxonomy" is not in camel caps format

I am using PHPCS for the first time with standard=WordPress. While sniffing a class file I get the following error: Method name "Media_Content_Taxonomy::mctf_register_media_content_taxonomy" is not in camel caps format. I Googled but could not find…
Subrata Sarkar
  • 2,975
  • 6
  • 45
  • 85
0
votes
1 answer

how to start with php code sniffer

I have all written code and i want to this code standarise by php code sniffer. I would like to know what is the best way to start with it. I had installed it but when i run the command phpcs /path/to/code/myfile.php In the command line I got…
XMen
  • 29,384
  • 41
  • 99
  • 151
0
votes
1 answer

Multi-line function call not indented correctly

In the coding standards that I'm using we use 2 spaces for indentation
dingo_d
  • 11,160
  • 11
  • 73
  • 132
0
votes
0 answers

Drupal Code Sniffer Not Returning Results

When using phpcs -v --standard=Drupal on a drupal site with coder installed the only results I get are: Registering sniffs in the Drupal standard... When I use any other standard (Pear, PSR, WordPress, Squiz, etc...) I get results. Has anyone…
Jeremy
  • 494
  • 1
  • 8
  • 20
0
votes
0 answers

How can I install PHP Code Sniffer on a Windows server?

I want to start using PHP Code Sniffer in PhpStorm but I am not sure how I can configure it for my environment. I connect to a Windows server using RDP, PhpStorm is installed on this box. My development server is a Centos VM. Am I correct in…
Mick
  • 1,401
  • 4
  • 23
  • 40
0
votes
1 answer

Code Sniffer error into js code

I have been searching since yesterday for the resolution of two code sniffer errors : 62 | ERROR | [x] Expected 1 space after closing parenthesis; found | | " options.keys = $.extend(\n Here is my code : if (newOptions.keys)…
0
votes
1 answer

PhpStorm. CodeSniffer. Doesn't see the comment blocks

PHP CodeSniffer doesn't see the doc blocks from PhpStorm inspection, but see them from the CLI. How to fix that? Here is an example. From inspection From CLI
D.R.
  • 2,540
  • 3
  • 24
  • 49