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
1
vote
1 answer

phpcs error references old project path -- how do I update the path?

When I run phpcs, it prints an error that references the path where my project formerly was located, but is no longer located... PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message…
arnoldbird
  • 886
  • 1
  • 13
  • 30
1
vote
1 answer

How to disable Code sniffer checking if namespaces are present

I have downloaded Code sniffer from this page (manual installation) and i have import it in my PHP storm IDE (i have included phpcs localy). Since i'm using cakephp i and namespaces are not needed i wan't to disable code sniffer for checking if…
Valor_
  • 3,461
  • 9
  • 60
  • 109
1
vote
0 answers

Rule CloseBraceAfterBody of PSR2 can not be autofixed from PhpStorm

In my projects I apply the PSR-2 code styling rules and I use Codesniffer to check my code through Continues Integration. I use PhpStrorm to write my code and PhpStorm has a functionality to reformat the code before commiting or while writing your…
gmponos
  • 2,157
  • 4
  • 22
  • 33
1
vote
1 answer

Custom codesniffer rules / sniffs

I'm looking for custom rules extending the PSR2 standard for CodeSniffer, but could not find a reliable solution. Here is a sample code: if ($var1==$var2) { $var3=1; $var4 = array("test"=>"test1"); } I need to enforce spaces around the ==…
Stanimir Stoyanov
  • 1,623
  • 18
  • 29
1
vote
1 answer

Code Consistency badge for packages using PHP_CodeSniffer

The PHP_CodeSniffer Github page has a very nice Code Consistency badge. Clicking the badge takes you to a breakdown of the analysis for the ranking reported by the badge. You can also see the analysis of many packages. I would like to include a…
Courtney Miles
  • 3,756
  • 3
  • 29
  • 47
1
vote
1 answer

PhpStorm Code Sniffer only show first 100 errors

How can I extend this number, because I have a 5000 lines of code where it has 8000 errors (known from command line phpcs), but it can show only first 100 in PhpStorm?!
PumpkinSeed
  • 2,945
  • 9
  • 36
  • 62
1
vote
1 answer

where does phpcs store values on windows os

I am able to do successfully the command phpcs --config-set show_progress 1 but I don't know where phpcs stores this values on my disk on Windows 7 Operating System.
1
vote
1 answer

phpcs - Set default message type to warning for all snips from a custom ruleset

I am configuring phpcs to use WordPress coding standards using a custom ruleset. My phpcs.xml looks like this Bulk Delete coding standard ./
Sudar
  • 18,954
  • 30
  • 85
  • 131
1
vote
1 answer

Codesniffer to check for whitespace lines

Which codesniffer sniff should I use to find lines which just contain spaces? The PSR-2 standard already covers whitespace at end of non-empty lines, but I also want to cover empty lines.
white_gecko
  • 4,808
  • 4
  • 55
  • 76
1
vote
1 answer

How to remove PHP Code Sniffer's highlighting from the code editor window in Netbeans

I've started using PHP Code Sniffer (phpcs) with Netbeans. Phpcs is managed by PHPCSMD plugin. It's configuration is found in Tools > Options > PHP > 'Debugging' and 'PHPCSMD' tabs. I really want to stop phpcs to mark warnings and notices in the…
luqo33
  • 8,001
  • 16
  • 54
  • 107
1
vote
1 answer

Identify if PHP_CodeSniffer is Sniffing an abstract (or final) class

I'm writing a Sniff in PHP_CodeSniffer for checking class names, and my abstract class names have some different naming requirements to non-abstract classes. How can I identify if current Sniff is sniffing an abstract class or not?
James
  • 4,644
  • 5
  • 37
  • 48
1
vote
1 answer

PHP CodeSniffer property not recognized

my sniff doesn't work and doesn't recognize the property private $testvar. I want to make a Doc-Block mandatory there. When I run code sniffer, the process method doesn't seem to be used. I added some echos there before. Does the token T_PROPERTY…
1
vote
1 answer

Change coding standard for CodeSniffer in PhpStorm

I've installed the CodeSniffer and want to use it with PhpStorm. I want to use the PSR2 coding standard to check for my source code, but it looks like the IDE checks with another standard. I can't find an option for changing the standards to define…
gustavgans
  • 5,141
  • 13
  • 41
  • 51
1
vote
2 answers

Is it possible to set d option for Code Sniffer in PHPStorm

I want to run code inspector in PHPStorm with Code Sniffer package. But Code Sniffer generates lot of useless messages for example "Default timezone is required since PHP 5.4". For manual usage of Code Sniffer I can use d option to set up PHP…
1
vote
1 answer

PHP Plugin Issue with Sonar 4.x version

We have integrated Jenkins with Sonar(4.1). And added PHP plugin as an extension but Sonar server is not starting . When we remove this plugin it runs fine. For this reason we are not able to use codesniffer for php. Please help. Thanks in advance.